34 lines
926 B
Makefile
34 lines
926 B
Makefile
.PHONY: generate build clean
|
|
|
|
PROTOC := protoc
|
|
GO_PROTOC_GEN_GO := $(shell go env GOPATH)/bin/protoc-gen-go
|
|
GO_PROTOC_GEN_GO_GRPC := $(shell go env GOPATH)/bin/protoc-gen-go-grpc
|
|
|
|
PROTO_FILES := proto/agent.proto
|
|
PROTO_OUT_DIR := proto
|
|
|
|
generate:
|
|
@echo "Generating Go code from proto files..."
|
|
$(PROTOC) --go_out=. --go_opt=paths=source_relative \
|
|
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
|
|
$(PROTO_FILES)
|
|
@echo "Proto generation complete"
|
|
|
|
build: generate
|
|
@echo "Building proto module..."
|
|
go mod tidy
|
|
@echo "Build complete"
|
|
|
|
clean:
|
|
@echo "Cleaning generated files..."
|
|
rm -f $(PROTO_OUT_DIR)/*.pb.go
|
|
rm -f $(PROTO_OUT_DIR)/*_grpc.pb.go
|
|
@echo "Clean complete"
|
|
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " generate - Generate Go code from proto files"
|
|
@echo " build - Generate proto and tidy go modules"
|
|
@echo " clean - Remove generated files"
|
|
@echo " help - Show this help message"
|