-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproto.mk
25 lines (23 loc) · 933 Bytes
/
proto.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
.PHONY: gen_proto
gen_proto:
find internal/protos -iname '*.proto' | xargs -n 1 dirname | uniq | \
xargs -n 1 -I '{}' bash -c "protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
{}/*.proto"
.PHONY: fetch_protoc
fetch_protoc:
@if protoc --version >/dev/null; \
then \
echo "protoc has already been installed" ; \
else \
echo "Installing protoc"; \
if test $(uname) Darwin; then \
brew install protobuf ; \
else \
curl -L --output protoc.zip "https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protoc-25.1-linux-x86_64.zip" ; \
unzip protoc.zip -d $HOME/.local ; \
echo "I've downloaded protoc binary to $HOME/.local. You're on your own now." ; \
fi ; \
fi
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]