[865] | 1 | # |
---|
| 2 | # Framsticks SDK makefile for Emscripten builds |
---|
| 3 | # |
---|
| 4 | |
---|
| 5 | include frams/Makefile-SDK-files |
---|
| 6 | |
---|
| 7 | JS_PATH=../js/sdk |
---|
| 8 | |
---|
| 9 | #Note: CURDIR needed because on linux, Emscripten does not differentiate between relative and absolute path, which causes shutil to raise Error("%s and %s are the same file" % (src, dst)) |
---|
| 10 | ifeq ($(OS),Windows_NT) |
---|
| 11 | CACHE_DIR=cache-tmp |
---|
| 12 | else |
---|
| 13 | CACHE_DIR=$(CURDIR)/cache-tmp |
---|
| 14 | endif |
---|
| 15 | |
---|
| 16 | SDK_JS=$(JS_PATH)/frams-sdk.js |
---|
| 17 | SDK_BIN=$(JS_PATH)/frams-sdk.bc |
---|
| 18 | I_PATH=$(JS_PATH)/js_interface |
---|
| 19 | |
---|
| 20 | I_OBJ=$(I_PATH)/js_interface.o |
---|
| 21 | I_SRC=$(I_PATH)/js_interface.cpp |
---|
| 22 | I_IMPL_SRC=$(I_PATH)/js_interface_impl.cpp |
---|
| 23 | I_IMPL_JS=$(I_PATH)/js_interface_impl.js |
---|
| 24 | I_IDL=$(I_PATH)/js_interface.idl |
---|
| 25 | |
---|
| 26 | # same as in cpp/frams/Makefile-SDK: |
---|
| 27 | CXXWARNINGS=-Wall -Wno-parentheses -Wno-overloaded-virtual -Wno-format -Werror=return-type |
---|
| 28 | |
---|
| 29 | SDK_BUILD_CONFIG= -include frams/config/sdk_build_config.h |
---|
| 30 | CACHE_DESTINATION= --cache $(CACHE_DIR) |
---|
| 31 | CXXFLAGS= -I$(CURDIR) -std=gnu++11 -O3 $(SDK_BUILD_CONFIG) $(CXXWARNINGS) $(CACHE_DESTINATION) |
---|
| 32 | |
---|
| 33 | ############################################# |
---|
| 34 | |
---|
| 35 | $(SDK_JS): $(I_IMPL_JS) $(I_IMPL_SRC) $(I_OBJ) $(SDK_BIN) |
---|
| 36 | $(CXX) $(SDK_BIN) $(I_OBJ) --post-js $(I_IMPL_JS) -g4 --memory-init-file 0 -s FORCE_FILESYSTEM=1 -s ALIASING_FUNCTION_POINTERS=0 -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=3 -s BINARYEN_ASYNC_COMPILATION=0 -s WASM=0 $(CACHE_DESTINATION) -o $@ |
---|
| 37 | |
---|
| 38 | $(SDK_BIN): $(SDK_LIB_OBJS) |
---|
| 39 | $(CXX) $(SDK_LIB_OBJS) $(LDFLAGS) $(CACHE_DESTINATION) -o $@ |
---|
| 40 | |
---|
| 41 | $(I_IMPL_SRC) $(I_IMPL_JS): $(I_IDL) |
---|
| 42 | python $(EMSCRIPTEN)/tools/webidl_binder.py $(I_IDL) $(I_PATH)/js_interface_impl |
---|
| 43 | |
---|
| 44 | ############################################# |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | full_clean: |
---|
| 48 | ifeq ($(OS),Windows_NT) |
---|
| 49 | del /s /q WebIDLGrammar.pkl parser.out *.o |
---|
| 50 | rmdir /s /q $(CACHE_DIR) |
---|
| 51 | else |
---|
| 52 | rm -f WebIDLGrammar.pkl parser.out $(SDK_LIB_OBJS) |
---|
| 53 | rm -rf $(CACHE_DIR) |
---|
| 54 | endif |
---|