#############################################################################
# Define make (gnu make works best)
#############################################################################
MAKE=/usr/bin/make

#############################################################################
# Set your RAMS root path and version number.
#############################################################################
RAMS_ROOT=$(HOME)/rams_20170906_6.2.06_ONR_MURI
RAMS_VERSION=6.2.06

#############################################################################
# Set root locations for HDF5 and MPI software.
#############################################################################
HDF5_ROOT=$(RAMS_ROOT)/misc/hdf5-1.8.9.precomp.binaries
MPI_ROOT=$(RAMS_ROOT)/misc/mpich2-1.4.1.precomp.binaries

#############################################################################
# Do not change these 2. They point from RAMS_ROOT to the source code.
#############################################################################
MODEL=$(RAMS_ROOT)/src/$(RAMS_VERSION)
UTILS_INCS=-I$(MODEL)/include

#############################################################################
# Set HDF libraries and include locations relative to HDF5_ROOT.
# Note that linking libraries below are in a particular order to work!
# You may not need to modify these 3 variables. Try this default.
#############################################################################
HDF5_LIBS=-L$(HDF5_ROOT)/lib -lhdf5_hl -lhdf5 -lsz -lz
HDF5_INCS=-I$(HDF5_ROOT)/include
HDF5_DEFS=

#############################################################################
# TYPE OF COMPUTER SYSTEM (used for DEFINE statements for intrinsic calls).
# Do not change this variable.
#############################################################################
CMACH=PC_LINUX1  #Standard Linux (only option available now)

#############################################################################
# UNCOMMENT 1 LINUX FORTRAN COMPILER SET OF FLAGS BELOW
#############################################################################
# Note that some Fortran optimizations greater than -O1 will not necessarily 
# produce identical results when running same executable multiple times.
# This is perhaps due to order of operations or unrolling loop order that
# changes solutions slightly. This is not ideal for research applications
# involving sensitivity studies that require exact duplication. As such,
# the Makefile is setup to allow different optimizations for different source
# files. The F_OPTS1 and F_OPTS2 variables below can hold different compiler
# flags as needed. Further, for duplication of results you may need to force
# IEEE standard which is done in examples below.
# Please coordinate variables below with the commands in the Makefile.
# Definitions of compiler flags below
# F_COMP      = path to compiler executable
# F_OPTS1     = Uses of flags for lower optimization for some files
# F_OPTS2     = Uses of flags for higher optimization for some files
# LOADER_OPTS = Flags and optimaztion for LOADER
# LIBS        = Extra system libraries for linking tha

#*****************************
# FOR INTEL IFORT COMPILER
#*****************************
# (-g) for debugging, (-traceback) for more compiler error info
# (-check bounds) for array bounds checking, (-fp-model precise) for IEEE
# (-check uninit) for finding uninitialized variables, (-free) for free format
F_COMP=ftn
F_OPTS1=-free -O1 -fp-model strict
F_OPTS2=-free -O2 -fp-model strict
LOADER_OPTS= -free -O2 -fp-model strict
LIBS=-L/usr/lib64 -lrt

#*****************************
# FOR PGI PGF90 COMPILER
#*****************************
# (-g) for debugging, (-Kieee) for IEEE, (-Mfree) for free format
#F_COMP=/opt/pgi/linux86-64/16.10/bin/pgf90
#F_OPTS1=-Mfree -O1 -Kieee
#F_OPTS2=-Mfree -O2 -Kieee
#LOADER_OPTS=-Mfree -O2 -Kieee
#LIBS=

#*****************************
# FOR GFORTRAN COMPILER
#*****************************
# (-Wall) for warnings, (-ffree-form) for free format
# (-fno-sign-zero) for not making zeros negative values
# (-fcheck=bounds) check for array bounds issues
# (-fcheck=all) all runtime checking
#F_COMP=/usr/bin/gfortran
#F_OPTS1=-ffree-form -O1
#F_OPTS2=-ffree-form -O2
#LOADER_OPTS=-ffree-form -O2 
#LIBS=-L/usr/lib/x86_64-linux-gnu -lrt -lpthread

#############################################################################
# LINUX C compiler choice and flags (gcc)
#############################################################################
C_COMP=cc
C_OPTS=-O3 -DUNDERSCORE -DLITTLE

#############################################################################
# System archive command syntax
#############################################################################
ARCH=ar rs

#############################################################################
# MPI - parallel processing choices required for parallel enabled HDF5.
# Choose and uncomment one of the MPI software options below.
#############################################################################
PAR_LIBS=    #leave blank (override below if using MPI)
PAR_DEFS=    #leave blank (override below if using MPI)
#---------------LINUX MPICH--------------------------------------------------
#PAR_INCS=-I$(MPI_ROOT)/include
#PAR_LIBS=-L$(MPI_ROOT)/lib -lmpich -lmpl
PAR_DEFS=-DRAMS_MPI

#---------------LINUX OPENMPI------------------------------------------------
#PAR_INCS=-I$(MPI_ROOT)/include
#PAR_LIBS=-L$(MPI_ROOT)/lib -lmpi
#PAR_DEFS=-DRAMS_MPI
