From b922f4bc640f423d3074a27fb970fa3bef3744b6 Mon Sep 17 00:00:00 2001 From: Julien Andrieux Date: Fri, 6 Oct 2017 16:19:00 +0200 Subject: [PATCH] Add target for the new protoc compilation --- Makefile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index df9f6a6..52fff7f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ SERVER_OUT := "bin/server" CLIENT_OUT := "bin/client" API_OUT := "api/api.pb.go" +API_REST_OUT := "api/api.pb.gw.go" PKG := "gitlab.com/pantomath-io/demo-grpc" SERVER_PKG_BUILD := "${PKG}/server" CLIENT_PKG_BUILD := "${PKG}/client" @@ -13,10 +14,18 @@ all: server client api/api.pb.go: api/api.proto @protoc -I api/ \ -I${GOPATH}/src \ + -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --go_out=plugins=grpc:api \ api/api.proto -api: api/api.pb.go ## Auto-generate grpc go sources +api/api.pb.gw.go: api/api.proto + @protoc -I api/ \ + -I${GOPATH}/src \ + -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + --grpc-gateway_out=logtostderr=true:api \ + api/api.proto + +api: api/api.pb.go api/api.pb.gw.go ## Auto-generate grpc go sources dep: ## Get the dependencies @go get -v -d ./... @@ -28,7 +37,7 @@ client: dep api ## Build the binary file for client @go build -i -v -o $(CLIENT_OUT) $(CLIENT_PKG_BUILD) clean: ## Remove previous builds - @rm $(SERVER_OUT) $(CLIENT_OUT) $(API_OUT) + @rm $(SERVER_OUT) $(CLIENT_OUT) $(API_OUT) $(API_REST_OUT) help: ## Display this help screen @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' -- 2.44.0