-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (32 loc) · 1.19 KB
/
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
.PHONY: gen
PROTO_PATH := ./proto
GO_PROTOS := benchmark/v1/benchmark.proto
TOOLS_PATH = ./tools/bin
.PHONY: proto-tools
proto-tools:
mkdir -p $(TOOLS_PATH)
go build -ldflags "-s -w" -o $(TOOLS_PATH)/protoc-gen-go \
google.golang.org/protobuf/cmd/protoc-gen-go
go build -ldflags "-s -w" -o $(TOOLS_PATH)/buf \
github.com/bufbuild/buf/cmd/buf
go build -ldflags "-s -w" -o $(TOOLS_PATH)/protoc-gen-buf-check-lint \
github.com/bufbuild/buf/cmd/protoc-gen-buf-check-lint
go build -ldflags "-s -w" -o $(TOOLS_PATH)/protoc-gen-buf-check-breaking \
github.com/bufbuild/buf/cmd/protoc-gen-buf-check-breaking
.PHONY: proto-gen
proto-gen: $(addprefix $(PROTO_PATH)/, $(GO_PROTOS))
protoc \
-I$(PROTO_PATH):. \
--proto_path=$(PROTO_PATH) \
--go_out=$(PROTO_PATH) \
--buf-check-lint_out=$(PROTO_PATH) \
--go_opt=paths=source_relative \
--plugin=protoc-gen-go=$(TOOLS_PATH)/protoc-gen-go \
--plugin=protoc-gen-buf-check-lint=$(TOOLS_PATH)/protoc-gen-buf-check-lint \
$(GO_PROTOS)
.PHONY: proto-gen
benchmark:
BENCHMARK_DATA=$(SRC) go test -run=Bench -bench=. -benchmem
.PHONY: proto-gen
generate-samples:
go run ./cmd/testsetgen -target ./testdata/testdata_$(COUNT).ndjson -count $(COUNT)