summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile31
1 files changed, 22 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 9508cd4..1d01b16 100644
--- a/Makefile
+++ b/Makefile
@@ -2,12 +2,13 @@
target = c2
data_dir = data
-shaders = data/triangle.csh
-tools = qstd cfg sc
-objects = app.o c2.o video.o pipeline.o
+shaders = $(data_dir)/triangle.csh
+packed_files = $(shaders)
+tools = qstd cfg sc packer
+objects = app.o c2.o video.o pipeline.o asset.o
includes = -Iqstd
defines = -Dplat_x86 -Dplat_posix -Dplat_x11 -Dallocation_default_alignment=8
-cflags = $(includes) $(defines) $(DEBUG_COMPILE_FLAG)
+cflags = -MMD -MF $(basename $@).d $(includes) $(defines) $(DEBUG_COMPILE_FLAG)
libs = -lX11 -lm
lflags = $(libs) $(DEBUG_LINK_FLAG)
@@ -23,19 +24,28 @@ cfg: qstd
sc: qstd cfg
$(MAKE) -C sc
+packer: packer.c | qstd
+ $(CC) $(cflags) packer.c $(lflags) -Lqstd -lqstd -o packer
+
+pack: $(packed_files) packer
+ ./packer pack $(data_dir) $(packed_files)
+
data/triangle.csh: intermediate/triangle.glsl | $(data_dir) sc
- ./sc/sc intermediate/triangle.glsl data/triangle.csh
+ ./sc/sc intermediate/triangle.glsl $(data_dir)/triangle.csh
-app.o: app.cpp app.hpp qstd/memory.h qstd/plat.h
+app.o:
$(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
+video.o:
$(CXX) -c $(cflags) video.cpp -o video.o
-pipeline.o: pipeline.cpp video.hpp qstd/memory.h qstd/plat.h
+pipeline.o:
$(CXX) -c $(cflags) pipeline.cpp -o pipeline.o
-c2.o: c2.cpp app.hpp video.hpp qstd/memory.h qstd/plat.h
+asset.o:
+ $(CXX) -c $(cflags) asset.cpp -o asset.o
+
+c2.o:
$(CXX) -c $(cflags) c2.cpp -o c2.o
$(target): $(objects) qstd/libqstd.a
@@ -54,3 +64,6 @@ clean:
make -C qstd clean
make -C cfg clean
make -C sc clean
+
+-include $(objects:%.o=%.d)
+-include packer.d