#!/bin/bash

#  Build options for the intel 9.0 fortran compiler
#  ph: use ifort compiler options -convert big_endian -assume byterecl

#  tested on faulks (FC.6)
#  was also tested on hugo (FC.4, FC.9), eddy (FC.5)

# OpenMP : Tested on hugo, eddy and faulks
#-------
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS
#    and generally, needs to increase the stack-size:
#   -  sh,bash:
#     > export OMP_NUM_THREADS=2
#     > export KMP_STACKSIZE=400m
#   - csh,tcsh:
#     > setenv OMP_NUM_THREADS 2
#     > setenv KMP_STACKSIZE 400m
#-------

FC=/usr/local/pkg/intel/intel_fc_90/bin/ifort
F90C=$FC
LINK="$FC -i-static -no-ipo"

DEFINES='-DWORDLENGTH=4'
CPP='cpp  -traditional -P'
F90FIXEDFORMAT='-fixed -Tf'
EXTENDED_SRC_FLAG='-132'
GET_FC_VERSION="--version"
OMPFLAG='-openmp'

INCLUDES='-I/usr/local/pkg/netcdf/netcdf-3.5.1/include'

#  Note that the -mp switch is for ieee "maintain precision" and is
#  roughly equivalent to -ieee
if test "x$IEEE" = x ; then
    FOPTIM='-O3 -align'
#P3 FOPTIM=$FOPTIM' -tpp6 -xWKM'
#P4 FOPTIM=$FOPTIM' -tpp7 -xWKM'
    FFLAGS="$FFLAGS -w95 -W0 -WB -convert big_endian -assume byterecl"
else
    FOPTIM='-O0 -noalign -check all'
    FFLAGS="$FFLAGS -w95 -W0 -WB -xN -pc64 -convert big_endian -assume byterecl"
   #FFLAGS="$FFLAGS -mp -w95 -W0 -WB"
fi
#- might want to use '-r8' for fizhi pkg:
#FFLAGS="$FFLAGS -r8"

F90FLAGS=$FFLAGS
F90OPTIM=$FOPTIM

