2023-02-23 06:09:13 +00:00
|
|
|
EM_ENV = "${HOME}/git/emsdk/emsdk_env.sh"
|
|
|
|
CC = source ${EM_ENV} && emcc
|
2023-02-22 03:20:14 +00:00
|
|
|
|
2024-02-16 06:19:00 +00:00
|
|
|
RUST_SOURCES = \
|
|
|
|
../src/agnostic_interface/raylib_impl.rs \
|
|
|
|
../src/bin.rs \
|
|
|
|
../src/agnostic_interface.rs \
|
|
|
|
../src/shaders.rs \
|
|
|
|
../src/faux_quicksilver.rs \
|
|
|
|
../src/lib.rs \
|
|
|
|
../src/original_impl.rs \
|
|
|
|
../src/wasm_helpers.rs
|
|
|
|
|
2023-02-22 03:20:14 +00:00
|
|
|
all: ld45.html
|
|
|
|
|
|
|
|
ld45.html: src/main.c ../target/wasm32-unknown-emscripten/release/libld45_lib.a
|
|
|
|
${CC} -o ld45.html -s USE_GLFW=3 -Iinclude \
|
|
|
|
-Llib -lraylib \
|
2023-02-22 04:56:31 +00:00
|
|
|
-L../target/wasm32-unknown-emscripten/release -lld45_lib \
|
2023-02-23 06:09:13 +00:00
|
|
|
-sALLOW_MEMORY_GROWTH \
|
2024-02-13 03:00:30 +00:00
|
|
|
-s INITIAL_MEMORY=64MB \
|
|
|
|
-s TOTAL_STACK=32MB \
|
2023-02-22 04:56:31 +00:00
|
|
|
-O2 \
|
|
|
|
-sEXPORTED_FUNCTIONS="['_malloc', '_main']" \
|
2023-02-22 03:20:14 +00:00
|
|
|
-sEXPORTED_RUNTIME_METHODS=ccall,cwrap \
|
|
|
|
--preload-file ../static src/main.c
|
|
|
|
ln -sf ld45.html index.html
|
|
|
|
|
2023-02-22 04:56:31 +00:00
|
|
|
#-fsanitize=address \
|
|
|
|
#-sWARN_UNALIGNED=1 \
|
|
|
|
|
2024-02-16 06:19:00 +00:00
|
|
|
../target/wasm32-unknown-emscripten/release/libld45_lib.a: ${RUST_SOURCES}
|
2023-02-23 06:09:13 +00:00
|
|
|
cd .. && source ${EM_ENV} && cargo build --lib --release --target wasm32-unknown-emscripten
|
|
|
|
# cd .. && source ${EM_ENV} && cargo rustc --lib --release --target wasm32-unknown-emscripten -- -C link-args=-Wl,-zstack-size=8388608
|
2023-02-22 03:20:14 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f ld45.html
|
|
|
|
rm -f ld45.js
|
|
|
|
rm -f ld45.wasm
|
|
|
|
rm -f ld45.data
|
|
|
|
rm -f index.html
|
2023-02-22 04:56:31 +00:00
|
|
|
cd ..; cargo clean
|