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

Last change on this file since 865 was 865, checked in by Maciej Komosinski, 6 years ago

Added files needed to compile Framsticks SDK to JavaScript? using Emscripten

File size: 1.7 KB
Line 
1#
2# Framsticks SDK makefile for Emscripten builds
3#
4
5include frams/Makefile-SDK-files
6
7JS_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))
10ifeq ($(OS),Windows_NT)
11        CACHE_DIR=cache-tmp
12else
13        CACHE_DIR=$(CURDIR)/cache-tmp
14endif
15
16SDK_JS=$(JS_PATH)/frams-sdk.js
17SDK_BIN=$(JS_PATH)/frams-sdk.bc
18I_PATH=$(JS_PATH)/js_interface
19
20I_OBJ=$(I_PATH)/js_interface.o
21I_SRC=$(I_PATH)/js_interface.cpp
22I_IMPL_SRC=$(I_PATH)/js_interface_impl.cpp
23I_IMPL_JS=$(I_PATH)/js_interface_impl.js
24I_IDL=$(I_PATH)/js_interface.idl
25
26# same as in cpp/frams/Makefile-SDK:
27CXXWARNINGS=-Wall -Wno-parentheses -Wno-overloaded-virtual -Wno-format -Werror=return-type
28
29SDK_BUILD_CONFIG= -include frams/config/sdk_build_config.h
30CACHE_DESTINATION= --cache $(CACHE_DIR)
31CXXFLAGS= -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
47full_clean:
48ifeq ($(OS),Windows_NT)
49        del /s /q WebIDLGrammar.pkl parser.out *.o
50        rmdir /s /q $(CACHE_DIR)
51else
52        rm -f WebIDLGrammar.pkl parser.out $(SDK_LIB_OBJS)
53        rm -rf $(CACHE_DIR)
54endif
Note: See TracBrowser for help on using the repository browser.