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.js
/jumpartifact.com_demo_0.wasm /jumpartifact.com_demo_0.wasm
/jumpartifact.com_demo_0.data /jumpartifact.com_demo_0.data
/objdir/

View file

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