From 7bb8b8c7670728b0dcd510d8a8205bb3776368dd Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Sat, 5 Apr 2025 22:16:15 +0100 Subject: Add audio to web and images to SDL --- Makefile | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'Makefile') 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 -- cgit v1.2.3