# 
# This Makefile was created by the configure script using
# the files config/MakeDefs.linux and GridFunction/Makefile.in 
# 
# linux with dynamic libraries 

# these next values for compilers will be used unless overridden with an argument to configure
cc = gcc
CC = g++
FC = gfortran

# On some 64-bit machines some libraries are in lib64 instead of lib
# this next line will be changed by the configure script
LIB64 = lib64

# Here is the rpath command
OV_RPATH = -Wl,-rpath,
#xlc OV_RPATH = -R

MOTIF_LIB = $(MOTIF)/$(LIB64)
OPENGL_LIB = $(OpenGL)/$(LIB64)

XLIBS_LIB = $(XLIBS)/$(LIB64)
OV_X_LIBRARIES = -L$(XLIBS_LIB) -lXpm -lXp -lXt -lXmu -lXi -lXext -lX11
OV_MOTIF_LIBRARIES = $(OV_RPATH)$(MOTIF_LIB) -L$(MOTIF_LIB) -lXm

# these next lines will be changed by the configure script
USE_DOUBLE_OR_SINGLE = -DOV_USE_DOUBLE
#xlc USE_DOUBLE_OR_SINGLE = -WF,-DOV_USE_DOUBLE

A++ = $(APlusPlus)
A+++ = $(APlusPlus)
# AppLibraries = -L$(APlusPlus) -lA++ -lA++_static
AppLibraries = $(OV_RPATH)$(APlusPlus)/lib -L$(APlusPlus)/lib -lApp -lApp_static 

Include=  -I$(Overture)/include -I. 
Lib=      $(Overture)/lib
LibOverture= -lOverture -lOverture_static
# Make 2 dynamic libs for ibm: 
#xlc LibOverture= -lOverture1 -lOverture2 -lOverture_static
LibRapsodi= -lRapsodi -lRapsodi_static 
BOXLIB_DEFS = -DBL_USE_DOUBLE -DBL_Solaris

# Here is where we can find the perl include files and library (CORE)
# These will normally be changed by the configure script unless it can't find the location of the perl CORE 
OV_PERL_INCLUDE = /usr/lib64/perl5/CORE
OV_PERL_LIB = /usr/lib64/perl5/CORE
#kkc 060111 here is an attempt to automatically setup the perl stuff
PERLSYSS := $(shell perl -V:archname)
PERL_SYS := $(shell $(PERLSYSS) echo $${archname} )
PERLDIRS := $(shell perl -V:prefix)
PERL_DIR := $(shell $(PERLDIRS) echo $${prefix} )
PERLVERS := $(shell perl -V:version)
PERL_VER := $(shell $(PERLVERS) echo $${version} )
OV_PERL_INCLUDE = /usr/lib64/perl5/CORE
OV_PERL_LIB = /usr/lib64/perl5/CORE
# Here are the perl libraries we need to link to (NOTE: this next line is set by the configure script)
OV_PERL_LIBRARIES = $(OV_RPATH)$(OV_PERL_LIB) -L$(OV_PERL_LIB) -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
# old OV_PERL_LIBRARIES = $(OV_RPATH)$(OV_PERL_LIB) -L$(OV_PERL_LIB) -lperl -lcrypt

# these next flags are compiler dependent
# *** WARNING *** these next lines are changed by the configure script
cc_FLAGS = -fPIC
CC_FLAGS = -fPIC
FF_FLAGS = -fPIC
# turn off warnings from intel f95 compiler
#ifc FF_FLAGS = -fPIC -w

# these next values will may be changed by the configure script
C_OPTIMIZATION_FLAG = -O
CPP_OPTIMIZATION_FLAG = -O
FORTRAN_OPTIMIZATION_FLAG = -g

# Use this next flag to optimize files that Bill likes to by default compile optimized
STD_OPT_FLAG = -O 

CFLAGS =  $(cc_FLAGS)  $(Include)  $(C_OPTIMIZATION_FLAG) -I$(XLIBS) -DSHM
# flags for c routines we always optimize (except if debug is on)
CFLAGSO =  $(STD_OPT_FLAG) $(cc_FLAGS)  $(Include)  -I$(XLIBS) -DSHM

