--- a/Makefile Fri Nov 30 00:44:51 2007 +0100
+++ b/Makefile Mon Dec 03 01:49:23 2007 +0100
@@ -1,39 +1,38 @@
-CCFLAGS=-I./src -Wall -Wno-write-strings -fno-strict-aliasing -DPTHREADS
-LDFLAGS=
+ROOT=$(shell pwd)
+include config.mk
+
+all: python-module demos ccdemos
+
+python-module: libs-float
+ $(MAKE) -C src python-module
+
+demos: python-module
+ $(MAKE) -C demos
-ifeq ($(OS), Windows_NT)
- CCFLAGS+=-I"C:/Program Files/Python25/include"
- LDFLAGS+=-L"C:\Program Files\Python25\libs" -lpython25 -lpthreadGC2
- MODULENAME=raytracer.pyd
-else
- CCFLAGS+=-pthread -fPIC `python-config --includes`
- MODULENAME=raytracermodule.so
-endif
+ccdemos: libs-float libs-double
+ $(MAKE) -C ccdemos
+
+libs-float:
+ $(MAKE) -C src libs-float
-# optimizations
-#CCFLAGS+=-g -O0
-CCFLAGS+=-O3 -pipe -fomit-frame-pointer -ffast-math -msse3
+libs-double:
+ $(MAKE) -C src libs-double
+
+clean:
+ $(MAKE) -C src clean
+ $(MAKE) -C demos clean
+ $(MAKE) -C ccdemos clean
# TARGETS
#########
-all: python-module
-
-python-module: $(MODULENAME)
-
tests: testvector testmatrix
-clean:
- rm -f *.o $(MODULENAME)
-
# RULES
#######
-%.o: src/%.cc
- $(CXX) -c -o $@ src/$*.cc $(CCFLAGS)
-
test%: tests/%.cc
$(CXX) -o $@ tests/$*.cc $(CCFLAGS)
./$@
@@ -42,18 +41,6 @@
# DEPENDENCIES
##############
-# C++ raytracer
-vector.o: src/vector.cc src/vector.h
-matrix.o: src/matrix.cc src/matrix.h src/vector.h
-noise.o: src/noise.cc src/noise.h
-scene.o: src/scene.cc src/scene.h src/vector.h src/noise.h src/common.h
-kdtree.o: src/kdtree.cc src/kdtree.h src/scene.h
-raytracer.o: src/raytracer.cc src/raytracer.h src/scene.h src/vector.h src/noise.h
-
-# python module
-raytracermodule.o: src/raytracermodule.cc src/raytracer.h src/scene.h src/vector.h
-$(MODULENAME): raytracermodule.o raytracer.o scene.o noise.o kdtree.o
- $(CXX) $^ -shared -o $@ $(LDFLAGS)
# library tests
testvector: tests/vector.cc src/vector.h