-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
126 lines (93 loc) · 3.54 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
BDIR = build/
NDIR = $(BDIR)native/
WDIR = $(BDIR)web/
SRVDIR = $(BDIR)server/
EXE = $(NDIR)revengechess
JSEXE = $(WDIR)revengechess.js
SERVER_NAME = rc2serve
SERVER_EXE = $(SRVDIR)$(SERVER_NAME)
NCC = g++
WCC = em++
INCLUDE = -I inc/ -I third_party/nlohmann_json/include/ -I third_party/websocketpp/ -I third_party/asio/asio/include
NOPTIONS = -Wall -Wextra -pedantic -g -Ofast
SOPTIONS = -Wall -Wextra -pedantic -g -pthread --std=c++17
SLIB = -lssl -lcrypto
SDEFS =
WOPTIONS = -O3 --bind --no-entry -s ASSERTIONS=1
MEMCHECK = valgrind --tool=memcheck --leak-check=yes --show-reachable=yes
all: native web server
native: $(EXE)
web: js_exe webui
js_exe: $(JSEXE)
webui: $(WDIR)index.html $(WDIR)style.css $(WDIR)img/pieces/* $(WDIR)sound/*.mp3 $(WDIR)img/*.png $(WDIR)favicon.ico $(WDIR)src/board.js $(WDIR)src/infopane.js $(WDIR)src/util.js $(WDIR)engine.worker.js $(WDIR)src/ai.js $(WDIR)src/client.js $(WDIR)src/tutorials.data.js $(WDIR)src/sound_manager.js
test: $(EXE)
$(EXE)
memcheck: $(EXE)
$(MEMCHECK) $(EXE)
test_server: server
(cd $(SRVDIR); ./$(SERVER_NAME))
memcheck_server: server
(cd $(SRVDIR); $(MEMCHECK) ./$(SERVER_NAME))
server_tls: SDEFS += -DRC_SERV_USE_TLS
server_tls: server
server: server_exe server_conf
server_exe_tls: SDEFS += -DRC_SERV_USE_TLS
server_exe_tls: server_exe
server_exe: $(SERVER_EXE)
$(SERVER_EXE): src/server_main.cpp src/version.cpp src/game/* src/server/*.cpp inc/*
mkdir -p $(SRVDIR)
$(NCC) $(SOPTIONS) -o $(SERVER_EXE) $(INCLUDE) $(SDEFS) src/server_main.cpp src/game/*.cpp src/server/*.cpp src/version.cpp $(SLIB)
server_conf: $(SRVDIR)conf.json
$(SRVDIR)conf.json: src/server/default_conf.json
mkdir -p $(SRVDIR)
cp src/server/default_conf.json $(SRVDIR)conf.json
clean:
rm -r $(BDIR)
$(EXE): src/native_main.cpp src/version.cpp src/engine/* src/game/* src/ui/* inc/*
mkdir -p $(NDIR)
$(NCC) $(NOPTIONS) -o $(EXE) $(INCLUDE) src/native_main.cpp src/game/*.cpp src/ui/*.cpp src/engine/*.cpp src/version.cpp
$(JSEXE): src/emcc_bindings.cpp src/version.cpp src/engine/* src/game/* inc/*
mkdir -p $(WDIR)
$(WCC) $(WOPTIONS) -o $(JSEXE) $(INCLUDE) src/game/*.cpp src/engine/*.cpp src/emcc_bindings.cpp src/version.cpp
$(WDIR)index.html: src/web/index.html
mkdir -p $(WDIR)
cp src/web/index.html $(WDIR)index.html
$(WDIR)style.css: src/web/style.css
mkdir -p $(WDIR)
cp src/web/style.css $(WDIR)style.css
$(WDIR)img/pieces/*: img/pieces/*
mkdir -p $(WDIR)img/pieces
cp img/pieces/* $(WDIR)img/pieces
$(WDIR)favicon.ico: img/favicon.ico
mkdir -p $(WDIR)img
cp img/favicon.ico $(WDIR)favicon.ico
$(WDIR)sound/*.mp3: sound/*.mp3
mkdir -p $(WDIR)sound
cp sound/*.mp3 $(WDIR)sound
$(WDIR)img/*.png: img/*.png
mkdir -p $(WDIR)img
cp img/*.png $(WDIR)img
$(WDIR)src/board.js: src/web/src/board.js
mkdir -p $(WDIR)src
cp src/web/src/board.js $(WDIR)src/
$(WDIR)src/infopane.js: src/web/src/infopane.js
mkdir -p $(WDIR)src
cp src/web/src/infopane.js $(WDIR)src/
$(WDIR)src/util.js: src/web/src/util.js
mkdir -p $(WDIR)src
cp src/web/src/util.js $(WDIR)src/
$(WDIR)engine.worker.js: src/web/engine.worker.js
mkdir -p $(WDIR)src
cp src/web/engine.worker.js $(WDIR)
$(WDIR)src/ai.js: src/web/src/ai.js
mkdir -p $(WDIR)src
cp src/web/src/ai.js $(WDIR)src/
$(WDIR)src/client.js: src/web/src/client.js
mkdir -p $(WDIR)src
cp src/web/src/client.js $(WDIR)src/
$(WDIR)src/tutorials.data.js: src/web/src/tutorials.data.js
mkdir -p $(WDIR)src
cp src/web/src/tutorials.data.js $(WDIR)src/
$(WDIR)src/sound_manager.js: src/web/src/sound_manager.js
mkdir -p $(WDIR)src
cp src/web/src/sound_manager.js $(WDIR)src/