# do not include some paths, such as STL in the places searched by makedepend (takes too long)
# *wdh* temporarily add -Wno-deprecated -- fix these later
# ** CC_INCLUDES_FOR_DEPEND =  $(Include)  -DUSE_MESA -I$(APlusPlus)/include -I$(OpenGL)/include -I$(XLIBS)/include  $(BOXLIB_DEFS) -Wno-deprecated -I$(OV_PERL_INCLUDE)
CC_INCLUDES_FOR_DEPEND =  $(Include)  -DUSE_MESA -I$(APlusPlus)/include -I$(OpenGL)/include -I$(XLIBS)/include  $(BOXLIB_DEFS) -I$(OV_PERL_INCLUDE)

STL_INCLUDE = 
#  HAS_MODFL_PROTO is for a perl compile error of OvertureParser.C for gcc 3.4.3
# CC_INCLUDES = $(CC_FLAGS) $(CC_INCLUDES_FOR_DEPEND) $(STL_INCLUDE) -DHAS_MODFL_PROTO
# CC_FLAGS = -fPIC
# wdh 081212 -- remove HAS_MODFL_PROTO since it fails with xlc
CC_INCLUDES = $(CC_FLAGS) $(CC_INCLUDES_FOR_DEPEND) $(STL_INCLUDE) 
CC_FLAGS = -fPIC

CCFLAGS= $(CC_INCLUDES) $(CPP_OPTIMIZATION_FLAG)

# things that are always compiled with optimization use this flag (except if debug is on)
CCFLAGSO= $(CC_INCLUDES) $(STD_OPT_FLAG)

# things that are always compiled with lots of optimization use this flag (except if debug is on)
CCFLAGSF= $(CC_INCLUDES) $(STD_OPT_FLAG)

# things that need to be compiled with no optimization use the following
CCFLAGSG= $(CC_INCLUDES) -g

# Notes: There seems to be problems using -O with g77
#        Some older versions of the egcs compiler also had trouble with -fPIC, removing it seemed to work.
FFLAGS=    $(FF_FLAGS)   -fdefault-real-8 $(FORTRAN_OPTIMIZATION_FLAG) $(Include)
# single precision always:
FFLAGSS=  $(FF_FLAGS)  $(FORTRAN_OPTIMIZATION_FLAG)  $(Include)
FFLAGSSO = ${FF_FLAGS}  $(Include) $(STD_OPT_FLAG)
FFLAGSO = $(FF_FLAGS)  -fdefault-real-8 $(STD_OPT_FLAG) $(Include)
FFLAGSG = $(FF_FLAGS)  -fdefault-real-8 -g $(Include)
FFLAGSG2 = $(FF_FLAGS)  -fdefault-real-8 -g $(Include)
# The ifort compiler can take for-ever if we use -g so use -O instead
#ifort FFLAGSG = $(FF_FLAGS)  -fdefault-real-8 -O $(Include)

# things that are always compile with optimization use these flags (except if debug is on)
FFLAGSO= $(STD_OPT_FLAG) $(FF_FLAGS)  -fdefault-real-8  $(FLAGS) $(Include) 
FFLAGSSO= $(STD_OPT_FLAG)  $(FF_FLAGS)  $(FLAGS) $(Include)

# Here we add a path to the compiler lib directory (this is sometimes needed so that we find the correct
# version of the compiler libraries if they are different from the the ones in /usr/lib for e.g.)
#OV_COMPILER_LIBS = $(OV_RPATH)$(COMPILER_LIB_DIRECTORY) -L$(COMPILER_LIB_DIRECTORY)

# here are the hdf libraries (the configure script will change this line for use with hdf5)
HDF_LIBS = $(OV_RPATH)$(HDF)/lib -L$(HDF)/lib -lhdf5 -ljpeg -lz 
#xlc HDF_LIBS = $(OV_RPATH)$(HDF)/lib -L$(HDF)/lib -lhdf5 -lz 

