From 935f69ca25bca24fd36166e7192ebb69af2d35e9 Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Sat, 5 Apr 2025 08:10:21 +0100 Subject: Get web assembly working --- Makefile | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index bfb6190..fc6af8f 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,17 @@ -main: src/all.c src/all.h - gcc -Wall -Wextra -Wpedantic -DSDL $$(pkg-config --libs sdl3) -o main src/all.c +build/main: src/all.c src/all.h + mkdir -p build + gcc -Wall -Wextra -Wpedantic -DSDL $$(pkg-config --libs sdl3) -o build/main src/all.c + +build/main.wasm: src/all.c src/all.h + mkdir -p build + clang --target=wasm32 -nostdlib -DWASM -Wall -Wextra -Wpedantic \ + -Wl,--no-entry -fno-builtin -o build/main.wasm src/all.c + +build/main.wasm.b64: build/main.wasm + (printf '"'; base64 < build/main.wasm | tr -d '\n'; printf '"') > build/main.wasm.b64 + +build/index.html: src/index.html.in build/main.wasm.b64 + clang -E -P -undef -nostdinc -x c -o build/index.html src/index.html.in + +clean: + rm -r build -- cgit v1.2.3