## * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
##   Makefile to test SZ library.

##   PLEASE SET THIS VARIABLE BEFORE COMPILING
SZPATH		= /home/sdi/Install/sz-1.4.11-beta-install
#SZPATH	= ..
#GSLPATH = /usr/local/Cellar/gsl/2.4
##   COMPILERS
CC		= gcc
FT		= gfortran
MPICC 		= mpicc
MPIRUN 		= mpirun

##   FLAGS
# Compiling using shared library
#SZFLAG 	= -I$(SZPATH)/include -L$(SZPATH)/lib -lSZ
# Compiling using static library
SZFLAG 	= -I$(SZPATH)/include $(SZPATH)/lib/libSZ.a $(SZPATH)/lib/libzlib.a -lm
GSLFLAG = -lgsl -lgslcblas #-I$(GSLPATH)/include $(GSLPATH)/lib/libgsl.a

##   TARGETS
all: 		testint_compress testint_decompress testfloat_compress testfloat_decompress testdouble_compress testdouble_decompress testfloat_batch_compress testdouble_batch_compress sz sz_gsl
#all: 		testdouble_compress_f testdouble_decompress_f testdouble_batch_compress_f

testint_compress:	testint_compress.c
	$(CC)  -g -O0 -o testint_compress testint_compress.c $(SZFLAG)

testint_decompress:	testint_decompress.c
	$(CC)  -g -O0 -o testint_decompress testint_decompress.c $(SZFLAG)

testfloat_compress:	testfloat_compress.c
	$(CC)  -g -O3 -o testfloat_compress testfloat_compress.c $(SZFLAG)

testfloat_decompress:	testfloat_decompress.c
	$(CC)  -g -O3 -o testfloat_decompress testfloat_decompress.c $(SZFLAG)

testdouble_compress:	testdouble_compress.c
	$(CC)  -g -O3 -o testdouble_compress testdouble_compress.c $(SZFLAG)

testdouble_decompress:	testdouble_decompress.c
	$(CC)  -g -O3 -o testdouble_decompress testdouble_decompress.c $(SZFLAG)

testdouble_compress_f:      testdouble_compress_f.f90
	$(FT)  -g -O3 -o testdouble_compress_f testdouble_compress_f.f90 $(SZFLAG)

testdouble_decompress_f:      testdouble_decompress_f.f90
	$(FT)  -g -O3 -o testdouble_decompress_f testdouble_decompress_f.f90 $(SZFLAG)

testdouble_batch_f:      testdouble_batch_f.f90
	$(FT)  -g -O3 -o testdouble_batch_f testdouble_batch_f.f90 $(SZFLAG)

testfloat_batch_compress:      testfloat_batch_compress.c
	$(CC)  -g -O3 -o testfloat_batch_compress testfloat_batch_compress.c $(SZFLAG)

testdouble_batch_compress:      testdouble_batch_compress.c
	$(CC)  -g -O3 -o testdouble_batch_compress testdouble_batch_compress.c $(SZFLAG)

sz:		sz.c
	$(CC)  -g -O3 -o sz	sz.c $(GSLFLAG) $(SZFLAG)

sz_gsl:		sz_gsl.c
	$(CC)  -g -O3 -o sz_gsl	sz_gsl.c $(GSLFLAG) $(SZFLAG)

clean:
	rm -f test*_compress test*_decompress test*_compress_f test*_decompress_f testfloat_batch_compress testdouble_batch_compress_f sz sz_gsl

