1 ##################################################
2 #Desc: Web Build System
5 ##################################################
6 #Compile Overrides for web
7 ##################################################
8 #EMCC compiles with llvm
10 #EMCC outputs to javascript
12 #Place JS binary output in dist/js
13 CBINDIR
:= $(DISTDIR
)/js
14 #Object files are in LLVM bitcode format
16 #Expand the list of plain-text functions into what emcc expects
17 EXPORT_FUNCS
:= $(patsubst %,'_%',$(EXPORT_FUNCS
))
18 EXPORT_LIST
:= $(shell echo
"$(EXPORT_FUNCS)" | sed
-e
's@ @, @g')
19 #Override the linker sed script to find our string
20 LDSED
:= sed
-e
's!.*rary \"\([a-zA-Z0-9\.]*\)\".*!\1!g'
21 ##################################################
23 #To be replaced. Emscripten's ports are not
25 ##################################################
26 EMPORTS
:= SDL2 SDL2_image SDL2_ttf
28 #Remove EMPORTS from the linker
29 CLIBS
:= $(filter-out $(EMPORTS
), $(CLIBS
))
30 #Add supported ports to CFLAGS
31 CFLAGS
+= -s USE_SDL
=2 -s USE_SDL_IMAGE
=2 -s USE_SDL_TTF
=2
34 #Override Automake vars (for building libs)
35 AMGEN
:= emconfigure .
/autogen.sh
36 AMCONF
:= emconfigure .
/configure
39 #Set up emscripten APPFLAGS
40 APPFLAGS
+= --separate-asm
41 APPFLAGS
+= -s ALLOW_MEMORY_GROWTH
=1
42 APPFLAGS
+= -s FORCE_FILESYSTEM
=1
43 #APPLFAGS += --pre-js pre.js
45 #Set up emscripten flags for CC
46 CFLAGS
+= -s EXPORTED_FUNCTIONS
="[$(EXPORT_LIST)]"