-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
168 lines (143 loc) · 2.76 KB
/
Makefile
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#
# TEH_ENGINE MAKEFIEL!!1!11ONE!
#
#
# configs
#
# compiler
CC := gcc
CFLAGS := \
-Isauce \
`pkg-config sdl2 --cflags` \
`pkg-config SDL2_image --cflags` \
`pkg-config SDL2_mixer --cflags` \
`pkg-config check --cflags` \
`pkg-config libgvc --cflags` \
`pkg-config glesv2 --cflags` \
-std=c99 \
-Wall \
-pipe \
-ggdb \
-DOPENGL_ES \
$(CFLAGS)
# linker
LD := gcc
LDFLAGS := \
-lm \
`pkg-config sdl2 --libs` \
`pkg-config SDL2_image --libs` \
`pkg-config SDL2_mixer --libs` \
`pkg-config check --libs` \
`pkg-config libgvc --libs` \
`pkg-config glesv2 --libs` \
$(LDFLAGS)
#
# target lists
#
SHADERS := \
build/r_fragment_shader.glsl.c \
build/r_vertex_shader.glsl.c
LIB_OBJS := \
build/teh.o \
build/vec.o \
build/assets.o \
build/beh.o \
build/poly.o \
build/pool.o \
build/box.o \
build/trace.o \
GUI_OBJS := \
build/window.o \
build/r_fragment_shader.glsl.o \
build/r_vertex_shader.glsl.o \
build/renderer.o \
build/controller.o \
build/r_teh.o \
build/r_beh.o \
BSPC_OBJS := \
build/tri.o \
build/bspc.o \
CHECK_OBJS := \
build/check/check.o \
build/check/check_poly.o \
build/check/check_tri_split.o \
build/check/check_bspc.o \
build/check/check_pool.o \
build/check/check_box.o \
OBJS := \
$(LIB_OBJS) \
$(GUI_OBJS) \
$(BSPC_OBJS) \
$(CHECK_OBJS) \
build/check/check.o \
build/behc.o \
build/engine.o \
PRGS := \
build/check/check \
build/behc \
build/engine
TEHS := \
tehs/blorl.teh \
tehs/crossing_quads.teh \
tehs/igualomagic.teh \
tehs/igualomapa.teh \
tehs/igualopeople.teh \
tehs/parallel_quads.teh \
tehs/zoing.teh \
tehs/boxxy.teh \
BEHS := \
behs/blorl.beh \
behs/crossing_quads.beh \
behs/igualomagic.beh \
behs/igualomapa.beh \
behs/parallel_quads.beh \
behs/zoing.beh \
#behs/igualopeople.beh
ALL_FILES := \
$(SHADERS) \
$(OBJS) \
$(PRGS) \
$(TEHS) \
$(BEHS) \
#
# recipes
#
# all and clean
.PHONY: all clean check
all: $(PRGS)
clean:
rm -f $(SHADERS) $(OBJS) $(PRGS)
clean_all:
rm -f $(ALL_FILES)
check: build/check/check
$^
tehs: $(TEHS)
behs: $(BEHS)
# exporta modelos
tehs/%.teh: blends/%.blend
mkdir -p `dirname $@`
blender $< -b -P sauce/teh_export_cli.py -- $@
# compila mapas
behs/%.beh: tehs/%.teh build/behc
mkdir -p `dirname $@`
build/behc $< $@
# shaders
build/%.glsl.c: sauce/%.glsl
mkdir -p `dirname $@`
cp $< .
xxd -i `basename $<` $@
rm `basename $<`
# state machines
build/%.rl.c: sauce/%.rl
mkdir -p `dirname $@`
$(RAGEL) $(RLFLAGS) -o $@ $<
# objs
build/%.o: sauce/%.c
mkdir -p `dirname $@`
$(CC) $(CFLAGS) -o $@ -c $<
# prgs
build/behc: build/behc.o $(BSPC_OBJS) $(LIB_OBJS)
build/engine: build/engine.o $(LIB_OBJS) $(GUI_OBJS)
build/check/check: build/check/check.o $(CHECK_OBJS) $(BSPC_OBJS) $(LIB_OBJS) $(GUI_OBJS)
mkdir -p `dirname $@`
$(LD) $(LDFLAGS) -o $@ $^