#
# SmallLuxGPU Makefile
#

ATISTREAMSDKROOT=/home/david/src/ati-stream-sdk-v2.0-lnx64

CC=gcc
CCFLAGS=-O3 -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller -Wall \
	-I$(ATISTREAMSDKROOT)/include -L$(ATISTREAMSDKROOT)/lib/x86_64 -lglut -lglut -lOpenCL
# Jens's patch for MacOS, comment the 2 lines above and un-comment the lines below
#CCFLAGS=-O3 -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller \
#	-cl-fast-relaxed-math -cl-mad-enable -Wall -framework OpenCL -framework OpenGl -framework Glut

default: all

all: smallluxGPU

smallluxGPU: Makefile \
	bvhaccel.cpp  displayfunc.cpp  mesh.cpp  path.cpp  scene.cpp  smallluxGPU.cpp \
	core/bbox.cpp  core/matrix4x4.cpp  core/transform.cpp \
	plymesh/rply.h \
	core/smalllux.h  core/bbox.h  core/matrix4x4.h  core/normal.h  core/point.h  core/randomgen.h  core/ray.h  core/spectrum.h core/transform.h  core/vector.h  core/vector_normal.h \
	sampler.h bvhaccel.h  camera.h  displayfunc.h  film.h  light.h  mesh.h  path.h  raybuffer.h  renderconfig.h  scene.h  triangle.h
	$(CC) $(CCFLAGS) -I core -o smallluxGPU \
		bvhaccel.cpp  displayfunc.cpp  mesh.cpp  path.cpp  scene.cpp \
		smallluxGPU.cpp core/bbox.cpp  core/matrix4x4.cpp  core/transform.cpp \
		plymesh/rply.c

clean:
	rm -rf smallluxGPU image.ppm smallluxGPU-v1.0 smallluxgpu-v1.0.tgz

tgz: clean all
	mkdir smallluxGPU-v1.0
	cp -r smallluxGPU SmallLuxGPU.exe glut32.dll \
		Makefile \
		*.cl *.cpp *.h plymesh core \
		RUN_SCENE_BIGMONKEY.bat  RUN_SCENE_LOFT.bat  RUN_SCENE_LUXBALL.bat  RUN_SCENE_SIMPLE.bat  RUN_SCENE_SPONZA.bat \
		LICENSE.txt README.txt smallluxGPU-v1.0
	mkdir smallluxGPU-v1.0/scenes
	cp scenes/*.scn scenes/*.ply smallluxGPU-v1.0/scenes
	tar zcvf smallluxgpu-v1.0.tgz smallluxGPU-v1.0
	rm -rf smallluxGPU-v1.0
