Makefile
branchpyrit
changeset 0 3547b885df7e
child 1 e74bf781067e
equal deleted inserted replaced
-1:000000000000 0:3547b885df7e
       
     1 CCFLAGS=-Wall -O3 -I./src
       
     2 LDFLAGS=
       
     3 
       
     4 ifeq ($(OS), Windows_NT)
       
     5   CCFLAGS+=-I"C:/Program Files/Python25/include"
       
     6   LDFLAGS+=-L"C:\Program Files\Python25\libs" -lpython25
       
     7   MODULENAME=raytracer.pyd
       
     8 else
       
     9   CCFLAGS+=-fPIC -I/usr/include/python2.4
       
    10   MODULENAME=raytracermodule.so
       
    11 endif
       
    12 
       
    13 # optimisations
       
    14 #CCFLAGS+=-pipe -fomit-frame-pointer -ffast-math -msse3
       
    15 
       
    16 
       
    17 # TARGETS
       
    18 #########
       
    19 
       
    20 all: python-module
       
    21 
       
    22 python-module: $(MODULENAME)
       
    23 
       
    24 tests: testvector testmatrix
       
    25 
       
    26 clean:
       
    27 	rm -f *.o $(MODULENAME) testvector testmatrix
       
    28 
       
    29 
       
    30 # RULES
       
    31 #######
       
    32 
       
    33 %.o: src/%.cc
       
    34 	$(CXX) -c -o $@ src/$*.cc $(CCFLAGS)
       
    35 
       
    36 test%: tests/%.cc 
       
    37 	$(CXX) -o $@ tests/$*.cc $(CCFLAGS) 
       
    38 	./$@
       
    39 
       
    40 
       
    41 # DEPENDENCIES
       
    42 ##############
       
    43 
       
    44 # C++ raytracer
       
    45 vector.o: src/vector.cc src/vector.h
       
    46 matrix.o: src/matrix.cc src/matrix.h src/vector.h
       
    47 noise.o: src/noise.cc src/noise.h
       
    48 scene.o: src/scene.cc src/scene.h src/vector.h src/noise.h
       
    49 raytracer.o: src/raytracer.cc src/raytracer.h src/scene.h src/vector.h src/noise.h
       
    50 
       
    51 # python module
       
    52 raytracermodule.o: src/raytracermodule.cc src/raytracer.h src/scene.h src/vector.h
       
    53 $(MODULENAME): raytracermodule.o raytracer.o scene.o noise.o
       
    54 	$(CXX) $^ -shared -o $@ $(LDFLAGS)
       
    55 
       
    56 # library tests
       
    57 testvector: tests/vector.cc src/vector.h