diff --git a/Makefile b/Makefile index 1d09e4b04..62e65a74a 100644 --- a/Makefile +++ b/Makefile @@ -235,10 +235,26 @@ embed: pkg/server/assets.go static: frontend/out/index.html pkg/server/assets.go + +PROTOS := \ + $(wildcard pkg/pb/*.proto) + +GRPC_GO_DEPS := $(subst .proto,.pb.go,$(PROTOS)) + +%.pb.go: %.proto .FORCE + protoc --go-grpc_out=. --go_out=. --proto_path=. $< + +grpc: $(GRPC_GO_DEPS) grpc-py + +install-grpc-tools: + go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26 + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1 + pip install grpcio-tools + +grpc-py: + python -m grpc_tools.protoc -I$(PWD)/pkg/pb \ + --python_out=$(PWD)/python/bbgo \ + --grpc_python_out=$(PWD)/python/bbgo \ + $(PWD)/pkg/pb/bbgo.proto + .PHONY: bbgo bbgo-slim-darwin bbgo-slim-darwin-amd64 bbgo-slim-darwin-arm64 bbgo-darwin version dist pack migrations static embed desktop .FORCE - -protobuf: - protoc -I=$(PWD)/pkg/pb --go_out=$(PWD)/pkg/pb $(PWD)/pkg/pb/bbgo.proto - -protobuf-py: - python -m grpc_tools.protoc -I$(PWD)/pkg/pb --python_out=$(PWD)/python/bbgo --grpc_python_out=$(PWD)/python/bbgo $(PWD)/pkg/pb/bbgo.proto