forked from infobloxopen/themis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
174 lines (137 loc) · 4.12 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
SRCROOT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
BUILDPATH = $(SRCROOT)/build
COVEROUT=$(SRCROOT)/cover.out
COVERTMP=/tmp/cover.out
AT = cd $(SRCROOT)
RM = rm -fv
GOBUILD = go build -v
GOFMTCHECK = test -z `gofmt -w -s *.go | tee /dev/stderr`
GOTEST = go test -v
COVER = $(GOTEST) -coverprofile=$(COVERTMP) -covermode=atomic
JOINCOVER = cat $(COVERTMP) >> $(COVEROUT)
GOTESTRACE = $(COVER) -race && $(JOINCOVER)
GOBENCH = $(GOTEST) -run=BypassAllTestsAndRunOnlyBenchmarks -bench=
GOBENCHALL = $(GOBENCH).
.PHONY: all
all: fmt build test bench
.PHONY: build-dir
build-dir:
mkdir -p $(BUILDPATH)
.PHONY: bootstrap
bootstrap:
glide install --strip-vendor
.PHONY: clean
clean:
@$(RM) $(COVEROUT)
@$(RM) $(BUILDPATH)
.PHONY: fmt
fmt: fmt-pdp fmt-pdp-yast fmt-pdp-jast fmt-pdp-jcon fmt-pdpctrl-client fmt-papcli fmt-pep fmt-pepcli fmt-pepcli-requests fmt-pepcli-test fmt-pepcli-perf fmt-pdpserver fmt-plugin fmt-egen
.PHONY: build
build: build-dir build-pepcli build-papcli build-pdpserver build-plugin build-egen
.PHONY: test
test: cover-out test-pdp test-pdp-yast test-pdp-jast test-pdp-jcon test-pep test-plugin
.PHONY: bench
bench: bench-pep bench-pdpserver
.PHONY: cover-out
cover-out:
echo > $(COVEROUT)
# Per package format targets
.PHONY: fmt-pdp
fmt-pdp:
@echo "Checking PDP format..."
@$(AT)/pdp && $(GOFMTCHECK)
.PHONY: fmt-pdp-yast
fmt-pdp-yast:
@echo "Checking PDP YAST format..."
@$(AT)/pdp/ast/yast && $(GOFMTCHECK)
.PHONY: fmt-pdp-jast
fmt-pdp-jast:
@echo "Checking PDP JAST format..."
@$(AT)/pdp/ast/jast && $(GOFMTCHECK)
.PHONY: fmt-pdp-jcon
fmt-pdp-jcon:
@echo "Checking PDP JCon format..."
@$(AT)/pdp/jcon && $(GOFMTCHECK)
.PHONY: fmt-pdpctrl-client
fmt-pdpctrl-client:
@echo "Checking PDP control client library format..."
@$(AT)/pdpctrl-client && $(GOFMTCHECK)
.PHONY: fmt-papcli
fmt-papcli:
@echo "Checking PAP CLI format..."
@$(AT)/papcli && $(GOFMTCHECK)
.PHONY: fmt-pep
fmt-pep:
@echo "Checking PEP client library format..."
@$(AT)/pep && $(GOFMTCHECK)
.PHONY: fmt-pepcli
fmt-pepcli:
@echo "Checking PEP CLI format..."
@$(AT)/pepcli && $(GOFMTCHECK)
.PHONY: fmt-pepcli-requests
fmt-pepcli-requests:
@echo "Checking PEP CLI requests package format..."
@$(AT)/pepcli/requests && $(GOFMTCHECK)
.PHONY: fmt-pepcli-test
fmt-pepcli-test:
@echo "Checking PEP CLI test package format..."
@$(AT)/pepcli/test && $(GOFMTCHECK)
.PHONY: fmt-pepcli-perf
fmt-pepcli-perf:
@echo "Checking PEP CLI perf package format..."
@$(AT)/pepcli/perf && $(GOFMTCHECK)
.PHONY: fmt-pdpserver
fmt-pdpserver:
@echo "Checking PDP server format..."
@$(AT)/pdpserver && $(GOFMTCHECK)
.PHONY: fmt-plugin
fmt-plugin:
@echo "Checking PE-CoreDNS Middleware format..."
@$(AT)/contrib/coredns/policy && $(GOFMTCHECK)
@$(AT)/contrib/coredns/policy/dnstap && $(GOFMTCHECK)
.PHONY: fmt-egen
fmt-egen:
@echo "Checking EGen format..."
@$(AT)/egen && $(GOFMTCHECK)
# Per package build targets
.PHONY: build-pepcli
build-pepcli: build-dir
$(AT)/pepcli && $(GOBUILD) -o $(BUILDPATH)/pepcli
.PHONY: build-papcli
build-papcli: build-dir
$(AT)/papcli && $(GOBUILD) -o $(BUILDPATH)/papcli
.PHONY: build-pdpserver
build-pdpserver: build-dir
$(AT)/pdpserver && $(GOBUILD) -o $(BUILDPATH)/pdpserver
.PHONY: build-plugin
build-plugin: build-dir
$(AT)/contrib/coredns/policy && $(GOBUILD)
$(AT)/contrib/coredns/policy/dnstap && $(GOBUILD)
.PHONY: build-egen
build-egen: build-dir
$(AT)/egen && $(GOBUILD) -o $(BUILDPATH)/egen
.PHONY: test-pdp
test-pdp: cover-out
$(AT)/pdp && $(GOTESTRACE)
.PHONY: test-pdp-yast
test-pdp-yast: cover-out
$(AT)/pdp/ast/yast && $(GOTESTRACE)
.PHONY: test-pdp-jast
test-pdp-jast: cover-out
$(AT)/pdp/ast/jast && $(GOTESTRACE)
.PHONY: test-pdp-jcon
test-pdp-jcon: cover-out
$(AT)/pdp/jcon && $(GOTESTRACE)
.PHONY: test-pep
test-pep: build-pdpserver cover-out
$(AT)/pep && $(GOTESTRACE)
.PHONY: test-plugin
test-plugin: cover-out
$(AT)/contrib/coredns/policy && $(GOTESTRACE)
$(AT)/contrib/coredns/policy/dnstap && $(GOTESTRACE)
.PHONY: bench-pep
bench-pep: build-pdpserver
$(AT)/pep && $(GOBENCH)\(Benchmark.*PolicySet\)\|\(BenchmarkStreamingClient\)
.PHONY: bench-pdpserver
bench-pdpserver:
$(AT)/pdpserver && $(GOBENCHALL)