source: js/sdk/Makefile-SDK-Emscripten.mak @ 1324

Last change on this file since 1324 was 1324, checked in by Maciej Komosinski, 4 months ago

Updated for current SDK sources and current Emscripten

File size: 1.8 KB
Line 
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
8include frams/Makefile-SDK-files
9
10# set this path based on the project directory structure
11JS_PATH=../js/sdk
12
13SDK_JS=$(JS_PATH)/frams-sdk.js
14SDK_BIN=$(JS_PATH)/frams-sdk.bc
15I_PATH=$(JS_PATH)/js_interface
16
17I_OBJ=$(I_PATH)/js_interface.o
18I_SRC=$(I_PATH)/js_interface.cpp
19I_IMPL_SRC=$(I_PATH)/js_interface_impl.cpp
20I_IMPL_JS=$(I_PATH)/js_interface_impl.js
21I_IDL=$(I_PATH)/js_interface.idl
22
23# same as in cpp/frams/Makefile-SDK:
24CXXWARNINGS=-Wall -Wno-parentheses -Wno-overloaded-virtual -Wno-format -Wno-invalid-offsetof -Werror=return-type
25
26SDK_BUILD_CONFIG= -include frams/config/sdk-build-config.h
27CXXFLAGS= -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 "$^".
30SDK_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
42include common/Makefile-maintain
43
44full_clean: clean
45        rm -f WebIDLGrammar.pkl parser.out $(I_OBJ) $(I_IMPL_SRC) $(I_IMPL_JS) $(SDK_BIN) $(SDK_JS)
Note: See TracBrowser for help on using the repository browser.