-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (39 loc) · 1.04 KB
/
Makefile
File metadata and controls
48 lines (39 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
.PHONY: all build run test clean tidy install proto
# Variables
APP_NAME := boot-go
CMD_PACKAGE := ./cmd/$(APP_NAME)
OUTPUT_DIR := ./bin
BINARY_PATH := $(OUTPUT_DIR)/$(APP_NAME)
# Default target
all: build
# Build the application from the project root.
build:
@echo "Building $(APP_NAME)..."
@mkdir -p $(OUTPUT_DIR)
@go build -o $(BINARY_PATH) $(CMD_PACKAGE)
# Run the application
run:
@go run $(CMD_PACKAGE)
# Test the application
test:
@echo "Running tests..."
@go test -v ./...
# Tidy dependencies
tidy:
@echo "Tidying go.mod..."
@go mod tidy
# Generate gRPC code from proto file
proto:
@echo "Generating gRPC code..."
@protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
proto/plugin.proto
# Clean build artifacts
clean:
@echo "Cleaning..."
@rm -f $(BINARY_PATH)
# Install the binary to a standard system-wide location.
install: build
@echo "Installing $(APP_NAME) to /usr/local/bin..."
@cp $(BINARY_PATH) /usr/local/bin/$(APP_NAME)
@echo "$(APP_NAME) installed successfully."