-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile.emscripten
44 lines (27 loc) · 1.15 KB
/
Makefile.emscripten
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
CC := em++
# Emscripten stuff - todo: add -s INVOKE_RUN=0 for lib version (not .html)
EMFLAGS := --bind --llvm-lto 3 -s ASSERTIONS=0 -s DISABLE_EXCEPTION_CATCHING=1 --preload-file assets
CXXFLAGS := -O3 -std=c++11 -W -Wall -Wextra $(EMFLAGS)
asmjs: CXXFLAGS += --closure 1 -s WASM=0
asmjs-html: CXXFLAGS += --closure 1 -s WASM=0
wasm: CXXFLAGS += --closure 0 -s WASM=1 -s "BINARYEN_METHOD='native-wasm,asmjs'"
wasm-html: CXXFLAGS += --closure 0 -s WASM=1 -s "BINARYEN_METHOD='native-wasm,asmjs'"
SOURCES := $(wildcard src/*.cpp) $(wildcard src/TypeHandlers/*.cpp) tests.cpp
OUTPUT := tivars_test
OBJS = $(patsubst %.cpp, %.bc, $(SOURCES))
OUTPUT := tivars_test
asmjs: $(OUTPUT).html
wasm: $(OUTPUT).html
$(OUTPUT).html: $(OUTPUT).js
asmjs-html: $(OBJS)
$(CC) $(CXXFLAGS) $(LFLAGS) $^ -o $(OUTPUT).html
wasm-html: $(OBJS)
$(CC) $(CXXFLAGS) $(LFLAGS) $^ -o $(OUTPUT).html
all: asmjs-html
%.bc: %.cpp
$(CC) $(CXXFLAGS) -c $< -o $@
$(OUTPUT).js: $(OBJS)
$(CC) $(CXXFLAGS) $(LFLAGS) $^ -o $@
clean:
$(RM) -f $(OBJS) $(OUTPUT).js* $(OUTPUT).html* $(OUTPUT).data $(OUTPUT).asm.js $(OUTPUT).was*
.PHONY: all clean asmjs wasm asmjs-html wasm-html