]> git.tdb.fi Git - gldbg.git/blobdiff - Makefile
Move the profiler and inspector tools to the gl flavor
[gldbg.git] / Makefile
index 3fda9ec6de5eb184074a39335531eb74b3993665..af82389b32fc8ea45d37f7439743be8d0108f95d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,18 @@
 # $Id$
 
-CPPFLAGS := -I.
+ifeq ($(FLAVOR),)
+FLAVOR := gl
+endif
+
+CPPFLAGS := -I. -Isource -Iflavors/$(FLAVOR)/source
 CFLAGS := -ggdb -Wall -Wextra
 CXXFLAGS := $(CFLAGS)
 
 PACKAGES_gldbg := mspcore mspstrings mspio mspfs
 
+FLAVOR_ROOT := flavors/$(FLAVOR)
+VPATH := $(FLAVOR_ROOT)
+
 SOURCES_libgldbg := source/gldecoder.c \
        source/glprint.c \
        source/enums.c \
@@ -17,13 +24,15 @@ SOURCES_glwrap := source/glwrap.c \
 SOURCES_gldump := source/gldump.c
 SOURCES_gldbg := source/gldbg.cpp \
        source/commandinterpreter.cpp \
-       source/tracer.cpp \
        source/process.cpp \
+       source/tool.cpp
+SOURCES_tracer := source/tracer.cpp
+SOURCES_profiler := source/profiler.cpp
+SOURCES_inspector := source/inspector.cpp \
        source/glstate.cpp \
+       source/arraystate.cpp \
        source/texturestate.cpp \
-       source/bufferstate.cpp \
-       source/profiler.cpp \
-       source/arraystate.cpp
+       source/bufferstate.cpp
 TEMPLATES := source/functions.enum.t \
        source/gldecoder.funcs.t \
        source/gldecoder.struct.t \
@@ -36,6 +45,12 @@ objs = $(call rename,temp,.o,$(1))
 deps = $(call rename,temp,.d,$(1))
 gen = $(call rename,gensrc,,$(1))
 
+.PHONY: all
+all: glwrap.so gldump gldbg
+
+include flavors/$(FLAVOR)/flavor.mk
+
+SOURCES_gldbg += $(foreach tool,$(TOOLS),$(SOURCES_$(tool)))
 GENSOURCES := $(call gen,$(TEMPLATES))
 SOURCES_all := $(sort $(SOURCES_libgldbg) $(SOURCES_glwrap) $(SOURCES_gldump) $(SOURCES_gldbg))
 
@@ -47,9 +62,6 @@ OBJECTS_gldbg := $(call objs,$(SOURCES_gldbg))
 OBJECTS_all := $(call objs,$(SOURCES_all))
 DEPS_all := $(call deps,$(SOURCES_all) $(TEMPLATES))
 
-.PHONY: all
-all: glwrap.so gldump gldbg
-
 $(OBJECTS_gldbg): CXXFLAGS += $(shell pkg-config --cflags $(PACKAGES_gldbg))
 gldbg: LIBS += $(shell pkg-config --libs $(PACKAGES_gldbg)) -lreadline
 gldump gldbg: LIBS += ./libgldbg.a
@@ -77,7 +89,7 @@ temp/.created:
        touch $@
 
 gensrc/%: source/%.t gensrc/.created generate.py
-       python ./generate.py $< gl.api glx.api >$@
+       python ./generate.py $< $(APIS) >$@
 
 gensrc/.created:
        mkdir -p gensrc
@@ -92,7 +104,7 @@ temp/%.d: source/%.cpp temp/.created
        $(CXX) $(CPPFLAGS) -MM -MF $@ -MT $(call rename,temp,.o,$<) -MG $<
 
 temp/%.d: source/%.t temp/.created
-       python ./generate.py --depends=$(call rename,gensrc,,$<) $< gl.api glx.api >$@
+       python ./generate.py --depends=$(call rename,gensrc,,$<) $< $(APIS) >$@
 
 .PHONY: clean
 clean: