1 | # |
---|
2 | # Framsticks SDK makefile for Emscripten builds |
---|
3 | # |
---|
4 | # Before 2020, this makefile could be used natively under Windows as well (see history if needed). |
---|
5 | # However, now that the Windows Subsystem for Linux (WSL) exists, this file only supports Linux. |
---|
6 | # |
---|
7 | |
---|
8 | include frams/Makefile-SDK-files |
---|
9 | |
---|
10 | # set this path based on the project directory structure |
---|
11 | JS_PATH=../js/sdk |
---|
12 | |
---|
13 | SDK_JS=$(JS_PATH)/frams-sdk.js |
---|
14 | SDK_BIN=$(JS_PATH)/frams-sdk.bc |
---|
15 | I_PATH=$(JS_PATH)/js_interface |
---|
16 | |
---|
17 | I_OBJ=$(I_PATH)/js_interface.o |
---|
18 | I_SRC=$(I_PATH)/js_interface.cpp |
---|
19 | I_IMPL_SRC=$(I_PATH)/js_interface_impl.cpp |
---|
20 | I_IMPL_JS=$(I_PATH)/js_interface_impl.js |
---|
21 | I_IDL=$(I_PATH)/js_interface.idl |
---|
22 | |
---|
23 | # same as in cpp/frams/Makefile-SDK: |
---|
24 | CXXWARNINGS=-Wall -Wno-parentheses -Wno-overloaded-virtual -Wno-format -Wno-invalid-offsetof -Werror=return-type |
---|
25 | |
---|
26 | SDK_BUILD_CONFIG= -include frams/config/sdk-build-config.h |
---|
27 | CXXFLAGS= -I$(CURDIR) -std=gnu++17 -O3 $(SDK_BUILD_CONFIG) $(CXXWARNINGS) |
---|
28 | |
---|
29 | # avoid "duplicate symbol" linking errors. Instead of this pipeline, could use the "uniq" function built in included gmsl, or define a recursive function to filter out duplicates while preserving the order of elements. Also consider "$^". |
---|
30 | SDK_LIB_OBJS := $(shell echo $(SDK_LIB_OBJS) | tr ' ' '\n' | sort | uniq | tr '\n' ' ') |
---|
31 | |
---|
32 | ############################################# |
---|
33 | |
---|
34 | $(SDK_JS): $(I_IMPL_JS) $(I_IMPL_SRC) $(I_OBJ) $(SDK_LIB_OBJS) |
---|
35 | $(CXX) $(SDK_LIB_OBJS) $(I_OBJ) --post-js $(I_IMPL_JS) -O3 -s FORCE_FILESYSTEM=1 -s ALIASING_FUNCTION_POINTERS=0 -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=3 -s BINARYEN_ASYNC_COMPILATION=0 -sWASM=0 -o $@ |
---|
36 | |
---|
37 | $(I_IMPL_SRC) $(I_IMPL_JS): $(I_IDL) |
---|
38 | python3 $(EMSCRIPTEN)/tools/webidl_binder.py $(I_IDL) $(I_PATH)/js_interface_impl |
---|
39 | |
---|
40 | ############################################# |
---|
41 | |
---|
42 | include common/Makefile-maintain |
---|
43 | |
---|
44 | full_clean: clean |
---|
45 | rm -f WebIDLGrammar.pkl parser.out $(I_OBJ) $(I_IMPL_SRC) $(I_IMPL_JS) $(SDK_BIN) $(SDK_JS) |
---|