BASEDIR := ./ CURDIR := $(shell pwd) BINEXT := OBJEXT := .o LIBEXT := .a CXX := g++ CXXFLAGS := -g -fPIC -I/usr/include/python2.3 -I$(CURDIR) # needed for linux (as darwin doesn't put gl.h in a directory starting with # GL CXXFLAGS += -I/usr/include/GL # needed for darwin CXXFLAGS += -I/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/usr/local/include LDFLAGS := -L/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/ -L/usr/local/lib # each module will add to this, .os are derived from it TARGETLIBS := TARGETBINS := LIBS := LIBSRC := SRC := all: targets include alg/module.mk include alg/test/module.mk include py/module.mk include gui/module.mk # process what the module.mks defined OBJ := $(patsubst %.cpp,%.o, $(filter %.cpp,$(SRC))) DEPS := $(OBJ:.o=.d) targets: $(TARGETLIBS) $(TARGETBINS) # this make function came from # http://www.oreilly.com/catalog/make3/book/ch08.pdf # $(call make-depend,source-file,object-file,depend-file) define make-depend $(CXX) -MM -MF $3 -MP -MT $2 $(CFLAGS) $(CXXFLAGS) $1 endef %.d: %.cpp $(call make-depend,$<,$@,$(subst .o,.d,$@)) # makedepend -o.d $(dirname $^) $(CFLAGS) $(CXXFILAGS) $^ -f- > $@ %.o: %.cpp $(CXX) -c -o $@ $(CXXFLAGS) $^ include $(DEPS) clean: -rm $(OBJ) $(DEPS) $(TARGETLIBS) $(TARGETBINS)