Makefile
author Radek Brich <radek.brich@devl.cz>
Sat, 17 Nov 2007 17:47:06 +0100
branchpyrit
changeset 5 2d97ea5e711a
parent 4 c73bc405ee7a
child 6 d8d596d26f25
permissions -rw-r--r--
resolve warnings from current g++

CCFLAGS=-Wall -Wno-write-strings -O3 -I./src -DPTHREADS -pthread -fno-strict-aliasing
LDFLAGS=

ifeq ($(OS), Windows_NT)
  CCFLAGS+=-I"C:/Program Files/Python25/include"
  LDFLAGS+=-L"C:\Program Files\Python25\libs" -lpython25
  MODULENAME=raytracer.pyd
else
  CCFLAGS+=-fPIC `python-config --includes`
  MODULENAME=raytracermodule.so
endif

# optimizations
#CCFLAGS+=-pipe -fomit-frame-pointer -ffast-math -msse3


# TARGETS
#########

all: python-module

python-module: $(MODULENAME)

tests: testvector testmatrix

clean:
	rm -f *.o $(MODULENAME) testvector testmatrix


# RULES
#######

%.o: src/%.cc
	$(CXX) -c -o $@ src/$*.cc $(CCFLAGS)

test%: tests/%.cc 
	$(CXX) -o $@ tests/$*.cc $(CCFLAGS) 
	./$@


# 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
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
	$(CXX) $^ -shared -o $@ $(LDFLAGS)

# library tests
testvector: tests/vector.cc src/vector.h