#
# BLAS, ATLAS, MKL, Blitz++ Benchmarks
#
# make blasbench
# make blitzbench
# make tinybench
#

# name of C++ compiler
CPP = g++
# Warning: do not use -ffast with icpc as it generates
# code that is not XEON compatible.
# CPP = icpc


# flags for C++ compiler
# CPPFLAGS = -O3 -funroll-loops
CPPFLAGS = -O3


# BLAS libraries: uncomment the required library

# Linux ATLAS
 BLASLIB = -L/usr/lib/sse2 -lcblas -latlas

# Linux MKL
# Note: type    export LD_LIBRARY_PATH=/opt/intel/mkl/8.0/lib/32
#       before execution to tell the binary where the dynamic libs are
# BLASLIB = -L/opt/intel/mkl/8.0/lib/32 -lmkl

# Linux Standard BLAS
# note: /usr/lib/libblas.a forces the linker to take this
#       particular BLAS. Otherwise, it automatically uses ATLAS.
# BLASLIB = /users/devg/seminars/blas/cblas/libcblas.a /usr/lib/libblas.a  -L/usr/lib -lg2c

# Blitz++ Library
# should not be installed on henrici. Download and install locally!
BLITZLIB = /users/devg/seminars/blas/blitz/lib/libblitz.a
BLITZINC = -I/users/devg/seminars/blas/blitz/include


# complete list of include files
ALLINCS = $(BLITZINC) 

blasbench : blasbench.o utils.o
	$(CPP) $(CPPFLAGS) -o blasbench blasbench.o utils.o $(BLASLIB)

blitzbench : blitzbench.o utils.o
	$(CPP) $(CPPFLAGS) -o blitzbench blitzbench.o utils.o $(BLITZLIB)

tinybench : tinybench.o utils.o
	$(CPP) $(CPPFLAGS) -o tinybench tinybench.o utils.o $(BLITZLIB)

clean:
	- rm -f *.o
	- rm -f *~

realclean:
	- rm -f *.o
	- rm -f *~
	- rm -f blasbench blitzbench tinybench

.cpp.o:
	$(CPP) $(CPPFLAGS) $(ALLINCS) -c $*.cpp

