# # Framsticks SDK makefile for Emscripten builds # # Before 2020, this makefile could be used natively under Windows as well (see history if needed). # However, now that the Windows Subsystem for Linux (WSL) exists, this file only supports Linux. # include frams/Makefile-SDK-files # set this path based on the project directory structure JS_PATH=../js/sdk SDK_JS=$(JS_PATH)/frams-sdk.js SDK_BIN=$(JS_PATH)/frams-sdk.bc I_PATH=$(JS_PATH)/js_interface I_OBJ=$(I_PATH)/js_interface.o I_SRC=$(I_PATH)/js_interface.cpp I_IMPL_SRC=$(I_PATH)/js_interface_impl.cpp I_IMPL_JS=$(I_PATH)/js_interface_impl.js I_IDL=$(I_PATH)/js_interface.idl # same as in cpp/frams/Makefile-SDK: CXXWARNINGS=-Wall -Wno-parentheses -Wno-overloaded-virtual -Wno-format -Wno-invalid-offsetof -Werror=return-type SDK_BUILD_CONFIG= -include frams/config/sdk-build-config.h CXXFLAGS= -I$(CURDIR) -std=gnu++17 -O3 $(SDK_BUILD_CONFIG) $(CXXWARNINGS) # 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 "$^". SDK_LIB_OBJS := $(shell echo $(SDK_LIB_OBJS) | tr ' ' '\n' | sort | uniq | tr '\n' ' ') ############################################# $(SDK_JS): $(I_IMPL_JS) $(I_IMPL_SRC) $(I_OBJ) $(SDK_LIB_OBJS) $(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 $@ $(I_IMPL_SRC) $(I_IMPL_JS): $(I_IDL) python3 $(EMSCRIPTEN)/tools/webidl_binder.py $(I_IDL) $(I_PATH)/js_interface_impl ############################################# include common/Makefile-maintain full_clean: clean rm -f WebIDLGrammar.pkl parser.out $(I_OBJ) $(I_IMPL_SRC) $(I_IMPL_JS) $(SDK_BIN) $(SDK_JS)