-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile.emscripten
More file actions
39 lines (27 loc) · 1022 Bytes
/
Makefile.emscripten
File metadata and controls
39 lines (27 loc) · 1022 Bytes
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
CXX := em++
DEBUG ?= 0
ifeq ($(DEBUG),1)
OPTFLAGS := -O0 -g3 -flto
ASSERTIONS := 2
DEBUG_EMFLAGS := -s SAFE_HEAP=1
else
OPTFLAGS := -O3 -flto
ASSERTIONS := 0
DEBUG_EMFLAGS :=
endif
# Emscripten stuff
EMFLAGS := --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) --embed-file ti-toolkit-8x-tokens.xml
CXXFLAGS := $(OPTFLAGS) -std=c++2a -DTH_GDB_SUPPORT=1 -Ivendor/pugixml -W -Wall -Wextra
LFLAGS := $(OPTFLAGS) $(EMFLAGS)
SOURCES := $(wildcard src/*.cpp) $(wildcard src/TypeHandlers/*.cpp) vendor/pugixml/pugixml.cpp
OBJS = $(patsubst %.cpp, %.bc, $(SOURCES))
OUTPUT := TIVarsLib
wasm: $(OUTPUT).js
all: wasm
%.bc: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
$(OUTPUT).js: $(OBJS)
$(CXX) $(CXXFLAGS) $(LFLAGS) $^ -o $@
clean:
$(RM) -f $(OBJS) $(OUTPUT).js* $(OUTPUT).was*
.PHONY: all clean wasm