mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-09-28 09:58:07 +03:00
51 lines
1.3 KiB
Makefile
51 lines
1.3 KiB
Makefile
# -*- Makefile -*-
|
|
|
|
OBJS := $(SYSOBJS) $(EMOBJS)
|
|
|
|
DEPS := $(OBJS:%.o=%.d)
|
|
|
|
INCLUDES := -Isrc -Isrc/sys
|
|
DEFS := -D_SYSTEM3
|
|
# DEFS += -D_DEBUG_CONSOLE
|
|
|
|
EMPORTS := -s USE_SDL=2 -s USE_SDL_TTF=2
|
|
EMFLAGS := -s ENVIRONMENT=web $(EMPORTS)
|
|
|
|
#EMFLAGS += -O1 -s SAFE_HEAP=1
|
|
EMFLAGS += -Oz
|
|
|
|
EMFLAGS += -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1
|
|
EMFLAGS += -s TOTAL_MEMORY=83886080
|
|
EMFLAGS += -s NO_EXIT_RUNTIME=1
|
|
|
|
WASMFLAGS := -s WASM=1 -s "BINARYEN_TRAP_MODE='allow'"
|
|
ASMJSFLAGS := -s WASM=0
|
|
|
|
CXX = em++
|
|
|
|
CXXFLAGS = $(DEFS) $(INCLUDES) $(EMFLAGS) -MMD
|
|
|
|
LFLAGS := $(EMFLAGS)
|
|
LFLAGS += -s EXPORTED_FUNCTIONS="['_main','_ags_setAntialiasedStringMode']"
|
|
LFLAGS += -s EXTRA_EXPORTED_RUNTIME_METHODS="['getValue','getMemory','addRunDependency','removeRunDependency']"
|
|
|
|
all: out/system3.js out/system3.asm.js
|
|
|
|
out:
|
|
mkdir out
|
|
|
|
out/system3.js: system3.bc emterpretify_whitelist out
|
|
$(CXX) $< $(LFLAGS) $(WASMFLAGS) $(LIBS) @emterpretify_whitelist -o $@
|
|
|
|
out/system3.asm.js: system3.bc emterpretify_whitelist out
|
|
$(CXX) $< $(LFLAGS) $(ASMJSFLAGS) $(LIBS) @emterpretify_whitelist -o $@
|
|
|
|
system3.bc: $(OBJS)
|
|
$(CXX) $(OBJS) $(LFLAGS) $(LIBS) -o $@
|
|
|
|
emterpretify_whitelist:
|
|
$(CXX) $(EMPORTS) -s EMTERPRETIFY=1 -s EMTERPRETIFY_ADVISE=1 system3.bc |grep EMTERPRETIFY_WHITELIST > $@
|
|
|
|
clean:
|
|
rm -f $(OBJS) $(DEPS) system3.js system3.bc $(DEPS)
|