-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile
51 lines (40 loc) · 1.2 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
39
40
41
42
43
44
45
46
47
48
49
50
51
ADS_VERSION=v0
PROTO_ROOT_DIR=googleapis/
PROTO_SRC_DIR=/google/ads/googleads/$(ADS_VERSION)/**/*.proto
PROTO_OUT_DIR=$$GOPATH/src/github.com/kritzware/google-ads-go/
PKG_PATH=paths=source_relative
PROTOC_GO_ARGS=--go_out=plugins=grpc,$(PKG_PATH):$(PROTO_OUT_DIR)
ENTRY=main.go
BIN=gads
build:
go build -o $$GOPATH/bin/$(BIN) $(ENTRY)
run:
go run $(ENTRY)
run-debug:
GODEBUG=http2debug=2 GRPC_GO_LOG_SEVERITY_LEVEL=info GRPC_GO_LOG_VERBOSITY_LEVEL=2 go run $(ENTRY)
test:
go test -v -cover ./...
.SILENT protos: clean-protos clean-gen-protos
echo "converting protos for version $(ADS_VERSION)"
for file in $(PROTO_ROOT_DIR)$(PROTO_SRC_DIR); do \
echo "converting proto $$(basename $$file)"; \
protoc -I=$(PROTO_ROOT_DIR) $(PROTOC_GO_ARGS) $$file; \
done; \
sh ./fix-package-paths.sh; \
rm -rf google/
@echo "built proto files to $$(basename $(PROTO_OUT_DIR))"
clean-protos:
rm -rf common/
rm -rf enums/
rm -rf errors/
rm -rf resources/
rm -rf services/
clean-gen-protos:
rm -rf google/
clone-googleapis:
cd $(PROTO_ROOT_DIR)
git submodule update --init --recursive
update-googleapis:
cd $(PROTO_ROOT_DIR)
git submodule update --recursive --remote
.PHONY: protos clone-googleapis update-googleapis