Back to shtanton's homepage
summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 25 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index fc6af8f..aa91fae 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-build/main: src/all.c src/all.h
+build/main: src/all.c src/all.h build/images.c src/types.c src/levels.c src/tick.c
mkdir -p build
gcc -Wall -Wextra -Wpedantic -DSDL $$(pkg-config --libs sdl3) -o build/main src/all.c
@@ -7,11 +7,34 @@ build/main.wasm: src/all.c src/all.h
clang --target=wasm32 -nostdlib -DWASM -Wall -Wextra -Wpedantic \
-Wl,--no-entry -fno-builtin -o build/main.wasm src/all.c
+build/music.mp3.b64: res/music.mp3
+ mkdir -p build
+ (printf '"data:audio/mpeg;base64,'; base64 < res/music.mp3 | tr -d '\n'; printf '"') > build/music.mp3.b64
+
build/main.wasm.b64: build/main.wasm
+ mkdir -p build
(printf '"'; base64 < build/main.wasm | tr -d '\n'; printf '"') > build/main.wasm.b64
-build/index.html: src/index.html.in build/main.wasm.b64
+build/index.html: src/index.html.in build/main.wasm.b64 build/music.mp3.b64
+ mkdir -p build
clang -E -P -undef -nostdinc -x c -o build/index.html src/index.html.in
+build/img: src/img.c
+ mkdir -p build
+ gcc -Wall -Wextra -Wpedantic -o build/img src/img.c
+
+build/%.qoi: res/%.png
+ mkdir -p build
+ magick $< $@
+
+build/images.c: build/continue.qoi build/img
+ mkdir -p build
+ (\
+ build/img pixels build/continue.qoi 1 && \
+ echo 'Image images[] = {{0},' && \
+ build/img image build/continue.qoi 1 && \
+ echo '};' \
+ ) > build/images.c
+
clean:
rm -r build