FORTRAN_LIBS = 
FORTRAN_LIBS =-lnsl -lg2c
FORTRAN_LIBS =-lgfortran
# This next line will be used with the Portland group compiler (the configure script will set the next line)
# 080623: aio_read etc. are found in /usr/lib/librt.so
PGI_LIB = 
#pgf77 FORTRAN_LIBS = $(OV_RPATH)$(PGI_LIB) -L$(PGI_LIB) -lpgftnrtl -lpgmp  -lpgc -lrt -lstd
# This next line will be used with the intel fortran compiler. (the configure script will set the next line)
# g2c may be needed by lapack (for cg)
IFORT_LIB = 
#ifc FORTRAN_LIBS = $(OV_RPATH)$(IFORT_LIB) -L$(IFORT_LIB) -lF90 -lIEPCF90 -lg2c
# old ifc FORTRAN_LIBS = -Wl,-rpath,/opt/intel/compiler60/ia32/lib -L/opt/intel/compiler60/ia32/lib -lF90 -lIEPCF90 -L/usr/lib/gcc-lib/i386-redhat-linux/2.96 -lg2c
# Here are the libraries for the new intel compiler (called ifort instead of ifc) (use "ifort -dryrun" to see libraries needed)
#ifort FORTRAN_LIBS = $(OV_RPATH)$(IFORT_LIB) -L$(IFORT_LIB) -lifcoremt
# Libraries using xlf and linux
#xlf FORTRAN_LIBS = -L/opt/ibmcmp/xlf/bg/11.1/bglib -lxlopt -lxl -lxlf90 -lxlfmath -L/opt/ibmcmp/xlsmp/bg/1.7/bglib/ -lxlomp_ser
LIB_TARGETS= lib_date libso_date
LIB_DEPENDENCIES= ../lib/lib_date
TEMPLATES=  
RAPTEMPLATES=  

# The KCC compiler should be used to build the static library (for templates)
AR = ar
#KCC AR = KCC
ARFLAGS = ruv  
#KCC ARFLAGS = -o 

LD = $(CC)
LDFLAGS = -L
RANLIB = ranlib
SOFLAGS = -shared
#xlc SOFLAGS = -qmkshrobj -qnostaticlink
# the next line is changed by the configure script
OpenGLibs =-lGL -lGLU -lGLw 
GLIBS=  $(OV_PERL_LIBRARIES) $(OV_RPATH)$(OPENGL_LIB) -L$(OPENGL_LIB) $(OpenGLibs) $(OV_MOTIF_LIBRARIES) $(OV_X_LIBRARIES) -lm

# On Don's machine the pgi libraries need to follow the mpi libraries : 
# FLIBS= $(OV_RPATH)$(Overture)/lib $(LDFLAGS)$(Overture)/lib $(LibOverture) $(HDF_LIBS) $(FORTRAN_LIBS) $(AppLibraries) 
FLIBS= $(OV_RPATH)$(Overture)/lib $(LDFLAGS)$(Overture)/lib $(LibOverture) $(OV_COMPILER_LIBS) $(HDF_LIBS) $(AppLibraries) $(FORTRAN_LIBS)


OGMGLIB = $(OV_RPATH)$(Overture)/lib $(LDFLAGS)$(Overture)/lib -lOgmg#
# Makefile core -- the configure script uses this to make the file "Makefile"
#

.SUFFIXES:
.SUFFIXES:.C .o .c .o .f .o
.C.o:; $(CC) $(CCFLAGS) -c $*.C
.c.o:; $(cc) $(CFLAGS) -c $*.c
.f.o:; $(FC) $(FFLAGS) -c $*.f

default:  depend_date  GridFunction_date 

# Here are files from P++ that include some fixes -- these fixes will eventually move to the P++ source
#  These files are only compiled with the 'parallel' option
#parallel pppFiles = partitioning.C conform_enforce.C p_array.C array.C p_abstract_op.C p_descriptor.C
#parallel pppObject= partitioning.o conform_enforce.o p_array.o array.o p_abstract_op.o p_descriptor.o

Source1= \
          BoundaryOperators.C    applyBCC.C                    \
          aDotU.C dirichlet.C extrapolate.C generalizedDivergence.C generalMixed.C neumann.C aDotGradU.C \
          normalComponent.C normalDerivative.C symmetry.C tangential.C fixBoundaryCorners.C normalDotScalarGrad.C \
	  finishBoundaryConditions.C             \
	  spectralDerivatives.C                  \
	  FourierOperators.C                     \
          GridFunctionParameters.C               \
          SparseRep.C                            \
          BoundaryConditionParameters.C          \
          intMappedGridFunction.C                \
          floatMappedGridFunction.C              \
          doubleMappedGridFunction.C             \
          intGenericGridCollectionFunction.C     \
          floatGenericGridCollectionFunction.C   \
          doubleGenericGridCollectionFunction.C  \
          intGridCollectionFunction.C            \
          floatGridCollectionFunction.C          \
          doubleGridCollectionFunction.C         \
          intCompositeGridFunction.C             \
          floatCompositeGridFunction.C           \
          doubleCompositeGridFunction.C          \
          interpRefinements.C                    \
          GenericMappedGridOperators.C           \
          GenericGridCollectionOperators.C       \
          GenericCompositeGridOperators.C        \
          MappedGridOperators.C                  \
          GridCollectionOperators.C              \
          CompositeGridOperators.C               \
          interpPoints.C                         \
          gridFunctionNorms.C                    \
	  ArrayUtil.C                            \
          App.C                                  \
	  GridDistribution.C                     \
          LoadBalancer.C

