Back to shtanton's homepage
summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files changed, 17 insertions, 2 deletions
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