1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
|
#
GSLLIBS= -L/usr/local/lib -L/opt/local/lib -L/usr/lib -L/home/emeric/gsl-1.16 -lgsl -lgslcblas
#
HARDYHERON64=-fPIC
ARCH = $(shell uname)
LEX=flex
YACC=bison -d -v -t
LEXLIB = -lfl
DLLLIB = -ldl
ifeq ($(ARCH),Darwin)
DLLLIB =
endif
ifeq ($(ARCH),OpenBSD)
DLLLIB =
endif
EXRINCLUDE=-I/usr/local/include/OpenEXR -I/usr/include/OpenEXR -I/opt/local/include/OpenEXR
EXRLIBDIR=-L/usr/local/lib -L/usr/lib
EXRLIBS=$(EXRLIBDIR) -Bstatic -lIex -lIlmImf -lImath -lIex -lHalf -Bdynamic -lz
ifeq ($(ARCH),Linux)
EXRLIBS += -lpthread -lIlmThread
endif
CC=mpicc
CXX=mpicxx
LD=$(CXX) $(OPT)
OPT=-O2
INCLUDE=-I. -Icore -Imcm -ImcmCodage $(EXRINCLUDE)
WARN=-Wall
CWD=$(shell pwd)
CXXFLAGS=$(OPT) $(INCLUDE) $(WARN) $(HARDYHERON64)
CCFLAGS=$(CXXFLAGS)
LIBS=$(LEXLIB) $(DLLLIB) $(EXRLIBDIR) $(EXRLIBS) $(GSLLIBS) -lm
SHARED_LDFLAGS = -shared
LRT_LDFLAGS=-rdynamic $(OPT)
ifeq ($(ARCH), Darwin)
OS_VERSION = $(shell uname -r)
SHARED_LDFLAGS = -flat_namespace -undefined suppress -bundle -noprebind
LRT_LDFLAGS=$(OPT) # -L/sw/lib
INCLUDE += -I/sw/include
endif
ACCELERATORS = grid kdtree
CAMERAS = environment orthographic perspective
CORE = api camera color dynload exrio film geometry light material mc \
paramset parser primitive reflection sampling scene shape \
texture timer transform transport util volume pbrtparse pbrtlex
CORE_SCENE = scene
FILM = image
FILTERS = box gaussian mitchell sinc triangle
INTEGRATORS = directlighting emission irradiancecache \
path photonmap single whitted igi debug exphotonmap
LIGHTS = area distant goniometric infinite point projection spot infinitesample
MATERIALS = bluepaint brushedmetal clay felt \
glass matte mirror plastic primer \
shinymetal skin substrate translucent uber mcmMatte
SAMPLERS = bestcandidate lowdiscrepancy random stratified
SHAPES = cone cylinder disk heightfield hyperboloid loopsubdiv nurbs \
paraboloid sphere trianglemesh \
heliostat truncatedcone H1 H1F1
TEXTURES = bilerp checkerboard constant dots fbm imagemap marble mix \
scale uv windy wrinkled
TONEMAPS = contrast highcontrast maxwhite nonlinear
VOLUMES = exponential homogeneous volumegrid
RENDERER = pbrt
MCM = mcm
RENDERER_OBJS := $(addprefix objs/, $(RENDERER:=.o) )
CORE_OBJS := $(addprefix objs/, $(CORE:=.o) )
CORE_LIB := core/libpbrt.a
MCM_OBJS := $(addprefix objs/, $(MCM:=.o) )
SHAPES_DSOS := $(addprefix bin/, $(SHAPES:=.so))
MATERIALS_DSOS := $(addprefix bin/, $(MATERIALS:=.so))
LIGHTS_DSOS := $(addprefix bin/, $(LIGHTS:=.so))
INTEGRATORS_DSOS := $(addprefix bin/, $(INTEGRATORS:=.so))
VOLUMES_DSOS := $(addprefix bin/, $(VOLUMES:=.so))
TEXTURES_DSOS := $(addprefix bin/, $(TEXTURES:=.so))
ACCELERATORS_DSOS := $(addprefix bin/, $(ACCELERATORS:=.so))
CAMERAS_DSOS := $(addprefix bin/, $(CAMERAS:=.so))
FILTERS_DSOS := $(addprefix bin/, $(FILTERS:=.so))
FILM_DSOS := $(addprefix bin/, $(FILM:=.so))
TONEMAPS_DSOS := $(addprefix bin/, $(TONEMAPS:=.so))
SAMPLERS_DSOS := $(addprefix bin/, $(SAMPLERS:=.so))
SHAPES_OBJS := $(addprefix objs/, $(SHAPES:=.o))
MATERIALS_OBJS := $(addprefix objs/, $(MATERIALS:=.o))
LIGHTS_OBJS := $(addprefix objs/, $(LIGHTS:=.o))
INTEGRATORS_OBJS := $(addprefix objs/, $(INTEGRATORS:=.o))
VOLUMES_OBJS := $(addprefix objs/, $(VOLUMES:=.o))
TEXTURES_OBJS := $(addprefix objs/, $(TEXTURES:=.o))
ACCELERATORS_OBJS := $(addprefix objs/, $(ACCELERATORS:=.o))
CAMERAS_OBJS := $(addprefix objs/, $(CAMERAS:=.o))
FILTERS_OBJS := $(addprefix objs/, $(FILTERS:=.o))
FILM_OBJS := $(addprefix objs/, $(FILM:=.o))
TONEMAPS_OBJS := $(addprefix objs/, $(TONEMAPS:=.o))
SAMPLERS_OBJS := $(addprefix objs/, $(SAMPLERS:=.o))
RENDERER_BINARY = bin/mcm3d
CORE_HEADERFILES = api.h camera.h color.h dynload.h film.h geometry.h \
kdtree.h light.h pbrt.h material.h mc.h mipmap.h octree.h \
paramset.h primitive.h reflection.h sampling.h scene.h \
shape.h texture.h timer.h tonemap.h transform.h transport.h \
volume.h
CORE_HEADERS := $(addprefix core/, $(CORE_HEADERFILES) )
MCM_HEADERFILES = mcm.h
MCM_HEADERS := $(addprefix mcm/, $(MCM_HEADERFILES) )
MCMCODAGE_HEADERFILES = mcmAlgo.h mcmEntrees.h mcmMethodes.h mcmSorties.h mcmVariables.h
MCMCODAGE_HEADERS := $(addprefix mcmCodage/, $(MCMCODAGE_HEADERFILES) )
.SECONDARY: $(SHAPES_OBJS) $(MATERIALS_OBJS) $(LIGHTS_OBJS) $(INTEGRATORS_OBJS) \
$(VOLUMES_OBJS) $(ACCELERATORS_OBJS) $(CAMERAS_OBJS) $(FILTERS_OBJS) \
$(FILM_OBJS) $(TONEMAPS_OBJS) $(SAMPLERS_OBJS) $(TEXTURES_OBJS)
.PHONY: tools exrcheck
default: $(CORE_LIB) $(RENDERER_BINARY) $(INTEGRATORS_DSOS) $(VOLUMES_DSOS) $(FILM_DSOS) $(SHAPES_DSOS) $(MATERIALS_DSOS) $(LIGHTS_DSOS) $(ACCELERATORS_DSOS) $(CAMERAS_DSOS) $(SAMPLERS_DSOS) $(FILTERS_DSOS) $(TONEMAPS_DSOS) $(TEXTURES_DSOS) #tools
tools: $(CORE_LIB)
(cd tools && $(MAKE))
$(CORE_LIB): $(CORE_OBJS)
@echo "Building the core rendering library (libpbrt.a)"
@ar rcs $(CORE_LIB) $(CORE_OBJS)
bin/%.so: objs/%.o
@$(LD) $(SHARED_LDFLAGS) $^ -o $@
objs/%.o: renderer/%.cpp $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Building the rendering binary (pbrt)"
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/%.o: mcm/%.cpp $(MCM_HEADERS)
@echo "Compiling $<"
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/%.o: core/%.cpp $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Compiling $<"
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/scene.o: core/scene.cpp $(CORE_HEADERS) $(MCM_HEADERS) $(MCMCODAGE_HEADERS)
@echo "Compiling $<"
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/%.o: core/%.c $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Compiling $<"
@$(CC) $(CCFLAGS) -o $@ -c $<
objs/%.o: shapes/%.cpp $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Building Shape Plugin \"$*\""
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/%.o: integrators/%.cpp $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Building Integrator Plugin \"$*\""
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/%.o: volumes/%.cpp $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Building Volume Plugin \"$*\""
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/%.o: textures/%.cpp $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Building Texture Plugin \"$*\""
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/%.o: materials/%.cpp $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Building Material Plugin \"$*\""
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/%.o: lights/%.cpp $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Building Light Plugin \"$*\""
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/%.o: accelerators/%.cpp $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Building Accelerator Plugin \"$*\""
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/%.o: cameras/%.cpp $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Building Camera Plugin \"$*\""
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/%.o: filters/%.cpp $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Building Filter Plugin \"$*\""
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/%.o: tonemaps/%.cpp $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Building Tone Map Plugin \"$*\""
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/%.o: film/%.cpp $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Building Film Plugin \"$*\""
@$(CXX) $(CXXFLAGS) -o $@ -c $<
objs/%.o: samplers/%.cpp $(CORE_HEADERS) $(MCM_HEADERS)
@echo "Building Sampler Plugin \"$*\""
@$(CXX) $(CXXFLAGS) -o $@ -c $<
core/pbrtlex.cpp: core/pbrtlex.l
@echo "Lex'ing pbrtlex.l"
@$(LEX) -o$@ core/pbrtlex.l
core/pbrtparse.h core/pbrtparse.cpp: core/pbrtparse.y
@echo "YACC'ing pbrtparse.y"
@$(YACC) -o $@ core/pbrtparse.y
@if [ -e core/pbrtparse.cpp.h ]; then /bin/mv core/pbrtparse.cpp.h core/pbrtparse.h; fi
@if [ -e core/pbrtparse.hpp ]; then /bin/mv core/pbrtparse.hpp core/pbrtparse.h; fi
#$(RENDERER_BINARY): $(RENDERER_OBJS) $(CORE_LIB)
$(RENDERER_BINARY): $(RENDERER_OBJS) $(MCM_OBJS) $(CORE_LIB)
@echo "Linking $@"
@$(CXX) $(LRT_LDFLAGS) -o $@ $(RENDERER_OBJS) $(MCM_OBJS) $(PBRTPRELINK) $(CORE_OBJS) $(PBRTPOSTLINK) $(LIBS)
clean:
rm -f */*.o */*.so */*.a bin/mcm3d core/pbrtlex.[ch]* core/pbrtparse.[ch]*
(cd tools && $(MAKE) clean)
objs/exrio.o: exrcheck
exrcheck:
@echo -n Checking for EXR installation...
@$(CXX) $(CXXFLAGS) -o exrcheck exrcheck.cpp $(LIBS) || \
(cat exrinstall.txt; exit 1) |
Partager