
# CREOS3 GPU ARCH 
GENCODE_ARCH =  -gencode=arch=compute_13,code=\"sm_13,compute_13\" 

include Makefile.cuda

OBJS = exo03func.o MyReduction.o InitArray.o MyReduction_kernel.o InitArrayGPU.o

all : exo03

# CPP -> OBJET

MyReduction.o : MyReduction.cpp MyReduction.hpp MyReduction.h

exo03func.o : exo03func.cpp exo03func.hpp InitArray.hpp MyReduction.h

exo03.o : exo03.cpp exo03func.hpp exo03func.h MyReduction.hpp InitArray.hpp MyReduction.h

InitArray.o : InitArray.cpp InitArray.hpp InitArrayFunc.hpp

MyReduction_kernel.o : MyReduction_kernel.cu MyReduction_kernel.cuh
	$(NVCC) $(GENCODE_ARCH) $(NVCCFLAGS) $(SMVERSIONFLAGS) -o $@ -c $<

InitArrayGPU.o : InitArrayGPU.cu InitArrayGPU.cuh
	$(NVCC)  $(GENCODE_ARCH) $(NVCCFLAGS) $(SMVERSIONFLAGS) -o $@ -c $<

exo03 : exo03.o $(OBJS)
	$(LINK) -o $@ exo03.o $(OBJS) $(LIB)

doc :
	echo "Build listings.pdf..."
	@pdflatex listings.tex
	@pdflatex listings.tex
	@pdflatex listings.tex
	@rm -f *.log *.lol *.aux *.dvi *.out *.toc

CLEAN : 
	@rm -rf exo03 *.log *.lol *.aux *.dvi *.out *.pdf *.toc *~ *.o obj bin
	
run : exo03
	./exo03 -type=double
