#
# Included makefile for PGI compiler on 64-bit HAO Linux desktops.
# Using pgf90 9.0-4 64-bit target on x86-64 Linux -tp nehalem-64
#
F90      = pgf90
MPIF90   = /opt/local/pgi-9.04/linux86-64/9.0/mpi/mpich/bin/mpif90
MPIRUN   = /opt/local/pgi-9.04/linux86-64/9.0/mpi/mpich/bin/mpirun

#MPIF90   = /opt/local/pgi-15.5/linux86-64/2015/mpi/mpich/bin/mpif90
#MPIRUN   = /opt/local/pgi-15.5/linux86-64/2015/mpi/mpich/bin/mpirun

FFLAGS   = -r8
DBGFLAGS = -C -Mchkstk -Mpgicoff -traceback
#
# Makefile will use OPTIM = -g if set debug=TRUE in job script.
OPTIM    = -O3
LIBS     = -lhdf5_hl -lhdf5 -lsz -L/usr/lib64 -lz
HOST     = $(shell hostname)
#
# Library and Include file paths:
#
LIB_NETCDF = /opt/local/netcdf/linux86-64/lib
INC_NETCDF = /opt/local/netcdf/linux86-64/include
#
LIB_ESMF = /home/tgcm/esmf/pgi-9.04/lib/libO/Linux.pgi.64.mpich.default
include $(LIB_ESMF)/esmf.mk
#
# 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:
