diff options
| author | Charlie Stanton <charlie@shtanton.xyz> | 2025-04-05 23:31:34 +0100 | 
|---|---|---|
| committer | Charlie Stanton <charlie@shtanton.xyz> | 2025-04-05 23:31:34 +0100 | 
| commit | fa8d5f6a922f9159f8c050ea8b7fd6070475e00d (patch) | |
| tree | dc42ce86f4cc5ce68d9f4349199c35b590d5a270 /Makefile | |
| parent | b41d2ab5e44647564572c5162bf3109de4aaac82 (diff) | |
| download | ldjam57-fa8d5f6a922f9159f8c050ea8b7fd6070475e00d.tar | |
Add music to SDL port
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 20 | 
1 files changed, 17 insertions, 3 deletions
| @@ -1,8 +1,8 @@ -build/main: src/all.c src/all.h build/images.c src/types.c src/levels.c src/tick.c +build/main: src/all.c build/images.c build/music.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 -build/main.wasm: src/all.c src/all.h +build/main.wasm: src/all.c src/types.c src/levels.c src/tick.c  	mkdir -p build  	clang --target=wasm32 -nostdlib -DWASM -Wall -Wextra -Wpedantic \  		-Wl,--no-entry -fno-builtin -o build/main.wasm src/all.c @@ -11,11 +11,15 @@ 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/%.png.b64: res/%.png +	mkdir -p build +	(printf '"data:image/png;base64,'; base64 < $< | tr -d '\n'; printf '"') > $@ +  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/music.mp3.b64 +build/index.html: src/index.html.in build/main.wasm.b64 build/music.mp3.b64 build/continue.png.b64  	mkdir -p build  	clang -E -P -undef -nostdinc -x c -o build/index.html src/index.html.in @@ -27,6 +31,16 @@ build/%.qoi: res/%.png  	mkdir -p build  	magick $< $@ +build/music.pcm: res/music.mp3 +	ffmpeg -i res/music.mp3 -acodec pcm_s16le -f s16le build/music.pcm + +build/music.c: build/music.pcm +	( \ +		echo 'unsigned char musicBytes[] = {' && \ +		xxd -i < build/music.pcm && \ +		echo '};' \ +	) > build/music.c +  build/images.c: build/continue.qoi build/exit.qoi build/pause.qoi build/play.qoi build/restart.qoi build/img  	mkdir -p build  	(\ | 
