Back to shtanton's homepage
summaryrefslogtreecommitdiff
path: root/Makefile
blob: d48073d1b175e800736ef2fc24ca4e5b8ae171e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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

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/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/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/exit.qoi build/pause.qoi build/play.qoi build/restart.qoi build/img
	mkdir -p build
	(\
		build/img pixels build/continue.qoi 1 && \
		build/img pixels build/exit.qoi 2 && \
		build/img pixels build/pause.qoi 3 && \
		build/img pixels build/play.qoi 4 && \
		build/img pixels build/restart.qoi 5 && \
		echo 'Image images[] = {{0},' && \
		build/img image build/continue.qoi 1 && \
		build/img image build/exit.qoi 2 && \
		build/img image build/pause.qoi 3 && \
		build/img image build/play.qoi 4 && \
		build/img image build/restart.qoi 5 && \
		echo '};' \
	) > build/images.c

clean:
	rm -r build