Source2= \
          MGOD.C                                \
  xFDerivative.C  yFDerivative.C  zFDerivative.C xxFDerivative.C xyFDerivative.C xzFDerivative.C \
 yyFDerivative.C yzFDerivative.C zzFDerivative.C  rDerivative.C  sDerivative.C  tDerivative.C \
 rrDerivative.C rsDerivative.C rtDerivative.C ssDerivative.C stDerivative.C ttDerivative.C \
 divFDerivative.C divScalarGradFDerivative.C scalarGradFDerivative.C gradFDerivative.C identityFDerivative.C \
 laplaceFDerivative.C  vorticityFDerivative.C derivativeScalarDerivativeFDerivative.C divVectorScalarFDerivative.C \
          MGOC.C                                       \
 UnstructuredOperators.C UnstructuredBoundaryOperators.C u_dirichlet.C \
  xFDCoefficients.C  yFDCoefficients.C  zFDCoefficients.C xxFDCoefficients.C \
 xyFDCoefficients.C xzFDCoefficients.C \
 yyFDCoefficients.C yzFDCoefficients.C zzFDCoefficients.C  laplacianFDCoefficients.C \
 divFDCoefficients.C divScalarGradFDCoefficients.C scalarGradFDCoefficients.C gradFDCoefficients.C \
 identityFDCoefficients.C derivativeScalarDerivativeFDCoefficients.C divVectorScalarFDCoefficients.C \
  rDerivCoefficients.C  sDerivCoefficients.C  tDerivCoefficients.C \
 rrDerivCoefficients.C rsDerivCoefficients.C rtDerivCoefficients.C ssDerivCoefficients.C \
 stDerivCoefficients.C ttDerivCoefficients.C 

GridFunction1 = ${pppObject} ${Source1:.C=.o} 
GridFunction1_date:  $(GridFunction1) $(SECOND)
	  touch $@

GridFunction2 = ${Source2:.C=.o}
GridFunction2_date: $(GridFunction2)
	  touch $@

# Here are the files that Bill always likes to optimize 
filesOpt = Interpolant.C interpolateExposedPoints.C InterpolatePoints.C ExposedPoints.C \
           ParallelOverlappingGridInterpolator.C AssignInterpNeighbours.C InterpolatePointsOnAGrid.C pogip.C \
           findNearestValidGridPoint.C
Interpolant.o :                         ${@:.o=.C}; $(CC) $(CCFLAGSO) -c ${@:.o=.C}
interpolateExposedPoints.o :            ${@:.o=.C}; $(CC) $(CCFLAGSO) -c ${@:.o=.C}
InterpolatePoints.o :                   ${@:.o=.C}; $(CC) $(CCFLAGSO) -c ${@:.o=.C}
ExposedPoints.o :                       ${@:.o=.C}; $(CC) $(CCFLAGSO) -c ${@:.o=.C}
ParallelOverlappingGridInterpolator.o : ${@:.o=.C}; $(CC) $(CCFLAGSO) -c ${@:.o=.C}
AssignInterpNeighbours.o :              ${@:.o=.C}; $(CC) $(CCFLAGSO) -c ${@:.o=.C}
InterpolatePointsOnAGrid.o :            ${@:.o=.C}; $(CC) $(CCFLAGSO) -c ${@:.o=.C}
pogip.o :                               ${@:.o=.C}; $(CC) $(CCFLAGSO) -c ${@:.o=.C}
findNearestValidGridPoint.o :           ${@:.o=.C}; $(CC) $(CCFLAGSO) -c ${@:.o=.C}
GridFunction_Opt_date: ${filesOpt:.C=.o}
	  touch $@


# Compile these next files with -g because the compiler dies 
# files = GenericMappedGridOperators.C           \
#         GenericGridCollectionOperators.C       \
#         GenericCompositeGridOperators.C
# files = 
# GridFunction3_date: $(files)
# 	$(CC) $(CCFLAGSG) -c $?
# 	  touch $@

# Here are files from P++ that include some fixes -- these fixes will eventually move to the P++ source

