-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
150 lines (119 loc) · 4.94 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
# Project-specific settings
TEST_DIR := source/catch
EMP_DIR := Empirical/include
# Flags to use regardless of compiler
CFLAGS_all := -Wall -Wno-unused-function -std=c++20 -I$(EMP_DIR)/
# Native compiler information
CXX_nat := g++
CFLAGS_nat := -O3 -DNDEBUG $(CFLAGS_all)
CFLAGS_nat_debug := -g -DEMP_TRACK_MEM $(CFLAGS_all)
CFLAGS_nat_coverage := --coverage $(CFLAGS_all)
# Emscripten compiler information
CXX_web := emcc
OFLAGS_web_all := -s "EXPORTED_RUNTIME_METHODS=['ccall', 'cwrap', 'stringToUTF8', 'UTF8ToString']" -s TOTAL_MEMORY=268435456 --js-library $(EMP_DIR)/emp/web/library_emp.js -s EXPORTED_FUNCTIONS="['_main', '_empCppCallback', '_empDoCppCallback']" -s DISABLE_EXCEPTION_CATCHING=1 -s NO_EXIT_RUNTIME=1 -s ASSERTIONS=1 #--embed-file configs
OFLAGS_web := -Oz -DNDEBUG
OFLAGS_web_debug := -g4 -Oz -pedantic -Wno-dollar-in-identifier-extension
CFLAGS_web := $(CFLAGS_all) $(OFLAGS_web) $(OFLAGS_web_all)
CFLAGS_web_debug := $(CFLAGS_all) $(OFLAGS_web_debug) $(OFLAGS_web_all)
# Compiling different modes
default: default-mode
@echo Built default version using 'make default-mode'. To use other modes, use the following:
@echo Efficient mode: make efficient-mode
@echo Lysis mode: make lysis-mode
@echo PGG mode: make pgg-mode
@echo To build the web version use: make web
native: default-mode
web: symbulation.js
all: default-mode efficient-mode lysis-mode pgg-mode symbulation.js
default-mode: source/native/symbulation_default.cc
$(CXX_nat) $(CFLAGS_nat) source/native/symbulation_default.cc -o symbulation_default
efficient-mode: source/native/symbulation_efficient.cc
$(CXX_nat) $(CFLAGS_nat) source/native/symbulation_efficient.cc -o symbulation_efficient
lysis-mode: source/native/symbulation_lysis.cc
$(CXX_nat) $(CFLAGS_nat) source/native/symbulation_lysis.cc -o symbulation_lysis
pgg-mode: source/native/symbulation_pgg.cc
$(CXX_nat) $(CFLAGS_nat) source/native/symbulation_pgg.cc -o symbulation_pgg
symbulation.js: source/web/symbulation-web.cc
$(CXX_web) $(CFLAGS_web) source/web/symbulation-web.cc -o web/symbulation.js
# Debugging
debug:
@echo Please specify the mode to debug using the following:
@echo Default mode: make debug-default
@echo Efficient mode: make debug-efficient
@echo Lysis mode: make debug-lysis
@echo PGG mode: make debug-pgg
debug-default: CFLAGS_nat := $(CFLAGS_nat_debug)
debug-default: default-mode
default-debug: debug-default
debug-efficient: CFLAGS_nat := $(CFLAGS_nat_debug)
debug-efficient: efficient-mode
efficient-debug: debug-efficient
debug-lysis: CFLAGS_nat := $(CFLAGS_nat_debug)
debug-lysis: lysis-mode
lysis-debug: debug-lysis
debug-pgg: CFLAGS_nat := $(CFLAGS_nat_debug)
debug-pgg: pgg-mode
pgg-debug: debug-pgg
debug-web: CFLAGS_web := $(CFLAGS_web_debug)
debug-web: symbulation.js
web-debug: debug-web
# Debugging information
print-%: ; @echo '$(subst ','\'',$*=$($*))'
# Testing
test:
$(CXX_nat) $(CFLAGS_nat) $(TEST_DIR)/main.cc -o symbulation.test
./symbulation.test ~[integration]
@echo To run only the tests for each mode, use the following:
@echo Default mode testing: make test-default
@echo Efficient mode testing: make test-efficient
@echo Lysis mode testing: make test-lysis
@echo PGG mode testing: make test-pgg
test-debug:
$(CXX_nat) $(CFLAGS_nat_debug) $(TEST_DIR)/main.cc -o symbulation.test
./symbulation.test ~[integration]
@echo To debug and test for each mode, use the following:
@echo Default mode: make test-debug-default
@echo Efficient mode: make test-debug-efficient
@echo Lysis mode: make test-debug-lysis
@echo PGG mode: make test-debug-pgg
test-default:
$(CXX_nat) $(CFLAGS_nat) $(TEST_DIR)/main.cc -o symbulation.test
./symbulation.test [default]
test-debug-default:
$(CXX_nat) $(CFLAGS_nat_debug) $(TEST_DIR)/main.cc -o symbulation.test
./symbulation.test [default]
test-efficient:
$(CXX_nat) $(CFLAGS_nat) $(TEST_DIR)/main.cc -o symbulation.test
./symbulation.test [efficient]
test-debug-efficient:
$(CXX_nat) $(CFLAGS_nat_debug) $(TEST_DIR)/main.cc -o symbulation.test
./symbulation.test [efficient]
test-lysis:
$(CXX_nat) $(CFLAGS_nat) $(TEST_DIR)/main.cc -o symbulation.test
./symbulation.test [lysis]
test-debug-lysis:
$(CXX_nat) $(CFLAGS_nat_debug) $(TEST_DIR)/main.cc -o symbulation.test
./symbulation.test [lysis]
test-pgg:
$(CXX_nat) $(CFLAGS_nat) $(TEST_DIR)/main.cc -o symbulation.test
./symbulation.test [pgg]
test-debug-pgg:
$(CXX_nat) $(CFLAGS_nat_debug) $(TEST_DIR)/main.cc -o symbulation.test
./symbulation.test [pgg]
test-executable:
$(CXX_nat) $(CFLAGS_nat) $(TEST_DIR)/main.cc -o symbulation.test
test-all:
$(CXX_nat) $(CFLAGS_nat) $(TEST_DIR)/main.cc -o symbulation.test
./symbulation.test
test-debug-all:
$(CXX_nat) $(CFLAGS_nat_debug) $(TEST_DIR)/main.cc -o symbulation.test
./symbulation.test
# Extras
.PHONY: clean test serve
serve:
python3 -m http.server
clean:
rm -f symbulation* web/symbulation.js web/*.js.map web/*.js.map *~ source/*.o
coverage:
$(CXX_nat) $(CFLAGS_nat_coverage) $(TEST_DIR)/main.cc -o symbulation.test
./symbulation.test