]> git.tdb.fi Git - gldbg.git/blobdiff - Makefile
Add framework necessary to support more modular tools
[gldbg.git] / Makefile
index 3fda9ec6de5eb184074a39335531eb74b3993665..1adeb6440c91f6bf718b545dd8d3025d0d3893ee 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 \
@@ -23,7 +30,8 @@ SOURCES_gldbg := source/gldbg.cpp \
        source/texturestate.cpp \
        source/bufferstate.cpp \
        source/profiler.cpp \
-       source/arraystate.cpp
+       source/arraystate.cpp \
+       source/tool.cpp
 TEMPLATES := source/functions.enum.t \
        source/gldecoder.funcs.t \
        source/gldecoder.struct.t \
@@ -50,6 +58,8 @@ DEPS_all := $(call deps,$(SOURCES_all) $(TEMPLATES))
 .PHONY: all
 all: glwrap.so gldump gldbg
 
+include flavors/$(FLAVOR)/flavor.mk
+
 $(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 +87,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 +102,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: