--- a/ccdemos/Makefile Fri Nov 30 00:44:51 2007 +0100
+++ b/ccdemos/Makefile Mon Dec 03 01:49:23 2007 +0100
@@ -1,28 +1,33 @@
-CCFLAGS=-g -O3 -I../src
-LDFLAGS=-L.. -pthread
-RGBLIB_LDFLAGS=$(LDFLAGS) -lpng
-SDL_CCFLAGS=$(CCFLAGS) $(shell sdl-config --cflags)
-SDL_LDFLAGS=$(LDFLAGS) $(shell sdl-config --libs)
-PYRIT_OBJS=$(shell ls ../*.o | grep -v raytracermodule)
+ifndef $(ROOT)
+ ROOT=$(shell pwd)/..
+endif
+
+include $(ROOT)/config.mk
+
+
+### Targets ###
+all: realtime spheres_shadow
+
+realtime: realtime.o libs-double
+ $(CXX) -o $@ $(ROOT)/bin/libs-double/*.o $< $(LDFLAGS) $(SDL_LDFLAGS)
-all: spheres_shadow realtime
+spheres_shadow: spheres_shadow.o image.o libs-float
+ $(CXX) -o $@ $(ROOT)/bin/libs-float/*.o $< image.o $(LDFLAGS) -lpng
+
+libs-float:
+ $(MAKE) -C ../src libs-float
-%.o: %.c
+libs-double:
+ $(MAKE) -C ../src libs-double
+
+realtime.o: realtime.cc
+ $(CXX) -c -o $@ $(CCFLAGS) $(SDL_CCFLAGS) $< $(DEFS) -DPYRIT_DOUBLE
+
+image.o: image.c
$(CXX) -c -o $@ $*.c
-%.o: %.cc
- $(CXX) -c -o $@ $*.cc $(CCFLAGS)
-
-%: %.o
- (cd .. && make)
- $(CXX) -o $@ $(PYRIT_OBJS) $^ $(RGBLIB_LDFLAGS)
-
-image.o: image.c
spheres_shadow.o: spheres_shadow.cc
-spheres_shadow: spheres_shadow.o image.o
-
-realtime: realtime.cc
- $(CXX) -o $@ $@.cc $(SDL_CCFLAGS) -L.. $(PYRIT_OBJS) $(SDL_LDFLAGS)
+ $(CXX) -c -o $@ $*.cc $(CCFLAGS) $(DEFS)
clean:
rm -f spheres_shadow realtime *.o