Skip to content

Commit

Permalink
feat(Makefile): add generate proto method
Browse files Browse the repository at this point in the history
  • Loading branch information
appleboy committed Jul 25, 2017
1 parent 20713be commit f482c98
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

0 comments on commit f482c98

Please sign in to comment.