-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
24 lines (19 loc) · 822 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
export GOPATH ?= ${HOME}/go
export PATH := ${GOPATH}/bin:${PATH}
export GO111MODULE = on
PROTOC_ARCH ?= linux-x86_64
PROTOC_VERSION ?= 3.10.1
PROTOC_GEN_GO_VERSION ?= v1.3.2
clean:
find . -iname *.pb.go -exec rm {} \;
rm -f lightraft
${GOPATH}/bin/protoc:
curl -L -o "/tmp/protoc-${PROTOC_VERSION}-${PROTOC_ARCH}.zip" "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-${PROTOC_ARCH}.zip"
unzip -d ${GOPATH} "/tmp/protoc-${PROTOC_VERSION}-${PROTOC_ARCH}.zip" bin/protoc
reqs: ${GOPATH}/bin/protoc
go mod download
go get github.com/golang/protobuf/protoc-gen-go@${PROTOC_GEN_GO_VERSION}
grpcs: reqs clean
find . -name *.proto -print0 | xargs -I {} -0 bash -c 'protoc -I=`dirname {}` --go_out=plugins=grpc:`dirname {}` {}'
lightraft: clean grpcs
go build