blob: 06b34019893f04c8326ce6d154388f5de8af83ff (
plain)
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
|
.PHONY: web test dist clean realclean
ASSETS_SRC = $(wildcard game/www/*)
ASSETS_DST = $(patsubst game/www/%,dist/%,$(ASSETS_SRC))
TEST_PORT ?= 8000
EMCC_CFLAGS := -O3 \
-sUSE_GLFW=3 \
-sASSERTIONS=1 \
-sWASM=1 \
-sASYNCIFY \
-sGL_ENABLE_GET_PROC_ADDRESS=1 \
-sEXPORTED_RUNTIME_METHODS=HEAPF32,ccall,cwrap
web: dist $(ASSETS_DST)
test: web
cd dist && python3 -m http.server $(TEST_PORT)
dist:
env \
CC=emcc \
EMCC_CFLAGS="$(EMCC_CFLAGS)" \
C_INCLUDE_PATH="$(EMSDK_SYSROOT)/include:$C_INCLUDE_PATH" \
cargo build --target wasm32-unknown-emscripten --profile wasm
mkdir -p dist
cp ./target/wasm32-unknown-emscripten/wasm/game.{js,wasm} dist
dist/%: game/www/%
cp -r $< $@
clean:
rm -rf dist
realclean: clean
cargo clean
|