feat(Makefile): add generate proto method
This commit is contained in:
parent
20713be962
commit
f482c98128
9
Makefile
9
Makefile
|
@ -15,6 +15,7 @@ SOURCES ?= $(shell find . -name "*.go" -type f)
|
||||||
TAGS ?=
|
TAGS ?=
|
||||||
LDFLAGS ?= -X 'main.Version=$(VERSION)'
|
LDFLAGS ?= -X 'main.Version=$(VERSION)'
|
||||||
TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'tempdir')
|
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)
|
ifneq ($(shell uname), Darwin)
|
||||||
EXTLDFLAGS = -extldflags "-static" $(null)
|
EXTLDFLAGS = -extldflags "-static" $(null)
|
||||||
|
@ -181,5 +182,13 @@ clean:
|
||||||
-rm -rf bin/* \
|
-rm -rf bin/* \
|
||||||
.cover
|
.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:
|
version:
|
||||||
@echo $(VERSION)
|
@echo $(VERSION)
|
||||||
|
|
Loading…
Reference in New Issue