demotool/Makefile

78 lines
1.5 KiB
Makefile

OUTDIR = output
CXXFLAGS += $(shell sdl2-config --cflags) -std=c++14 -Wall -g
CFLAGS += $(shell sdl2-config --cflags)
CPPFLAGS += -I. -I$(OUTDIR) -Iimgui -Iglm \
-DREAL_BUILD -DGLM_ENABLE_EXPERIMENTAL
LIBS += $(shell sdl2-config --libs) -lGL -lGLEW -ldl
FILEDUMPS =
IMGUI = imgui.cpp imgui_draw.cpp
DEMO = \
main.cc \
imgui_impl_sdl.cc \
\
utilities.cc \
texture.cc \
rendertarget.cc \
uniforms.cc \
camera.cc \
\
filewatcher.cc \
window.cc \
globals.cc \
profiling.cc \
shaders.cc \
odbg.cc \
sync.cc \
control.cc \
\
demo.cc \
\
raymarcher.cc \
bloom.cc \
dof.cc \
combine.cc \
fxaa.cc
IMGUI_OBJS = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(basename $(IMGUI))))
DEMO_OBJS = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(basename $(DEMO))))
OBJS = $(IMGUI_OBJS) $(DEMO_OBJS)
PCH=externals.hh.gch
DEMO_DEPS = $(DEMO_OBJS:$(OUTDIR)/%.o=$(OUTDIR)/%.d)
demo: $(OBJS)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o demo \
$(OBJS) $(LIBS)
clean:
rm -f $(OBJS) $(FILEDUMPS) demo $(PCH)
fullclean: clean
rm -f $(DEMO_DEPS)
.PHONY: clean fullclean
$(FILEDUMPS): fd-%.h: %
xxd -i $< $@
outdir:
@if ! [ -d "$(OUTDIR)" ]; then mkdir "$(OUTDIR)"; fi
.PHONY: outdir
$(IMGUI_OBJS): $(OUTDIR)/%.o: imgui/%.cpp | outdir
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
-include $(DEMO_DEPS)
$(DEMO_OBJS): $(OUTDIR)/%.o: %.cc $(PCH) | outdir $(FILEDUMPS)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -M -MF $(@:%.o=%.d) -MT $@ $<
$(PCH): externals.hh
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<