# Here is how we would compile datamove.c -- but for now it is not needed since it is the same as in P++
PFLAGSC = -DHAVE_CONFIG_H -I. -I$(P)/../.. -I$(P)/../../include -I$(P)/../../PARTI -I$(P)/../PARTI -I$(MPI_ROOT)/include    -I$(P)/../../PADRE/src -I$(P)/../../PADRE -I$(P)/../../PARTI -I$(P)/../../PARTI -I$(P)/../../PADRE/PGSLIB -I$(P)/../../PADRE/PGSLIB -I$(P)/../../PGSLIB -I$(P)/../PGSLIB $(STD_OPT_FLAG) -fPIC -Wstrict-prototypes
datamove.o: datamove.c
	 $(cc) $(PFLAGSC) -c datamove.c

# ----------- here is how we compile P++ files  --------------------------
P = $(PPlusPlus)/../src/array_src
PFLAGS = -DHAVE_CONFIG_H -I. -I$(P)/../.. -I$(P)/../../include -I$(P)/../../PARTI -I$(P)/../PARTI -I$(MPI_ROOT)/include    -I$(P)/../../PADRE/src -I$(P)/../../PADRE -I$(P)/../../PARTI -I$(P)/../../PARTI -I$(P)/../../PADRE/PGSLIB -I$(P)/../../PADRE/PGSLIB -I$(P)/../../PGSLIB -I$(P)/../PGSLIB $(STD_OPT_FLAG) -fPIC -Wno-deprecated

partitioning.o: partitioning.C
	$(CC) $(PFLAGS) -c partitioning.C
conform_enforce.o: conform_enforce.C
	$(CC) $(PFLAGS) -c conform_enforce.C
p_array.o: p_array.C
	$(CC) $(PFLAGS) -c p_array.C
array.o: array.C
	$(CC) $(PFLAGS) -c array.C
p_abstract_op.o: p_abstract_op.C
	$(CC) $(PFLAGS) -c p_abstract_op.C
p_descriptor.o: p_descriptor.C
	$(CC) $(PFLAGS) -c p_descriptor.C


FFLAGSGO = $(FFLAGSO)
# FFLAGSGO = $(FFLAGSG)
# turn off optimization when using fort77 -- requires too much memory
#fort77 FFLAGSGO = $(FFLAGSG)
# turn off optimization when using g77 -- takes too long to compile
#g77 FFLAGSGO = $(FFLAGSG)
# Always compile these next files optimized
fortran_files = coeff.f xFDeriv.f yFDeriv.f zFDeriv.f xxFDeriv.f xyFDeriv.f xzFDeriv.f yyFDeriv.f \
                yzFDeriv.f zzFDeriv.f laplacianFDeriv.f  initExplicitInterp.f \
                interpOpt.f interpOptFull.f interpOptTP.f interpOptSP.f \
                dsg.f dsg2.f dsg3.f dsgr.f dsgc4.f dsgc6.f laplaceNC.f divScalarGradNC.f \
                xCoeff2.f yCoeff2.f zCoeff2.f xxCoeff2.f xyCoeff2.f xzCoeff2.f yyCoeff2.f yzCoeff2.f zzCoeff2.f \
                laplacianCoeff2.f  identityCoeff2.f opcoeff.f assignBoundaryConditions.f \
                assignOptNeumann.f assignOptGenDiv.f assignOptNormalDer.f assignOptNormalComponent.f assignOptADotGradU.f \
                findInterpolationNeighbours.f findInterpNeighbours.f standardDerivative.f normOpt.f ncarfft.f \
                extrapolateOpt.f assignCornersOpt.f fixBCOptEdge1.f fixBCOptEdge2.f fixBCOptEdge3.f \
                fixBCOptVerticies.f div.f

coeff.o :              ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
xFDeriv.o :            ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
yFDeriv.o :            ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
zFDeriv.o :            ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
xxFDeriv.o :           ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
xyFDeriv.o :           ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
xzFDeriv.o :           ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
yyFDeriv.o :           ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
yzFDeriv.o :           ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
zzFDeriv.o :           ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
laplacianFDeriv.o :    ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
initExplicitInterp.o : ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
interpOpt.o :          ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}

# The 32 bit intel compiler dies on interpOptFull.f with -g
# The 64 bit intel compiler dies on interpOptFull.f with -O
interpOptFull.o :               ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
#ifort64 interpOptFull.o :      ${@:.o=.f}; $(FC) $(FFLAGSG2) -c ${@:.o=.f}

interpOptTP.o :                 ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
interpOptSP.o :                 ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
normOpt.o :                     ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
ncarfft.o :                     ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}

