wasm_build/Makefile: build objects seperately
All checks were successful
Build and Publish WASM version of demo / Build-And-Deploy (push) Successful in 19s

This commit is contained in:
Stephen Seo 2023-08-18 15:13:47 +09:00
parent d4188f29b1
commit 2367b57294
2 changed files with 14 additions and 2 deletions

View file

@ -2,3 +2,4 @@
/jumpartifact.com_demo_0.js
/jumpartifact.com_demo_0.wasm
/jumpartifact.com_demo_0.data
/objdir/

View file

@ -4,6 +4,8 @@ else
OTHER_FLAGS = -Og
endif
OBJDIR = objdir
SOURCES = \
../src/main.cc \
../src/ems.cc \
@ -24,11 +26,13 @@ HEADERS = \
../src/3d_helpers.h \
../src/walker.h
OBJECTS = $(addprefix ${OBJDIR}/,$(subst ..,PREVDIR,$(subst .cc,.cc.o,${SOURCES})))
CXX = source ${HOME}/git/emsdk/emsdk_env.sh && em++
all: | format jumpartifact.com_demo_0.html
jumpartifact.com_demo_0.html: ${SOURCES} ${HEADERS}
jumpartifact.com_demo_0.html: ${OBJECTS} ${HEADERS}
${CXX} -std=c++20 -o jumpartifact.com_demo_0.html \
-s USE_GLFW=3 -I../wasm_include -L../wasm_lib -lraylib \
--shell-file custom_shell.html \
@ -36,7 +40,7 @@ jumpartifact.com_demo_0.html: ${SOURCES} ${HEADERS}
-sEXPORTED_RUNTIME_METHODS=ccall \
--preload-file ../res \
${OTHER_FLAGS} \
${SOURCES}
${OBJECTS}
.PHONY: clean format
@ -45,6 +49,13 @@ clean:
rm -f jumpartifact.com_demo_0.js
rm -f jumpartifact.com_demo_0.wasm
rm -f jumpartifact.com_demo_0.data
rm -rf "${OBJDIR}"
format:
clang-format -i --style=google ${SOURCES} ${HEADERS}
.SECONDEXPANSION:
${OBJDIR}/%.cc.o: $$(subst PREVDIR,..,%.cc) ${HEADERS}
@mkdir -p "${OBJDIR}/$(dir $(subst ..,PREVDIR,$<))"
${CXX} -std=c++20 -I../wasm_include -c ${OTHER_FLAGS} -o $@ $<