From f482c98128fab311acfce28eb0d5a475525e7980 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 25 Jul 2017 22:50:00 +0800 Subject: [PATCH] feat(Makefile): add generate proto method --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 9d8974c..fc8b036 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ SOURCES ?= $(shell find . -name "*.go" -type f) TAGS ?= LDFLAGS ?= -X 'main.Version=$(VERSION)' TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'tempdir') +NODE_PROTOC_PLUGIN := $(shell which grpc_tools_node_protoc_plugin) ifneq ($(shell uname), Darwin) EXTLDFLAGS = -extldflags "-static" $(null) @@ -181,5 +182,13 @@ clean: -rm -rf bin/* \ .cover +rpc/example/node/gorush_grpc_pb.js: rpc/proto/gorush.proto + protoc -I rpc/proto rpc/proto/gorush.proto --js_out=import_style=commonjs,binary:rpc/example/node/ --grpc_out=rpc/example/node/ --plugin=protoc-gen-grpc=$(NODE_PROTOC_PLUGIN) + +rpc/proto/gorush.pb.go: rpc/proto/gorush.proto + protoc -I rpc/proto rpc/proto/gorush.proto --go_out=plugins=grpc:rpc/proto + +generate_proto: rpc/proto/gorush.pb.go rpc/example/node/gorush_grpc_pb.js + version: @echo $(VERSION)