blob: 358443e88f9aabc26f4613ac0568433a725d3a5f (
plain) (
blame)
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
|
.POSIX:
target = c2
data_dir = data
shaders = \
$(data_dir)/triangle.csh \
$(data_dir)/ui.csh \
$(data_dir)/surface.csh \
$(data_dir)/surface_depthonly.csh \
$(data_dir)/sky.csh \
$(data_dir)/mip_spec.csh
textures = \
$(data_dir)/22.tex \
$(data_dir)/kita.tex \
$(data_dir)/brick_albedo.tex \
$(data_dir)/brick_ao.tex \
$(data_dir)/brick_normal.tex \
$(data_dir)/sky.tex
models = $(data_dir)/monkey.mdl
materials = $(data_dir)/bricks.mat $(data_dir)/plastic.mat
packed_files = $(shaders) $(textures) $(models) $(materials)
tools = qstd cfg sc
objects = app.o c2.o video.o pipeline.o asset.o ui.o maths.o model.o
includes = -Iqstd
defines = -Dplat_x86 -Dplat_posix -Dplat_x11 -Dallocation_default_alignment=8
cflags = -MMD -MF $(basename $@).d $(includes) $(defines) $(DEBUG_COMPILE_FLAG)
libs = -lX11 -lm
lflags = $(libs) $(DEBUG_LINK_FLAG)
.PHONY: all clean $(tools)
all: $(target) $(shaders) $(tools) $(objects) pack
qstd:
$(MAKE) -C qstd
cfg: qstd
$(MAKE) -C cfg
sc: qstd cfg
$(MAKE) -C sc
packer: packer.c | qstd
$(CC) $(cflags) packer.c $(lflags) -Lqstd -lqstd -o packer
convtexture: convtexture.c | qstd
$(CC) $(cflags) convtexture.c $(lflags) -Lqstd -lqstd -o convtexture
convmodel: convmodel.c | qstd
$(CC) $(cflags) convmodel.c $(lflags) -Lqstd -lqstd -o convmodel
convmaterial: convmaterial.c | qstd cfg
$(CC) $(cflags) convmaterial.c $(lflags) -Lqstd -lqstd -Lcfg -lcfg -o convmaterial
pack: $(packed_files) packer
./packer pack $(data_dir) $(notdir $(packed_files))
data/triangle.csh: intermediate/triangle.glsl | $(data_dir) sc
./sc/sc intermediate/triangle.glsl $(data_dir)/triangle.csh
data/ui.csh: intermediate/ui.glsl | $(data_dir) sc
./sc/sc intermediate/ui.glsl $(data_dir)/ui.csh
data/surface.csh: intermediate/surface.glsl | $(data_dir) sc
./sc/sc intermediate/surface.glsl $(data_dir)/surface.csh
data/surface_depthonly.csh: intermediate/surface_depthonly.glsl | $(data_dir) sc
./sc/sc intermediate/surface_depthonly.glsl $(data_dir)/surface_depthonly.csh
data/sky.csh: intermediate/sky.glsl | $(data_dir) sc
./sc/sc intermediate/sky.glsl $(data_dir)/sky.csh
data/mip_spec.csh: intermediate/mip_spec.glsl | $(data_dir) sc
./sc/sc intermediate/mip_spec.glsl $(data_dir)/mip_spec.csh
data/22.tex: intermediate/22.bmp | $(data_dir) convtexture
./convtexture intermediate/22.bmp $(data_dir)/22.tex bc1
data/kita.tex: intermediate/kita.bmp | $(data_dir) convtexture
./convtexture intermediate/kita.bmp $(data_dir)/kita.tex bc1
data/brick_albedo.tex: intermediate/brick_albedo.bmp | $(data_dir) convtexture
./convtexture intermediate/brick_albedo.bmp $(data_dir)/brick_albedo.tex bc1
data/brick_ao.tex: intermediate/brick_ao.bmp | $(data_dir) convtexture
./convtexture intermediate/brick_ao.bmp $(data_dir)/brick_ao.tex bc4
data/brick_normal.tex: intermediate/brick_normal.bmp | $(data_dir) convtexture
./convtexture intermediate/brick_normal.bmp $(data_dir)/brick_normal.tex bc5
data/sky.tex: intermediate/sky.hdr | $(data_dir) convtexture
./convtexture intermediate/sky.hdr $(data_dir)/sky.tex rgba16f
data/monkey.mdl: intermediate/monkey.glb $(shaders) | $(data_dir) convmodel
./convmodel $(data_dir) intermediate/monkey.glb $(data_dir)/monkey.mdl
data/bricks.mat: intermediate/bricks.mat | $(data_dir) convmaterial
./convmaterial intermediate/bricks.mat $(data_dir)/bricks.mat
data/plastic.mat: intermediate/plastic.mat | $(data_dir) convmaterial
./convmaterial intermediate/plastic.mat $(data_dir)/plastic.mat
app.o:
$(CXX) -c $(cflags) app.cpp -o app.o
video.o:
$(CXX) -c $(cflags) video.cpp -o video.o
pipeline.o:
$(CXX) -c $(cflags) pipeline.cpp -o pipeline.o
asset.o:
$(CXX) -c $(cflags) asset.cpp -o asset.o
ui.o:
$(CXX) -c $(cflags) ui.cpp -o ui.o
maths.o:
$(CXX) -c $(cflags) maths.cpp -o maths.o
model.o:
$(CXX) -c $(cflags) model.cpp -o model.o
c2.o:
$(CXX) -c $(cflags) c2.cpp -o c2.o
$(target): $(objects) qstd/libqstd.a
$(CXX) $(objects) $(lflags) -o $(target) -Lqstd -lqstd
qstd/libqstd.a:
$(MAKE) -C qstd
$(data_dir):
mkdir -p $(data_dir)
clean:
rm -rf $(data_dir)
rm -f $(objects)
rm -f $(objects:%.o=%.d)
rm packer.d
rm -f $(targets)
rm -f convtexture
rm -f convmodel
rm -f packer
make -C qstd clean
make -C cfg clean
make -C sc clean
-include $(objects:%.o=%.d)
-include packer.d
|