-
Notifications
You must be signed in to change notification settings - Fork 62
/
Makefile
44 lines (35 loc) · 912 Bytes
/
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
.SUFFIXES:
all: debug
define BUILD
out/$1:
mkdir -p out/$1
out/$1/Makefile: | out/$1
cd out/$1 && cmake ../.. -DCMAKE_BUILD_TYPE=$1 -DWERROR=ON
.PHONY: $2
$2: out/$1/Makefile
+$(MAKE) --no-print-directory -C out/$1
endef
$(eval $(call BUILD,Debug,debug))
$(eval $(call BUILD,Release,release))
# Emscripten stuff
EMSCRIPTEN_DIR := emscripten
EMSCRIPTEN_CMAKE := ${EMSCRIPTEN_DIR}/cmake/Modules/Platform/Emscripten.cmake
define EMSCRIPTEN_BUILD
out/$1:
mkdir -p out/$1
out/$1/Makefile: | out/$1
cd out/$1 && \
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=$(EMSCRIPTEN_CMAKE) \
-DCMAKE_BUILD_TYPE=Release \
-DWERROR=ON $3
.PHONY: $2
$2: out/$1/Makefile
$(MAKE) --no-print-directory -C out/$1
endef
$(eval $(call EMSCRIPTEN_BUILD,JS,js,))
$(eval $(call EMSCRIPTEN_BUILD,Wasm,wasm,-DWASM=true))
.PHONY: demo
demo: wasm
cp out/Wasm/binjgb.js docs/
cp out/Wasm/binjgb.wasm docs/
emscripten: js