################################################## #Desc: Web Build System #Author: Mihrtec LLC #Date: 2016 ################################################## #Compile Overrides for web ################################################## #EMCC compiles with llvm CARCH := llvm #EMCC outputs to javascript APPSUF := .js #Place JS binary output in dist/js CBINDIR := $(DISTDIR)/js #Object files are in LLVM bitcode format COBJSUF := .bc #Expand the list of plain-text functions into what emcc expects EXPORT_FUNCS := $(patsubst %,'_%',$(EXPORT_FUNCS)) EXPORT_LIST := $(shell echo "$(EXPORT_FUNCS)" | sed -e 's@ @, @g') #Override the linker sed script to find our string LDSED := sed -e 's!.*rary \"\([a-zA-Z0-9\.]*\)\".*!\1!g' ################################################## #Emscripten Ports #To be replaced. Emscripten's ports are not #maintained well. ################################################## EMPORTS := SDL2 SDL2_image SDL2_ttf ifdef EMPORTS #Remove EMPORTS from the linker CLIBS := $(filter-out $(EMPORTS), $(CLIBS)) #Add supported ports to CFLAGS CFLAGS += -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s USE_SDL_TTF=2 endif #Override Automake vars (for building libs) AMGEN := emconfigure ./autogen.sh AMCONF := emconfigure ./configure AMMAKE := emmake #Set up emscripten APPFLAGS APPFLAGS += --separate-asm APPFLAGS += -s ALLOW_MEMORY_GROWTH=1 APPFLAGS += -s FORCE_FILESYSTEM=1 #APPLFAGS += --pre-js pre.js #Set up emscripten flags for CC CFLAGS += -s EXPORTED_FUNCTIONS="[$(EXPORT_LIST)]"