-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
130 lines (100 loc) · 4.17 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
# -----------------------------------------------------------------------------
# ____ __ ______ ___ ____ ___ ___
# / __ \/ / /_ __/ |__ \ / __ \__ \< /
# / /_/ / / / / __/ // / / /_/ // /
# / ____/ /___/ / / __// /_/ / __// /
# /_/ /_____/_/ /____/\____/____/_/
#
# -----------------------------------------------------------------------------
# make sure filename does not contains space !
HEADERS:=$(shell find src -type f -name '*.h')
# clean everything, reconfig everything, recompile everything
all: | clean extern configure build
# ------------------------------------------------------------------------------
# clean
# ------------------------------------------------------------------------------
# clean compiled files and generated header
clean:
@echo [DEBUG] Root Makefile : clean
@rm -rf bin build
@rm -f $(shell grep -ls '// Generated by dia2code' main.h ${HEADERS})
# ------------------------------------------------------------------------------
# distclean :
# ------------------------------------------------------------------------------
# removes everything that is generated, including external dependencies
# make -s : Silent operation
# Change to directory dir before reading the makefiles or doing anything else
distclean: clean
@echo [DEBUG] Root Makefile : distclean
@$(MAKE) -s -C extern clean
# -----------------------------------------------------------------------------
# external
# ------------------------------------------------------------------------------
# configure and compile external dependency
extern: #bin/dia2code bin/tgui
#@echo [DEBUG] Root Makefile : extern
#bin/dia2code:
# @$(MAKE) -s -C extern dia2code
#bin/tgui:
# @$(MAKE) -s -C extern tgui
# -----------------------------------------------------------------------------
# configure
# ------------------------------------------------------------------------------
# configure the project
configure:
@echo [DEBUG] Root Makefile : configure
@mkdir -p build
@cd build && cmake ..
# -----------------------------------------------------------------------------
# build
# -----------------------------------------------------------------------------
# compile all exe (client, server, ...)
build:
@echo [DEBUG] Root Makefile : build
@cd build && cmake --build .
bin/client:
@$(MAKE) -s -C build client
bin/server:
@$(MAKE) -s -C build server
# -----------------------------------------------------------------------------
# test
# -----------------------------------------------------------------------------
test:
cd build/test && ctest -VV --timeout 300 --report_level=detailed --output-on-failure
# -----------------------------------------------------------------------------
# docker
# -----------------------------------------------------------------------------
testdocker:
docker build -t plt-initial -f docker/plt-initial .
./docker/validate.sh plt-test
./docker/run_docker_bash.sh plt-test
# -----------------------------------------------------------------------------
# pdf from dia
# -----------------------------------------------------------------------------
diapdf: rapport/state.pdf rapport/render.pdf rapport/engine.pdf rapport/ai.pdf rapport/module.pdf
rapport/state.pdf: src/state.dia
dia -e rapport/state.ps $<
ps2pdf rapport/state.ps $@
rm -f rapport/state.ps
rapport/render.pdf: src/render.dia
dia -e rapport/render.ps $<
ps2pdf rapport/render.ps $@
rm -f rapport/render.ps
rapport/engine.pdf: src/engine.dia
dia -e rapport/engine.ps $<
ps2pdf rapport/engine.ps $@
rm -f rapport/engine.ps
rapport/ai.pdf: src/ai.dia
dia -e rapport/ai.ps $<
ps2pdf rapport/ai.ps $@
rm -f rapport/ai.ps
rapport/module.pdf: src/module.dia
dia -e rapport/module.ps $<
ps2pdf rapport/module.ps $@
rm -f rapport/module.ps
# -----------------------------------------------------------------------------
# others
# -----------------------------------------------------------------------------
list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
.PHONY: configure build clean extern test testdocker list