@@ -7,15 +7,16 @@ ifeq ($(DEBUG),1)
77 ASSERTIONS := 2
88 DEBUG_EMFLAGS := -s SAFE_HEAP=1
99else
10- OPTFLAGS := -O3 -flto
10+ OPTFLAGS := -Oz -flto
1111 ASSERTIONS := 0
1212 DEBUG_EMFLAGS :=
1313endif
1414
1515# Emscripten stuff
1616EMFLAGS := --bind -s WASM=1 -s MODULARIZE=1 -s EXPORT_ES6=1 -s EXPORT_NAME="'TIVarsLib'" -s NO_EXIT_RUNTIME=1 -s ASSERTIONS=$(ASSERTIONS) -s DISABLE_EXCEPTION_CATCHING=0 -s EXPORTED_RUNTIME_METHODS="['FS','getExceptionMessage','decrementExceptionRefcount']" $(DEBUG_EMFLAGS)
1717
18- CXXFLAGS := $(OPTFLAGS) -std=c++2a -DTH_GDB_SUPPORT=1 -Ivendor/pugixml -W -Wall -Wextra -fexceptions
18+ CPPFLAGS := -DTH_GDB_SUPPORT=1 -Ivendor/pugixml
19+ CXXFLAGS := $(OPTFLAGS) -std=c++2a -W -Wall -Wextra -fexceptions
1920CFLAGS := $(OPTFLAGS) -std=c2x -W -Wall -Wextra
2021LFLAGS := $(OPTFLAGS) $(EMFLAGS)
2122
@@ -34,22 +35,22 @@ wasm-tests: $(TEST_OUTPUT).js
3435 node --no-warnings scripts/run_wasm_tests.mjs
3536
3637%.bc: %.cpp
37- $(CXX) $(CXXFLAGS) -c $< -o $@
38+ $(CXX) $(CPPFLAGS) $( CXXFLAGS) -c $< -o $@
3839
3940%.bc: %.c
4041 $(CC) $(CFLAGS) -c $< -o $@
4142
4243$(OUTPUT).js: $(OBJS)
43- $(CXX) $(CXXFLAGS) $( LFLAGS) $^ -o $@
44+ $(CXX) $(LFLAGS) $^ -o $@
4445
4546tests_wasm.bc: tests.cpp
46- $(CXX) $(CXXFLAGS) -Dmain=tivars_tests_main -c $< -o $@
47+ $(CXX) $(CPPFLAGS) $( CXXFLAGS) -Dmain=tivars_tests_main -c $< -o $@
4748
4849scripts/wasm_tests_main.bc: scripts/wasm_tests_main.cpp
49- $(CXX) $(CXXFLAGS) -c $< -o $@
50+ $(CXX) $(CPPFLAGS) $( CXXFLAGS) -c $< -o $@
5051
5152$(TEST_OUTPUT).js: $(filter-out src/main_emscripten.bc,$(OBJS)) tests_wasm.bc scripts/wasm_tests_main.bc
52- $(CXX) $(CXXFLAGS) $( OPTFLAGS) --bind -s WASM=1 -s MODULARIZE=1 -s EXPORT_ES6=1 -s EXPORT_NAME="'TIVarsTests'" -s NODERAWFS=1 -s EXIT_RUNTIME=1 -s ASSERTIONS=$(ASSERTIONS) -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_RUNTIME_METHODS="['callMain','getExceptionMessage','decrementExceptionRefcount']" $^ -o $@
53+ $(CXX) $(OPTFLAGS) --bind -s WASM=1 -s MODULARIZE=1 -s EXPORT_ES6=1 -s EXPORT_NAME="'TIVarsTests'" -s NODERAWFS=1 -s EXIT_RUNTIME=1 -s ASSERTIONS=$(ASSERTIONS) -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_RUNTIME_METHODS="['callMain','getExceptionMessage','decrementExceptionRefcount']" $^ -o $@
5354
5455clean:
5556 $(RM) -f $(OBJS) tests_wasm.bc scripts/wasm_tests_main.bc $(OUTPUT).js* $(OUTPUT).was* $(TEST_OUTPUT).js* $(TEST_OUTPUT).was*
0 commit comments