#
# Included makefile for Intel ifort compiler and ifort-built openmpi on 64-bit HAO machines.
#
# Example machines and their unames:
#   - HAO 64-bit Linux system iris.hao.ucar.edu (one quad-core)
#     Linux iris 2.6.18-194.11.1.el5 #1 SMP Tue Aug 10 19:05:06 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
#   - HAO 64-bit Linux system arc.hao.ucar.edu (two quad-cores)
#     Linux arc 2.6.18-194.26.1.el5 #1 SMP Tue Nov 9 12:54:20 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
#
# Compilers and flags:
# Use ifort 11.1 compiler, with openmpi-1.4.3 
# (openmpi was built w/ ifort 11.1 in /home/tgcm/intel)
#
F90      = /opt/local/intel/Compiler/11.1/072/bin/intel64/ifort
MPIF90   = /home/tgcm/intel/openmpi-1.4.3/bin/mpif90
MPIRUN   = /home/tgcm/intel/openmpi-1.4.3/bin/mpirun
FFLAGS   = -r8 -heap-arrays
DBGFLAGS = -debug full -traceback 
DBGFLAGS += -check bounds -check format -check output_conversion -check pointers -check uninit
#
# 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
#
# 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:
