Makefile
branchpyrit
changeset 22 76b7bd51d64a
parent 17 5176ba000a67
child 24 d0d76e8a5203
equal deleted inserted replaced
21:79b516a3803d 22:76b7bd51d64a
     1 CCFLAGS=-I./src -Wall -Wno-write-strings -fno-strict-aliasing -DPTHREADS
     1 ROOT=$(shell pwd)
     2 LDFLAGS=
     2 include config.mk
     3 
     3 
     4 ifeq ($(OS), Windows_NT)
     4 all: python-module demos ccdemos
     5   CCFLAGS+=-I"C:/Program Files/Python25/include"
       
     6   LDFLAGS+=-L"C:\Program Files\Python25\libs" -lpython25 -lpthreadGC2
       
     7   MODULENAME=raytracer.pyd
       
     8 else
       
     9   CCFLAGS+=-pthread -fPIC `python-config --includes`
       
    10   MODULENAME=raytracermodule.so
       
    11 endif
       
    12 
     5 
    13 # optimizations
     6 python-module: libs-float
    14 #CCFLAGS+=-g -O0
     7 	$(MAKE) -C src python-module
    15 CCFLAGS+=-O3 -pipe -fomit-frame-pointer -ffast-math -msse3
     8 
       
     9 demos: python-module
       
    10 	$(MAKE) -C demos
       
    11 
       
    12 ccdemos: libs-float libs-double
       
    13 	$(MAKE) -C ccdemos
       
    14 
       
    15 libs-float:
       
    16 	$(MAKE) -C src libs-float
       
    17 
       
    18 libs-double:
       
    19 	$(MAKE) -C src libs-double
       
    20 
       
    21 clean:
       
    22 	$(MAKE) -C src clean
       
    23 	$(MAKE) -C demos clean
       
    24 	$(MAKE) -C ccdemos clean
    16 
    25 
    17 
    26 
    18 # TARGETS
    27 # TARGETS
    19 #########
    28 #########
    20 
    29 
    21 all: python-module
       
    22 
       
    23 python-module: $(MODULENAME)
       
    24 
       
    25 tests: testvector testmatrix
    30 tests: testvector testmatrix
    26 
       
    27 clean:
       
    28 	rm -f *.o $(MODULENAME)
       
    29 
    31 
    30 
    32 
    31 # RULES
    33 # RULES
    32 #######
    34 #######
    33 
       
    34 %.o: src/%.cc
       
    35 	$(CXX) -c -o $@ src/$*.cc $(CCFLAGS)
       
    36 
    35 
    37 test%: tests/%.cc
    36 test%: tests/%.cc
    38 	$(CXX) -o $@ tests/$*.cc $(CCFLAGS)
    37 	$(CXX) -o $@ tests/$*.cc $(CCFLAGS)
    39 	./$@
    38 	./$@
    40 
    39 
    41 
    40 
    42 # DEPENDENCIES
    41 # DEPENDENCIES
    43 ##############
    42 ##############
    44 
    43 
    45 # C++ raytracer
       
    46 vector.o: src/vector.cc src/vector.h
       
    47 matrix.o: src/matrix.cc src/matrix.h src/vector.h
       
    48 noise.o: src/noise.cc src/noise.h
       
    49 scene.o: src/scene.cc src/scene.h src/vector.h src/noise.h src/common.h
       
    50 kdtree.o: src/kdtree.cc src/kdtree.h src/scene.h
       
    51 raytracer.o: src/raytracer.cc src/raytracer.h src/scene.h src/vector.h src/noise.h
       
    52 
       
    53 # python module
       
    54 raytracermodule.o: src/raytracermodule.cc src/raytracer.h src/scene.h src/vector.h
       
    55 $(MODULENAME): raytracermodule.o raytracer.o scene.o noise.o kdtree.o
       
    56 	$(CXX) $^ -shared -o $@ $(LDFLAGS)
       
    57 
    44 
    58 # library tests
    45 # library tests
    59 testvector: tests/vector.cc src/vector.h
    46 testvector: tests/vector.cc src/vector.h