-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (41 loc) · 1.36 KB
/
Makefile
File metadata and controls
54 lines (41 loc) · 1.36 KB
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
49
50
51
52
53
54
TARGET=demo
# Config for debug builds, for release build flags edit launcher scripts
CC=gcc
PKGS=sdl2 glesv2
CFLAGS=$(shell pkg-config --cflags $(PKGS)) -O2 -DDEBUG -g
LDLIBS=$(shell pkg-config --libs $(PKGS)) -lm
# shaders.h.out has to be excluded because trim can't deal with it
# music.xm.c has to be excluded because minify can't deal with it
SOURCES=includes.c xmplayer.c gl.c demo.c main.c
CAT_SRC=$(TARGET).out
LAUNCHER=launcher.sh
SHADERS_TO_C=sh shaders_to_c.sh
debug:SHADERS_TO_C=sh shaders_to_c.sh debug
.PHONY: debug clean brcm
# Concatenate and compress demo sources into executable
$(TARGET): shaders.h.out $(CAT_SRC) $(LAUNCHER)
cp shaders.h.out $(CAT_SRC).c
./trim.sh $(CAT_SRC) >> $(CAT_SRC).c
./trim.sh $(LAUNCHER) > $(TARGET)
echo >> $(TARGET)
unifdef -x 2 -UDEBUG $(CAT_SRC).c | lzma -9e -T0 - >> $(TARGET)
chmod +x $(TARGET)
brcm:
+make LAUNCHER=brcm_launcher.sh
debug: shaders.h.out main.c
$(CC) main.c -o $(TARGET) $(CFLAGS) $(LDLIBS)
clean:
rm -f $(TARGET)
find . -name "*.min" -delete
find . -name "*.out" -delete
find . -name "*.out.c" -delete
$(CAT_SRC): $(HEADERS) music.xm.c $(SOURCES)
cp music.xm.c $(CAT_SRC)
echo > out.min
for f in $(SOURCES); do cat $$f >> out.min; done
minify -h api.h -h shaders.h.out out.min >> $(CAT_SRC)
shaders.h.out:
cd shaders; $(SHADERS_TO_C)
.SUFFIXES:
music.xm.c: music.xm
bin2cstr music.xm > music.xm.c