-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
342 lines (303 loc) · 9.78 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
ifeq ($(wildcard last_build),)
ifndef gf
gf = -std=c++11 -pthread -g -Wall -DLOG_LOGIC_TO_COUT -DLOG_INFO_TO_COUT
endif
ifndef go
go = g++ -c $(gf)
endif
else
ifeq ($(shell cat last_build),debug)
ifndef gf
gf = -std=c++11 -pthread -g -Wall -DLOG_LOGIC_TO_COUT -DLOG_INFO_TO_COUT
endif
ifndef go
go = g++ -c $(gf)
endif
else
ifndef gf
gf = -std=c++11 -pthread -O3 -DNO_LOGGING
endif
ifndef go
go = g++ -c $(gf)
endif
endif
endif
SHELL = /bin/bash
.PHONY: auto debug release run gdb clean tar
auto: | last_build
if [[ $$(cat last_build) == debug ]]; then \
$(MAKE) debug; \
else \
$(MAKE) release; \
fi
debug: | last_build
export gf="-std=c++11 -pthread -g -Wall -DLOG_LOGIC_TO_COUT -DLOG_INFO_TO_COUT"; \
export go="g++ -c $$gf"; \
[[ $$(cat last_build) != debug ]] && $(MAKE) clean; \
echo debug > last_build; \
$(MAKE) test
release: | last_build
export gf="-std=c++11 -pthread -O3 -DNO_LOGGING"; \
export go="g++ -c $$gf"; \
[[ $$(cat last_build) != release ]] && $(MAKE) clean; \
echo release > last_build; \
$(MAKE) test
last_build:
echo debug > last_build
test: \
test.o \
tests/board.o \
tests/position.o \
tests/game.o \
tests/deductors/no-show.o \
tests/deductors/card-count-exclude.o \
tests/deductors/seen.o \
tests/deductors/local-exclude.o \
tests/predictors/multiple.o \
tests/predictors/no-show.o \
tests/predictors/seen.o \
tests/deck.o \
tests/bot.o \
src/board.o \
src/position.o \
src/predictor.o \
src/deductors/no-show.o \
src/deductors/card-count-exclude.o \
src/deductors/seen.o \
src/deductors/local-exclude.o \
src/macros.o \
src/predictors/multiple.o \
src/predictors/no-show.o \
src/predictors/seen.o \
src/deck.o \
src/bot.o
g++ $(gf) test.o tests/board.o tests/position.o tests/game.o tests/deductors/no-show.o tests/deductors/card-count-exclude.o tests/deductors/seen.o tests/deductors/local-exclude.o tests/predictors/multiple.o tests/predictors/no-show.o tests/predictors/seen.o tests/deck.o tests/bot.o src/board.o src/position.o src/predictor.o src/deductors/no-show.o src/deductors/card-count-exclude.o src/deductors/seen.o src/deductors/local-exclude.o src/macros.o src/predictors/multiple.o src/predictors/no-show.o src/predictors/seen.o src/deck.o src/bot.o -o test
test.o: \
test.cpp
$(go) test.cpp -o test.o
tests/board.o: \
tests/board.cpp \
include/board.h
$(go) tests/board.cpp -o tests/board.o
tests/position.o: \
tests/position.cpp \
include/position.h \
include/board.h \
include/macros.h
$(go) tests/position.cpp -o tests/position.o
tests/game.o: \
tests/game.cpp \
include/bot.h \
include/board.h \
include/macros.h \
include/position.h
$(go) tests/game.cpp -o tests/game.o
tests/deductors/no-show.o: \
tests/deductors/no-show.cpp \
include/deductors/no-show.h \
include/deductor.h \
include/bot.h \
include/macros.h \
include/position.h
$(go) tests/deductors/no-show.cpp -o tests/deductors/no-show.o
tests/deductors/card-count-exclude.o: \
tests/deductors/card-count-exclude.cpp \
include/deductors/card-count-exclude.h \
include/deductor.h \
include/bot.h \
include/macros.h \
include/position.h
$(go) tests/deductors/card-count-exclude.cpp -o tests/deductors/card-count-exclude.o
tests/deductors/seen.o: \
tests/deductors/seen.cpp \
include/deductors/seen.h \
include/deductor.h \
include/bot.h \
include/macros.h \
include/position.h
$(go) tests/deductors/seen.cpp -o tests/deductors/seen.o
tests/deductors/local-exclude.o: \
tests/deductors/local-exclude.cpp \
include/deductors/local-exclude.h \
include/deductor.h \
include/bot.h \
include/macros.h \
include/position.h
$(go) tests/deductors/local-exclude.cpp -o tests/deductors/local-exclude.o
tests/predictors/multiple.o: \
tests/predictors/multiple.cpp \
include/predictors/multiple.h \
include/predictor.h \
include/bot.h \
include/deck.h \
include/macros.h \
include/position.h
$(go) tests/predictors/multiple.cpp -o tests/predictors/multiple.o
tests/predictors/no-show.o: \
tests/predictors/no-show.cpp \
include/predictors/no-show.h \
include/predictor.h \
include/bot.h \
include/deck.h \
include/macros.h \
include/position.h
$(go) tests/predictors/no-show.cpp -o tests/predictors/no-show.o
tests/predictors/seen.o: \
tests/predictors/seen.cpp \
include/predictors/seen.h \
include/predictor.h \
include/bot.h \
include/deck.h \
include/macros.h \
include/position.h
$(go) tests/predictors/seen.cpp -o tests/predictors/seen.o
tests/deck.o: \
tests/deck.cpp \
include/deck.h \
include/bot.h \
include/macros.h \
include/position.h
$(go) tests/deck.cpp -o tests/deck.o
tests/bot.o: \
tests/bot.cpp \
include/bot.h \
include/tests.h \
include/deck.h \
include/board.h \
include/macros.h \
include/position.h
$(go) tests/bot.cpp -o tests/bot.o
src/board.o: \
src/board.cpp \
include/board.h
$(go) src/board.cpp -o src/board.o
src/position.o: \
src/position.cpp \
include/position.h \
include/board.h \
include/macros.h
$(go) src/position.cpp -o src/position.o
src/predictor.o: \
src/predictor.cpp \
include/predictor.h \
include/bot.h \
include/deck.h \
include/macros.h \
include/position.h
$(go) src/predictor.cpp -o src/predictor.o
src/deductors/no-show.o: \
src/deductors/no-show.cpp \
include/deductors/no-show.h \
include/deductor.h \
include/bot.h \
include/macros.h \
include/position.h
$(go) src/deductors/no-show.cpp -o src/deductors/no-show.o
src/deductors/card-count-exclude.o: \
src/deductors/card-count-exclude.cpp \
include/deductors/card-count-exclude.h \
include/deductor.h \
include/bot.h \
include/macros.h \
include/position.h
$(go) src/deductors/card-count-exclude.cpp -o src/deductors/card-count-exclude.o
src/deductors/seen.o: \
src/deductors/seen.cpp \
include/deductors/seen.h \
include/deductor.h \
include/bot.h \
include/macros.h \
include/position.h
$(go) src/deductors/seen.cpp -o src/deductors/seen.o
src/deductors/local-exclude.o: \
src/deductors/local-exclude.cpp \
include/deductors/local-exclude.h \
include/deductor.h \
include/bot.h \
include/macros.h \
include/position.h
$(go) src/deductors/local-exclude.cpp -o src/deductors/local-exclude.o
src/macros.o: \
src/macros.cpp \
include/macros.h
$(go) src/macros.cpp -o src/macros.o
src/predictors/multiple.o: \
src/predictors/multiple.cpp \
include/predictors/multiple.h \
include/predictor.h \
include/bot.h \
include/deck.h \
include/macros.h \
include/position.h
$(go) src/predictors/multiple.cpp -o src/predictors/multiple.o
src/predictors/no-show.o: \
src/predictors/no-show.cpp \
include/predictors/no-show.h \
include/predictor.h \
include/bot.h \
include/deck.h \
include/macros.h \
include/position.h
$(go) src/predictors/no-show.cpp -o src/predictors/no-show.o
src/predictors/seen.o: \
src/predictors/seen.cpp \
include/predictors/seen.h \
include/predictor.h \
include/bot.h \
include/deck.h \
include/macros.h \
include/position.h
$(go) src/predictors/seen.cpp -o src/predictors/seen.o
src/deck.o: \
src/deck.cpp \
include/deck.h \
include/bot.h \
include/macros.h \
include/position.h
$(go) src/deck.cpp -o src/deck.o
src/bot.o: \
src/bot.cpp \
include/bot.h \
include/board.h \
include/deductor.h \
include/deductors/local-exclude.h \
include/deductors/no-show.h \
include/deductors/seen.h \
include/deductors/card-count-exclude.h \
include/deck.h \
include/predictor.h \
include/predictors/seen.h \
include/predictors/multiple.h \
include/predictors/no-show.h \
include/macros.h \
include/position.h
$(go) src/bot.cpp -o src/bot.o
run: $(shell [[ -f last_build ]] && cat last_build || echo debug) | last_build
./test
gdb: debug
gdb test
clean:
rm -f test.o tests/board.o tests/position.o tests/game.o tests/deductors/no-show.o tests/deductors/card-count-exclude.o tests/deductors/seen.o tests/deductors/local-exclude.o tests/predictors/multiple.o tests/predictors/no-show.o tests/predictors/seen.o tests/deck.o tests/bot.o src/board.o src/position.o src/predictor.o src/deductors/no-show.o src/deductors/card-count-exclude.o src/deductors/seen.o src/deductors/local-exclude.o src/macros.o src/predictors/multiple.o src/predictors/no-show.o src/predictors/seen.o src/deck.o src/bot.o ai.tar.gz test
tar:
tar -chvz test.cpp tests/board.cpp include/board.h tests/position.cpp include/position.h include/macros.h tests/game.cpp include/bot.h tests/deductors/no-show.cpp include/deductors/no-show.h include/deductor.h tests/deductors/card-count-exclude.cpp include/deductors/card-count-exclude.h tests/deductors/seen.cpp include/deductors/seen.h tests/deductors/local-exclude.cpp include/deductors/local-exclude.h tests/predictors/multiple.cpp include/predictors/multiple.h include/predictor.h include/deck.h tests/predictors/no-show.cpp include/predictors/no-show.h tests/predictors/seen.cpp include/predictors/seen.h tests/deck.cpp tests/bot.cpp include/tests.h src/board.cpp src/position.cpp src/predictor.cpp src/deductors/no-show.cpp src/deductors/card-count-exclude.cpp src/deductors/seen.cpp src/deductors/local-exclude.cpp src/macros.cpp src/predictors/multiple.cpp src/predictors/no-show.cpp src/predictors/seen.cpp src/deck.cpp src/bot.cpp makefile -f ai.tar.gz
doc:
doxygen doxyfile
.PHONY: coverage
coverage:
export gf="-std=c++11 -g -Wall --coverage -fprofile-arcs -ftest-coverage"; \
export go="g++ -c $$gf"; \
$(MAKE) clean; \
$(MAKE) test; \
./test; \
gcov -r src/*.cpp; \
lcov --directory src/ --capture --output-file coverage.info; \
lcov --remove coverage.info -o coverage.info '/usr/include/*'; \
lcov --remove coverage.info -o coverage.info '*/include/*'; \
lcov --list coverage.info; \
find . -name '*.gcda' -delete -or -name '*.gcno' -delete; \
[[ -d coverage ]] && rm -rf coverage; \
genhtml coverage.info --output-directory coverage; \
rm coverage.info; \
$(MAKE) clean
game: $(shell [[ -f last_build ]] && cat last_build || echo debug) | last_build
./test [game]