#
#  \-->  Nag-F95 compiler
#

F90    = f95
SUFF   = f90
SUFF77 = f
# MSUFF  = mod

#-----------------------------------------------------------------------
#  
#  Select your compiler flags
#
#  \-->  Nag-F95
#

CFLAGS   = -O
CFLAGS77 = -O

#-----------------------------------------------------------------------
#
#    BLAS: DSCAL, DAXPY, ZSWAP, DDOT, DZNRM2, ZCOPY, IZAMAX, ZGEMM, 
#          ZDSCAL, ZGERC, ZTRMM, ZGEMVV, ZSCAL, ZTRMV (plus dependencies)
#
#    LAPACK: ZGEGV, ZGETRF, ZGETRS (plus dependencies)
#
#  In case you have BLAS and LAPACK installed on your system, indicate 
#  the directory where the library can be found and the compiler flag.
#
#  Example: (select, add your own or use the included subset of LAPACK)
#  -------
#
#     \-->   Nag-F95
#

LIB_DIR = /usr/lib/
LIBS    = -L/usr/lib  -L/home/raf/FFT/ -lblas -llapack -lfft -lf2c 

#
#  In case BLAS and LAPACK are not available, you can use the following 
#  settings:
#

#LIB_DIR=./LAPACK
#LIBS=-lmylapack

#
#  To compile the necessary files from BLAS and LAPACK and to build a 
#  corresponding library, type "make lapack" before typing "make zeal".
#  Please read the instructions in the makefile $(LIB_DIR)/makefile !
#
#-----------------------------------------------------------------------
#
#  End of user parameters. Do not alter below.
#
#-----------------------------------------------------------------------


#-----------------------------------------------------------------------
#
# make allclean
#

allclean:
	/bin/rm -f *.o solveHelm

#-----------------------------------------------------------------------
#
#  make clean
#

clean:
	/bin/rm -f *.o
#	/bin/rm -f FFT/*.o

#-----------------------------------------------------------------------
#
# subroutines from FFTPACK (written in Fortran 77)
#

# DFFT = cffti.o cfftf.o cfftb.o

cffti.o: cffti.$(SUFF77)
	$(F90) -c $(CFLAGS77) cffti.$(SUFF77)

cfftf.o: cfftf.$(SUFF77)
	$(F90) -c $(CFLAGS77) cfftf.$(SUFF77)

cfftb.o: cfftb.$(SUFF77)
	$(F90) -c $(CFLAGS77) cfftb.$(SUFF77)

DFFT = dcfftf.o dcfftb.o

dcfftf.o: dcfftf.$(SUFF77)
	$(F90) -c $(CFLAGS77) dcfftf.$(SUFF77)

dcfftb.o: dcfftb.$(SUFF77)
	$(F90) -c $(CFLAGS77) dcfftb.$(SUFF77)

#-----------------------------------------------------------------------

all: solveHelm

fft: FFT/*.$(SUFF77) clean
	$(F90) -c FFT/*.$(SUFF77)
	mv *.o FFT
	ar q FFT/libfft.a FFT/*.o

solveHelm: solveHelm.o helmrobbins.o helmholtz.o helmholtz2.o checkcalc.o 
	$(F90) -o solveHelm solveHelm.o helmrobbins.o helmholtz.o helmholtz2.o checkcalc.o $(LIBS) -L/home/raf/F77/FFT/

solveHelm.o: solveHelm.$(SUFF)
	$(F90) -c $(CFLAGS) solveHelm.$(SUFF)

helmrobbins.o: helmrobbins.$(SUFF)
	$(F90) -c $(CFLAGS) helmrobbins.$(SUFF)


helmholtz.o: helmholtz.$(SUFF)
	$(F90) -c $(CFLAGS) helmholtz.$(SUFF)

helmholtz2.o: helmholtz2.$(SUFF)
	$(F90) -c $(CFLAGS) helmholtz2.$(SUFF)


checkcalc.o: checkcalc.$(SUFF)
	$(F90) -c $(CFLAGS) checkcalc.$(SUFF)


#----------------------------------------------------------------------