dsg.o :                         ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
dsg2.o :                        ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
dsg3.o :                        ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
dsgr.o :                        ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
dsgc4.o :                       ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
dsgc6.o :                       ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
laplaceNC.o :                   ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
divScalarGradNC.o :             ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
xCoeff2.o :                     ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
yCoeff2.o :                     ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
zCoeff2.o :                     ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
xxCoeff2.o :                    ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
xyCoeff2.o :                    ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
xzCoeff2.o :                    ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
yyCoeff2.o :                    ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
yzCoeff2.o :                    ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
zzCoeff2.o :                    ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
laplacianCoeff2.o :             ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
identityCoeff2.o :              ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
opcoeff.o :                     ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
assignBoundaryConditions.o :    ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
assignOptNeumann.o :            ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
assignOptGenDiv.o :             ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
assignOptNormalDer.o :          ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
assignOptNormalComponent.o :    ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
extrapolateOpt.o :              ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
assignCornersOpt.o :            ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
fixBCOptEdge1.o :               ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
fixBCOptEdge2.o :               ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
fixBCOptEdge3.o :               ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
fixBCOptVerticies.o :           ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
findInterpolationNeighbours.o : ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
standardDerivative.o :          ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}
div.o :                         ${@:.o=.f}; $(FC) $(FFLAGSGO) -c ${@:.o=.f}

GridFunction4_date: ${fortran_files:.f=.o}
	  touch $@

# These files are not always compiled optimized to save time when compiling.
#  note: divScalarGradCoeff2.f and derivativeScalarDerivativeNC.f take a long time to compile optimised
fortran_files2 = divScalarGradCoeff2.f \
                xCoeff4.f yCoeff4.f zCoeff4.f xxCoeff4.f xyCoeff4.f xzCoeff4.f yyCoeff4.f yzCoeff4.f zzCoeff4.f \
                laplacianCoeff4.f divScalarGradCoeff4.f identityCoeff4.f derivativeScalarDerivativeNC.f \
                rCoeff2.f sCoeff2.f tCoeff2.f rrCoeff2.f rsCoeff2.f rtCoeff2.f ssCoeff2.f stCoeff2.f ttCoeff2.f \
                rCoeff4.f sCoeff4.f tCoeff4.f rrCoeff4.f rsCoeff4.f rtCoeff4.f ssCoeff4.f stCoeff4.f ttCoeff4.f
# make separate targest since some compilers have trouble doing all files at once

# ** The intel compiler takes forever to compile with -g but -O is fast !! (cf. laplaceCoeff4.f)
# The pgf compiler has trouble with derivativeScalarDerivativeNC.f and -O
#ifort FFLAGS = $(FFLAGSGO)

xCoeff4.o :                      ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
divScalarGradCoeff2.o :          ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
yCoeff4.o :                      ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
zCoeff4.o :                      ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
xxCoeff4.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
xyCoeff4.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
xzCoeff4.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
yyCoeff4.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
yzCoeff4.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
zzCoeff4.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
laplacianCoeff4.o :              ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
divScalarGradCoeff4.o :          ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
identityCoeff4.o :               ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
derivativeScalarDerivativeNC.o : ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
rCoeff2.o :                      ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
sCoeff2.o :                      ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
tCoeff2.o :                      ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
rrCoeff2.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
rsCoeff2.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
rtCoeff2.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
ssCoeff2.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
stCoeff2.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
ttCoeff2.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
rCoeff4.o :                      ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
sCoeff4.o :                      ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
tCoeff4.o :                      ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
rrCoeff4.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
rsCoeff4.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
rtCoeff4.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
ssCoeff4.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
stCoeff4.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}
ttCoeff4.o :                     ${@:.o=.f}; $(FC) $(FFLAGS) -c ${@:.o=.f}

                        
# GridFunction5_date: $(fortran_files2)
# 	$(FC) $(FFLAGS) -c $?
#	  touch $@

GridFunction5_date: $(fortran_files2:.f=.o)
	  touch $@

GridFunction_date:GridFunction4_date GridFunction5_date GridFunction1_date GridFunction2_date GridFunction_Opt_date
	touch $@

Source = $(Source1) $(Source2) $(filesOpt) $(files) ${pppFiles}
depend_date: depend; perl ../config/makeDepend -f depend -Y -- $(CC_INCLUDES_FOR_DEPEND) -- $(Source)
	touch $@
# include the dependencies here
include depend

clean:	rm *.o

.PRECIOUS:GridFunction_date GridFunction1_date GridFunction2_date GridFunction_Opt_date depend_date

