summaryrefslogtreecommitdiff
path: root/Makefile
blob: 9508cd4618d017e4320653a718de8f87c38ffb47 (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
.POSIX:

target = c2
data_dir = data
shaders = data/triangle.csh
tools = qstd cfg sc
objects = app.o c2.o video.o pipeline.o
includes = -Iqstd
defines = -Dplat_x86 -Dplat_posix -Dplat_x11 -Dallocation_default_alignment=8
cflags = $(includes) $(defines) $(DEBUG_COMPILE_FLAG)
libs = -lX11 -lm
lflags = $(libs) $(DEBUG_LINK_FLAG)

.PHONY: all clean $(tools)
all: $(target) $(shaders) $(tools) $(objects)

qstd:
	$(MAKE) -C qstd

cfg: qstd
	$(MAKE) -C cfg

sc: qstd cfg
	$(MAKE) -C sc

data/triangle.csh: intermediate/triangle.glsl | $(data_dir) sc
	./sc/sc intermediate/triangle.glsl data/triangle.csh

app.o: app.cpp app.hpp qstd/memory.h qstd/plat.h
	$(CXX) -c $(cflags) app.cpp -o app.o

video.o: video.cpp video.hpp app.hpp qstd/memory.h qstd/plat.h qstd/str.h sc/sh_enums.h
	$(CXX) -c $(cflags) video.cpp -o video.o

pipeline.o: pipeline.cpp video.hpp qstd/memory.h qstd/plat.h
	$(CXX) -c $(cflags) pipeline.cpp -o pipeline.o

c2.o: c2.cpp app.hpp video.hpp qstd/memory.h qstd/plat.h
	$(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 $(targets)
	make -C qstd clean
	make -C cfg clean
	make -C sc clean