OUTDIR = output CXXFLAGS += $(shell sdl2-config --cflags) -std=c++14 -Wall -g CFLAGS += $(shell sdl2-config --cflags) CPPFLAGS += -I. -I$(OUTDIR) \ -Iimgui -Iglm -Iebcl/include \ -DREAL_BUILD -DGLM_ENABLE_EXPERIMENTAL LIBS += $(shell sdl2-config --libs) -lGL -lGLEW -ldl \ $(LIBEBCL) -latomic FILEDUMPS = IMGUI = imgui.cpp imgui_draw.cpp COMMON = \ 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 \ ops.cc \ opast.cc \ opparser.cc \ opcomp.cc \ # END COMMON DEMO = \ main.cc \ demo.cc \ # END DEMO PARSERCHECK = \ parsercheck.cc \ # END PARSERCHECK IMGUI_OBJS = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(basename $(IMGUI)))) COMMON_OBJS = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(basename $(COMMON)))) DEMO_OBJS = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(basename $(DEMO)))) PARSERCHECK_OBJS = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(basename $(PARSERCHECK)))) LIBEBCL = $(OUTDIR)/ebcl/libebcorelib.a PCH=externals.hh.gch COMMON_DEPS = $(COMMON_OBJS:$(OUTDIR)/%.o=$(OUTDIR)/%.d) DEMO_DEPS = $(DEMO_OBJS:$(OUTDIR)/%.o=$(OUTDIR)/%.d) PARSERCHECK_DEPS = $(PARSERCHECK_OBJS:$(OUTDIR)/%.o=$(OUTDIR)/%.d) COMMON_REQ = $(COMMON_OBJS) $(IMGUI_OBJS) DEMO_BUILD = $(DEMO_OBJS) $(COMMON_REQ) PARSERCHECK_BUILD = $(PARSERCHECK_OBJS) $(COMMON_REQ) ALL_OBJS = $(DEMO_OBJS) $(PARSERCHECK_OBJS) $(COMMON_REQ) ALL_DEPS = $(COMMON_DEPS) $(DEMO_DEPS) $(PARSERCHECK_DEPS) all: demo parsercheck demo: $(LIBEBCL) $(DEMO_BUILD) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o demo \ $(DEMO_BUILD) $(LIBS) parsercheck: $(LIBEBCL) $(PARSERCHECK_BUILD) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o parsercheck \ $(PARSERCHECK_BUILD) $(LIBS) clean: rm -f $(ALL_OBJS) $(FILEDUMPS) demo parsercheck $(PCH) fullclean: clean @+make -C ebcl fullclean CONFIG=../ebcl-config rm -f $(ALL_DEPS) .PHONY: all 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 $@ $< #------------------------------------------------------------------------------- -include $(COMMON_DEPS) $(COMMON_OBJS): $(OUTDIR)/%.o: %.cc $(PCH) | outdir $(FILEDUMPS) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) $(CPPFLAGS) -M -MF $(@:%.o=%.d) -MT $@ $< #------------------------------------------------------------------------------- -include $(PARSERCHECK_DEPS) $(PARSERCHECK_OBJS): $(OUTDIR)/%.o: %.cc $(PCH) | outdir $(FILEDUMPS) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) $(CPPFLAGS) -M -MF $(@:%.o=%.d) -MT $@ $< #------------------------------------------------------------------------------- $(LIBEBCL): ebcl-config +make -C ebcl CONFIG=../ebcl-config $(PCH): externals.hh $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<