#
# Included makefile for Intel ifort compiler with openmpi on 64-bit HAO machines.
# Intel ifort (IFORT) 12.0.0 20101006
#
F90      = /opt/local/intel2011/composerxe-2011.0.084/bin/intel64/ifort
MPIF90   = /opt/local/intel2011/impi/4.0.1.007/intel64/bin/mpif90 -fc=ifort
MPIRUN   = /opt/local/intel2011/impi/4.0.1.007/intel64/bin/mpirun -l -s all
FFLAGS   = -r8 -heap-arrays
DBGFLAGS = -debug full -traceback 
DBGFLAGS += -check bounds -check format -check output_conversion -check pointers -check uninit
DBGFLAGS += -fpe-all=0 # this traps all floating point exceptions
#
# Makefile will use OPTIM = -g if set debug=TRUE in job script.
OPTIM    = -O3
LIBS     = -lcurl
HOST     = $(shell hostname)
#
# Library and Include file paths:
#
LIB_NETCDF = /home/tgcm/intel/netcdf-4.1.1/lib
INC_NETCDF = /home/tgcm/intel/netcdf-4.1.1/include
#
# This public release of ESMF was built at hao with intel on Dec 22, 2015:
#
LIB_ESMF = /home/tgcm/esmf/intel/esmf_6_3_0rp1/lib/libO/Linux.intel.64.intelmpi.default
#
# Make machines.ini file for MPI execution: 
#
prereq: machines.ini mpirun.command
machines.ini: export HN=$(HOST)
machines.ini: export NP=$(NPROC)
machines.ini: FORCE
	@echo "Making machines.ini.."
	@echo `hostname` > machines.ini
	@awk 'BEGIN{ for (i=2; i <= ENVIRON["NP"]; i++) print ENVIRON["HN"] }' >> machines.ini

mpirun.command: FORCE
	@echo "Making mpirun.command: MPIRUN=$(MPIRUN)"
	@echo $(MPIRUN) > mpirun.command

FORCE:
