-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
45 lines (37 loc) · 1.02 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
.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 \
-DWASM_SIMD=$3
-DWERROR=ON
.PHONY: $2
$2: out/$1/Makefile
$(MAKE) --no-print-directory -C out/$1
endef
$(eval $(call EMSCRIPTEN_BUILD,Wasm,wasm,OFF))
$(eval $(call EMSCRIPTEN_BUILD,WasmSimd,wasm-simd,ON))
.PHONY: demo
demo: wasm wasm-simd
cp out/Wasm/binjnes.js docs/
cp out/Wasm/binjnes.wasm docs/
cp out/WasmSimd/binjnes-simd.js docs/binjnes-simd.js
cp out/WasmSimd/binjnes-simd.wasm docs/binjnes-simd.wasm