improve os x makefiles
[mussa.git] / Makefile.noqt
1 BASEDIR := ./
2 CURDIR := $(shell pwd)
3
4 BINEXT := 
5 OBJEXT := .o
6 LIBEXT := .a
7
8 CXX := g++ 
9 CXXFLAGS := -g -fPIC -I/usr/include/python2.3 -I$(CURDIR)
10 # needed for linux (as darwin doesn't put gl.h in a directory starting with
11 # GL
12 CXXFLAGS += -I/usr/include/GL
13 # needed for darwin
14 CXXFLAGS += -I/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/usr/local/include
15 LDFLAGS := -L/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/ -L/usr/local/lib
16
17 # each module will add to this, .os are derived from it
18 TARGETLIBS := 
19 TARGETBINS :=
20 LIBS := 
21 LIBSRC := 
22 SRC := 
23
24 all: targets
25
26 include alg/module.mk
27 include alg/test/module.mk
28 include py/module.mk
29 include gui/module.mk
30 include module.mk
31
32 # process what the module.mks defined
33 OBJ := $(patsubst %.cpp,%.o, $(filter %.cpp,$(SRC))) 
34 DEPS := $(OBJ:.o=.d)
35
36 targets: $(TARGETLIBS) $(TARGETBINS)
37
38 # this make function came from 
39 # http://www.oreilly.com/catalog/make3/book/ch08.pdf
40 # $(call make-depend,source-file,object-file,depend-file)
41 define make-depend
42   $(CXX) -MM -MF $3 -MP -MT $2 $(CFLAGS) $(CXXFLAGS) $1
43 endef
44         
45 %.d: %.cpp
46         $(call make-depend,$<,$@,$(subst .o,.d,$@))
47 #       makedepend -o.d $(dirname $^) $(CFLAGS) $(CXXFILAGS) $^ -f- > $@
48
49 %.o: %.cpp
50         $(CXX) -c -o $@ $(CXXFLAGS) $^
51
52 include $(DEPS)
53
54 clean:
55         -rm $(OBJ) $(DEPS) $(TARGETLIBS) $(TARGETBINS)
56         
57
58