-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (35 loc) · 1.68 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
# Project-specific settings
PROJECT := dia_world
EMP_DIR := ./Empirical/include
CEREAL_DIR := ./Empirical/third-party/cereal/include
# Flags to use regardless of compiler
CFLAGS_all := -Wall -Wno-unused-function -std=c++20 -I$(EMP_DIR)/
# Native compiler information
CXX_nat := clang++
CFLAGS_nat := -O3 -DNDEBUG $(CFLAGS_all)
CFLAGS_nat_debug := -g $(CFLAGS_all) -DEMP_TRACK_MEM
# Emscripten compiler information
CXX_web := emcc
OFLAGS_web_all := -s "EXTRA_EXPORTED_RUNTIME_METHODS=['ccall', 'cwrap']" -s TOTAL_MEMORY=67108864 --js-library $(EMP_DIR)/web/library_emp.js -s EXPORTED_FUNCTIONS="['_main', '_empCppCallback']" -s DISABLE_EXCEPTION_CATCHING=1 -s NO_EXIT_RUNTIME=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)
default: $(PROJECT)
native: $(PROJECT)
web: $(PROJECT).js
all: $(PROJECT) $(PROJECT).js
debug: CFLAGS_nat := $(CFLAGS_nat_debug)
debug: $(PROJECT)
debug-web: CFLAGS_web := $(CFLAGS_web_debug)
debug-web: $(PROJECT).js
web-debug: debug-web
$(PROJECT): Source/org.h Source/diagnostic.h Source/selection.h Source/world.h Source/native/$(PROJECT).cc
$(CXX_nat) $(CFLAGS_nat) Source/native/$(PROJECT).cc -o $(PROJECT)
@echo To build the web version use: make web
$(PROJECT).js: Source/web/$(PROJECT)-web.cc
$(CXX_web) $(CFLAGS_web) Source/web/$(PROJECT)-web.cc -o web/$(PROJECT).js
clean:
rm -f $(PROJECT) web/$(PROJECT).js web/*.js.map web/*.js.map *~ Source/*.o
# Debugging information
print-%: ; @echo '$(subst ','\'',$*=$($*))'