.POSIX: target = c2 data_dir = data shaders = $(data_dir)/triangle.csh textures = $(data_dir)/22.tex packed_files = $(shaders) $(textures) tools = qstd cfg sc 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 = -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 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_dir)/triangle.csh data/22.tex: intermediate/22.bmp | $(data_dir) convtexture ./convtexture intermediate/22.bmp $(data_dir)/22.tex bc1 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 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 $(targets) rm -f convtexture make -C qstd clean make -C cfg clean make -C sc clean -include $(objects:%.o=%.d) -include packer.d