-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile.proto
More file actions
39 lines (33 loc) · 1.08 KB
/
Makefile.proto
File metadata and controls
39 lines (33 loc) · 1.08 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
# Protobuf and gRPC code generation
PROTO_DIR := api/proto
GO_OUT_DIR := api/proto/ml
PROTO_FILES := $(wildcard $(PROTO_DIR)/*.proto)
.PHONY: proto
proto: proto-clean proto-gen
.PHONY: proto-gen
proto-gen:
@echo "Generating Go code from proto files..."
@mkdir -p $(GO_OUT_DIR)
protoc \
--go_out=$(GO_OUT_DIR) \
--go_opt=paths=source_relative \
--go-grpc_out=$(GO_OUT_DIR) \
--go-grpc_opt=paths=source_relative \
-I $(PROTO_DIR) \
$(PROTO_FILES)
.PHONY: proto-clean
proto-clean:
@echo "Cleaning generated proto files..."
@rm -rf $(GO_OUT_DIR)/*.pb.go
.PHONY: install-proto-tools
install-proto-tools:
@echo "Installing protobuf tools..."
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
.PHONY: help-proto
help-proto:
@echo "Protobuf targets:"
@echo " proto - Clean and regenerate all proto files"
@echo " proto-gen - Generate Go code from proto files"
@echo " proto-clean - Remove generated proto files"
@echo " install-proto-tools - Install required protobuf tools"