forked from moul/depviz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (57 loc) · 1.77 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
GOPKG ?= moul.io/depviz
GOBINS = ./cmd/depviz
#GOBINS += ./tools/opml-to-github-issues
#GOBINS += ./tools/sed-i-github-issues
DOCKER_IMAGE ?= moul/depviz
all: test install
PRE_INSTALL_STEPS += generate
PRE_TEST_STEPS += generate
PRE_BUILD_STEPS += generate
PRE_LING_STEPS += generate
PRE_BUMPDEPS_STEPS += generate
include rules.mk
.PHONY: update_examples
update_examples:
for dir in $(sort $(dir $(wildcard examples/*/*))); do (cd $$dir && make); done
@echo "now you can run:"
@echo " git commit examples -m \"chore: update examples\""
##
## generate
##
PROTOS_SRC := $(wildcard ./api/*.proto) $(wildcard ./api/internal/*.proto)
GEN_SRC := $(PROTOS_SRC) Makefile
.PHONY: generate
generate: gen.sum
gen.sum: $(GEN_SRC)
shasum $(GEN_SRC) | sort > gen.sum.tmp
@diff -q gen.sum gen.sum.tmp || ( \
set -xe; \
GO111MODULE=on go mod vendor; \
docker run \
--user=`id -u` \
--volume="$(PWD):/go/src/moul.io/depviz" \
--workdir="/go/src/moul.io/depviz" \
--entrypoint="sh" \
--rm \
moul/depviz-protoc:1 \
-xec 'make generate_local'; \
make tidy \
)
PROTOC_OPTS = -I ./vendor/github.com/grpc-ecosystem/grpc-gateway:./api:./vendor:/protobuf
.PHONY: generate_local
generate_local:
@set -e; for proto in $(PROTOS_SRC); do ( set -xe; \
protoc $(PROTOC_OPTS) \
--grpc-gateway_out=logtostderr=true:"$(GOPATH)/src" \
--gogofaster_out="plugins=grpc:$(GOPATH)/src" "$$proto" \
); done
goimports -w ./pkg ./cmd ./internal
shasum $(GEN_SRC) | sort > gen.sum.tmp
mv gen.sum.tmp gen.sum
.PHONY: clean
clean:
rm -f gen.sum $(wildcard */*/*.pb.go */*/*.pb.gw.go) $(wildcard out/*)
.PHONY: packr
packr:
GO111MODULE=off go get github.com/gobuffalo/packr/v2/packr2
cd internal/dvserver && packr2 && ls -la *-packr.go packrd/packed-packr.go