##  -*-Makefile-*- (for Emacs)    vim:set filetype=make:  (for vim)
##
## $Id: Makefile.src 13436 2010-03-11 19:08:30Z AxelBrandenburg $
## Makefile for modular pencil code
# 
# Default module settings: they can be overwritten by src/Makefile.local which
# should be present in each local run directory.
#
BOUNDCOND         =   boundcond
DEBUG             = nodebug
DERIV             =   deriv
GRID              =   grid
GSL               = nogsl
INITIAL_CONDITION = noinitial_condition
IO                =   io_dist
MPICOMM           =   mpicomm
SLICES            =   slices
SIGNAL_HANDLING   = nosignal_handling
TIMESTEP          =   timestep
# 
# Physics modules (alphabetical order).
#
DENSITY           = nodensity
ENTROPY           = noentropy
EOS               =   eos_idealgas
GRAVITY           = nogravity
HYDRO             = nohydro
MAGNETIC          = nomagnetic
SHEAR             = noshear
SHOCK             = noshock
VISCOSITY         =   viscosity
# 
# Single vs. double precision.
#
REAL_PRECISION = default
# 
# Default compiler settings.
#
FC           = f90
FFLAGS       =
F90FLAGS     =
F77          = f90
F77FLAGS     =
CFLAGS       = -O3 -DFUNDERSC=1
FCCLEANER    =
LIBMPISUFFIX =
MAKEOPTS     =
#
# Defaults for external libraries.
#
CFLAGS_FFTW3  =
xFFLAGS_FFTW3 =
LD_FFTW3      =
CFLAGS_FFTW2  =
FFLAGS_FFTW2  =
LD_FFTW2      =
# 
# Extra compiler flags (what does the `GENERAL' refer to?).
#
FFLAGS_GENERAL =
CFLAGS_GENERAL =
# 
# Default double flags (can be overwritten in machine-specific section).
#
FFLAGS_DOUBLE = -r8
CFLAGS_DOUBLE = -DDOUBLE_PRECISION
# 
# Overwrite settings that are local to each run directory.
#
include Makefile.local
# 
# Double precision settings and similar. Must be included _after_
# Makefile.local, so we can set REAL_PRECISION=double there.
#
include Makefile.inc
# 
# For gsl library.
#
ifeq ($(GSL),gsl_wrapper)
  LD_GSL = -lgsl -lgslcblas
endif
ifeq ($(GSL),gsl_wrapper_r8)
  LD_GSL = -lgsl -lgslcblas
endif
# 
# Check for inconsistent settings in Makefile.local.
#
ifeq ($(HYDRO),nohydro)
  ifneq ($(VISCOSITY),noviscosity)
nohydro_message:
	@echo ";;; You are using HYDRO = nohydro, but VISCOSITY is not noviscosity."
	@echo ";;; One can only use viscosity in connection with the hydro module."
	@echo ";;; Please adapt the settings in Makefile.local."
	exit 1

  endif
endif
# 
# Check for outdated features.
#
ifeq ($(GRAVITY),nograv)
nograv_message:
	@echo ";;; Cannot compile:"
	@echo ";;;    'nograv.f90' has been renamed to 'nogravity.f90'"
	@echo ";;;"
	@echo ";;; Please update your src/Makefile.local, e.g. via cut+paste:"
	@echo ";;;"
	@echo ";;;      perl -pi'~' -e 's/(GRAVITY\s*\=\s*)nograv([^a-zA-Z])/\$$1nogravity\$$2/' $(FROM_PARENT)Makefile.local"
	@echo ";;;"
	exit 1
endif
# 
# The following block (`Begin/End machine dependent') specifies compilers
# and switches for given architectures and machine names. See
# `perldoc adapt-mkfile' for full documentation of the syntax.
# Compiler flags:
#   FFLAGS are used by both the F90 compiler $(FC) and $(F77);
#   F90FLAGS are only used by $(FC)
#   F77FLAGS are only used by $(F77)
# 

### Begin machine dependent

## IRIX64:
## SGI
#FC=f90
#FFLAGS= -64 -O3 -mips4
#FFLAGS= -auto_use mpi_interface -64 -O3 -macro_expand  #(gridur|embla|balder)
#FFLAGS= -auto_use mpi_interface -64 -O3 -C -macro_expand  #(sander|antares)
#FFLAGS= -pfalist -64 -O3 -mips4 -r10000 -C -macro_expand  #(Grand)
#FFLAGS= -64 -O3 -mips4 -r12000 #(Ukaff)
#FFLAGS= -64 -O3 -auto_use mpi_interface -mips4 #(ukaff|origin)
#FFLAGS= -64 -O3 -mips4 -r12000 -flist #(green)
#FFLAGS= -64 -O3 -mips4 -r12000 #(wrenstandard)
#FFLAGS= -64 -O3 -mips4 -r12000 -LNO:cs1=32k:cs2=8M #(wrencache)
#FFLAGS= -64 -O3 -mips4 -r12000 -LNO:cs1=32k:cs2=8M -I/share/apps/unsupported/pacx/standard/include -L/share/apps/unsupported/pacx/standard/lib #(wrenpacx)
#LD_MPI= -L/share/apps/unsupported/pacx/standard/lib -lpacxf -lpacx -lmpi #(wrenpacx)
#FFLAGS= -64 -O3 -mips4 -r12000 -LNO:cs1=32k:cs2=8M -I/share/apps/unsupported/pacx/standard/include -L/share/apps/unsupported/pacx/standard/lib #(wren)
#LD_MPI= -L/share/apps/unsupported/pacx/standard/lib -lpacxf -lpacx -lmpi #(wren)
##FC=/c/brandenb/pacx/bin/pacxfc #(tacsg2)
#FFLAGS=-64 -O3 -mips4 #(tacsg2)
#OPTFLAGS= -64
#F77=$(FC)
#CFLAGS=-O3 -64 -DFUNDERSC=1

## OSF1:
## Compaq/HP alpha
#FC=f95 #(Mhd.)
#FC=f90 #(Mhd.)
#OPTFLAGS=-fast -O5
#OPTFLAGS=-fast -O5 -notransform_loops #(Mhd.)
#FFLAGS=$(OPTFLAGS) -tune ev6 -arch ev6 #(Mhd.)
#FFLAGS=$(OPTFLAGS) -warn argument_checking -warn declarations -warn unused
#F77=$(FC)
#LIBSIG=-lsig
#LIBSIG= #(gauss)

## Linux:
##
## old OS Defaults
##
#FC=g95 -fno-second-underscore
#F77=$(FC)
#FFLAGS=-O3
#F90FLAGS=
#LD_MPI=
#CFLAGS=-O3 -DFUNDERSC=1 -Wall
#CFLAGS_FFTW3=
#FFLAGS_FFTW3=
#LD_FFTW3=
#CFLAGS_FFTW2=
#FFLAGS_FFTW2=
#LD_FFTW2=
##
##  New default settings
##
#FC=gfortran
#FFLAGS=-O3
#FFLAGS_DOUBLE=-fdefault-real-8
#F77=$(FC)
#CC=gcc
##
## Settings for individual machines
##
#FC=mpif90 #(Samos|fire)
#LD_MPI=-lfmpich -lmpich -lmpe -lpmpich -llmpe #(nw43)
#FC=/usr/lib/lam/bin/mpif95 #(Owen|Master)
#FC=g95 #(Cincinnatus|cosmo)
#F77=$(FC) #(Cincinnatus|cosmo)
#FFLAGS=-O4 -fno-second-underscore -I/usr/lib/mpich/include #(Cincinnatus)
#FFLAGS=-O4 -freal=nan -finteger=-2147483648 -fbounds-check -ftrace=full -Wall -Wno=140,141,109,112,137 -I/usr/lib/mpich/include #(cosmo)
#FFLAGS=-O4 -I/usr/include/mpi #(nl4)
#CFLAGS=-O3 -DFUNDERSC=1 #(Cincinnatus)
#CFLAGS=-O3 -DFUNDERSC=2 #(cosmo)
#LD_MPI=-L/usr/lib/mpich/lib -lmpich #(Cincinnatus|cosmo)
##FC=/home/brandenb/pacx/bin/pacxfc #PACX #(fe[0-3])
##FC=mpif77 #(fe[0-3])
#FC=mpif77 -pthread #(obelix)
#FC=/home/ajohan/bin/ifc_7.1 #(ns0)
#FC=pgf90 #(lfc101)
#FFLAGS=-I /usr/local/Packages/mpich-1.2.6/ch-p4/include #(lfc101)
#LD_MPI=-L /usr/local/Packages/mpich-1.2.6/ch-p4/lib/ -lmpich #(lfc101)
#LDFLAGS+=farg.o #(lfc101)
#FC=ifort #(nw[0-9]+|hamlet|lynx|brahe|nq[0-9]*)
#FC=g95-andy #(nw[0-9]+|hamlet|lynx|brahe|nq[0-9]*)
##
#FC=f90 #(p6012)
#F77=fort77 #(p6012)
#FFLAGS=-O3 -I/opt/ibmhpc/ppe.poe/include/thread64 #(p6012)
#LD_MPI=-L /opt/ibmhpc/ppe.poe/lib/libmpi64/ -lpoe -lmpi_ibm -L /opt/ibmhpc/lapi/lib/lapi64 -llapi  #(p6012)
#FFLAGS_DOUBLE=-qrealsize=8 #(p6012)
#FC=gfortran #(dintel)
#FFLAGS=-O3 -I /home/ajohan/local/openmpi/include/ #(dintel)
#CFLAGS=-DFUNDERSC=2 #(dintel)
#LD_MPI=-L /home/ajohan/local/openmpi/lib -lmpi -lmpi_f77 #(dintel)
#FC=ifort #(milipeia)
#FC=ifort #(swift)
#FFLAGS=-O3 -I/usr/local/mpich/include #(swift)
#LD_MPI=-L /usr/local/mpich/lib -lmpich #(swift)
#FFLAGS=-O3 -I/home/ajohan/mpich/include #(hamlet)
#LD_MPI=-L /home/ajohan/mpich/lib -lmpich #(hamlet)
#include $(PENCIL_HOME)/src/Makefile_ifort.incl #(opto[1-4]|pia*)
#FFLAGS_SLOPPY=$(FFLAGS) -I/home/johansen/mpich/include/ #(opto[1-4])
#LD_MPI=-Wl,-m elf_i386 -L/home/johansen/mpich/lib/ -lmpich #(opto[1-4])
#FC=/afs/ipp/amd64_sles9/soft/mvapich/mvapich2-0.9.8-opteron-x/f95i.9.1/bin/mpif90 #(rio*|pia*)
##FFLAGS=-convert big_endian #(rio*|pia*)
#FC=/afs/@cell/common/soft/intel/Compiler/11.1/c/bin/intel64/bin/ifort #(aims*)
#FFLAGS=-I /afs/@cell/common/soft/intel/impi/3.2.2/include/ -O3 #(aims*)
#LD_MPI=-L/afs/@cell/common/soft/intel/impi/3.2.2/lib64/ -lmpi -lmpiif #(aims*)
#FC=ifort #(eh[1-4])
#FFLAGS=-O3 -I/opt/lam-7.1.2b24-ifort/include/ #(eh[1-4])
#LD_MPI=-lltdl -L/opt/lam-7.1.2b24-ifort/lib -llamf77mpi -llammpio -lmpi -llam -lpthread #(eh[1-4])
#FC=mpif77 #(tpb[1-2])
#FFLAGS=-O3 #(tpb[1-2])
#LD_MPI= #(tpb[1-2])
#FC=g95 -O3 -fno-second-underscore #(moria|balrog|sky*|regulus)
#FFLAGS= #(moria|balrog|sky*|regulus)
#LD_MPI= #(moria|balrog|sky*|regulus)
#FC=ifc_6.0 -I/usr/local/lib/LAM/include #(fe[0-9])
#FC=/usr/local/bin/ifc -I/usr/local/lib/LAM/include #(fe[0-9])
#FC=/people/disk2/brandenb/bin/ifort -I/usr/local/lib/LAM/include #(fe[0-9])
#FC=~dobler/opt/intel/compiler70/ia32/bin/ifc -I/usr/local/lib/LAM/include #(fe[0-9])
##FC=ifort -I/usr/local/lib/LAM/include #(fe[0-9])
#FC=fort -I/usr/lib/lam/include #(mhd|metropolis)
#FC=mpif90 #(Nunatak[0-9])
##FC=/home/brandenb/pacx/bin/pacxfc #(ns0)
#FC=ifc #(nl19)
#FC=ifort -I/usr/include/lam -L/usr/lib/lam/lib #(nl19)
#FC=gfortran -I/usr/include -I. -frecord-marker=4 #(taspd209a)
#FFLAGS=-O3 -I/usr/lib/openmpi/include #(taspd209a)
#LD_MPI=-L/usr/lib/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl #(taspd209a)
#FFLAGS_DOUBLE=-fdefault-real-8 #(taspd209a)
#LIBMPISUFFIX=#(taspd209a)
#FFLAGS=-O3 -L/home/dobler/lib -lc-2.2.93 #(nw46)
#FFLAGS=-O3 -static-libcxa #(ns0|char)
#FFLAGS=-O3 -xW -vec_report0 #(obelix)
#FC=pgf90 #(sintef*|tycho|linux29|monolith)
#FC=ifort #(vmware|erland|bohm|igor|onsager|char)
#FC=ifort #(vsl21*|vsl22*|vsl230)
#FFLAGS_DOUBLE= -r8 #(vsl21*|vsl22*|vsl230)
#FC=pgf90 #(sintef*|vsl176)
#FFLAGS_DOUBLE= -r8 #(vsl176)
#FFLAGS= -O3 -I/cvos/shared/apps/mvapich/pgi/1.2rc2/include/ #(vsl176)
#FFLAGS= -O4 -Munroll -Mvect=prefetch -I/cvos/shared/apps/mvapich/pgi/1.2rc2/include/ #(vsl176)
##FFLAGS= -O0 -C -Mbounds -Mdwarf2 -Melf  -I/cvos/shared/apps/mvapich/pgi/1.2rc2/include/ #(vsl176)
##FFLAGS= -O3 -I/cvos/shared/apps/mvapich/pgi/1.2rc2/include/ -Mrecursive #(vsl176)
#LD_MPI= -L/cvos/shared/apps/mvapich/pgi/1.2rc2/lib -lmpich -L/cvos/shared/apps/ofed/1.3.1/lib64/ -libumad -libverbs -lrdmacm #(vsl176) 
#FC=gfortran -I. #(vsl174)
##FFLAGS=-O3 -I/home/arnelohr/mpich2/include #(vsl174)
#FFLAGS= -I/home/arnelohr/mpich2/include #(vsl174)
#FFLAGS_DOUBLE=-fdefault-real-8 #(vsl174)
#LD_MPI=-L/home/arnelohr/mpich2/lib -lfmpich -lmpich -pthread #(vsl174)
#FC=gfortran -I. #(copernicus)
#FFLAGS= -O3 -I/usr/local/include #(copernicus)
#FFLAGS_DOUBLE=-fdefault-real-8 #(copernicus)
##LD_MPI=-L/usr/local/lib -lfmpich -lmpich -pthread #(copernicus)
#FC=ifort  #(co-login)
#LD_MPI=-lmpi  #(co-login)
##FC=pgf90 #(erland|bohm|igor|onsager)
#FC=efc #(user0[1-9])
#FC=efc #(srif-sb12-hpc-prod)
#FCCLEANER=2>&1 | scripts/cleanf95 #(srif-sb12-hpc-prod)
#FFLAGS= #(srif-sb12-hpc-prod)
#FFLAGS=-align -ipo -O2 #(srif-sb12-hpc-prod)
#LD_MPI=-lmpi #(srif-sb12-hpc-prod)
#FC=lf95 #(pcponty)
#FFLAGS=-O # (Samos)
#FFLAGS= -fast -lm # (fire)
#FFLAGS= -fast -O5 -notransform_loops -tune ev6 -arch ev6 #(mhd)
#FFLAGS= -fast -O5 -notransform_loops -tune ev67 -arch ev67 #(metropolis)
##AB: next line uncommented on Tobi's advice
#LD_MPI=-static -L/usr/local/lib/LAM/lib -llamf77mpi -lmpi -llam -lnsl -lutil -pthread #(fe[0-4])
#LD_MPI=-static -L/opt/lam/lib -lmpi -llamf77mpi -llam #(nw50)
#LD_MPI=-L/home/ajohan/f90/lib -llamf77mpi -lmpi -llam #(ns0|nq[0-9]*|nw[0-9]+)
#LD_MPI=-Wl,-m elf_i386 -L/home/ajohan/f90/lib -llamf77mpi -lmpi -llam #(lynx)
#LD_MPI=-lmpi #(brahe)
##FFLAGS=-O3 -ipo #PACX #(fe[0-3])
#FFLAGS= -C -g -Mbounds -Mchkfpstk -Mchkptr -Mchkstk -Mcoff -Mdwarf1 -Mdwarf2 -Melf  -Mstabs -lm #(sintef*)
#FFLAGS= -C -Mbounds -Mchkfpstk -Mchkptr -Mchkstk -Mcoff -Mdwarf1 -Mdwarf2 -Melf  -Mstabs -lm #(sintef*)
##FFLAGS= #(vmware|erland|bohm|igor|onsager)
#FFLAGS= -I./ -D_REENTRANT -I/opt/scali/include #(vsl21*|vsl22*|vsl230)
#LD_MPI= -L/opt/scali/lib -lfmpi -lmpi -lpthread #(vsl21*|vsl22*|vsl230)
#FFLAGS= -fast -lm#(erland|bohm|igor|onsager)
#FFLAGS= -fast -lm -Nscampi   #(monolith)
#FFLAGS= #(fe[0-4])  ##(compiles faster/axel)
#FFLAGS=-O4 -C -gline -Wc,-malign-double #(Mephisto|Aladdin)
#FFLAGS=-O4 #(nl3)
#FFLAGS=-i_dynamic -O3 #(nw[0-9]+|nl11|sandin|lynx)
#FFLAGS=-O3  #(nw[0-9]+|nl11|sandin|lynx)
#FCCLEANER=2>&1 | scripts/cleanf95 #(obelix)
#FFLAGS= #(davey[12])
#FC=ifc -i_dynamic -I/usr/lib/lam/include #(nw17|nl11)
#FC=ifc -I/usr/lib/lam/include #(nw17|nl11)
#FC=ifc -w95 #(sandin)
#FC=f95 -dusty #(davey[12])
#FC=ifc -I/usr/lib/lam/include -i_dynamic #(sandin|nl11)
#CC=mpicc #(obelix)
#FC=ifort -stand f90 #(Kolmogorov)
#FFLAGS=-O3 #(Kolmogorov)
##CC=gcc #(Kolmogorov)
##CFLAGS=-O3 -DFUNDERSC=1 #(Kolmogorov)
#CFLAGS=-O3 -DFUNDERSC=2 #(Kepler)
#LD_MPI=-I/usr/include -pthread -llammpio -llamf77mpi -lmpi -llam -lutil #(Kolmogorov)
#LD_MPI=-I/usr/include -pthread -L/usr/lib64 -llammpio -llamf77mpi -lmpi -llam -laio -laio -lutil #(Kepler)
#FC=g95 -fsecond-underscore #(Kolmogorov|Kepler)
#LIBMPISUFFIX=_#(Kolmogorov)
#FC=g95 -fsecond-underscore #(Pencil|Einy)
#FFLAGS=-I/usr/include/lam -pthread -O3 #(Pencil|Einy)
#CFLAGS=-O3 -DFUNDERSC=2 #(Pencil|Einy)
#LD_MPI=-L/usr/lib/lam/lib -llammpio -llamf77mpi -lmpi -llam -lutil -ldl -pthread #(Pencil|Einy)
#LD_MPI=-L/usr/lib/lam/lib -llammpio -lpmpi -llamf77mpi -lmpi -llam -lnsl -lutil #(nw17|nl11)
#LD_MPI=-L/opt/mpich/lib #(nw43)
#LD_MPI=-L/usr/local/mpich/lib #(pcponty)
#LD_MPI= # (Samos|fire|sandin)
#LD_MPI=-L/usr/lib/lam/lib -llam -lmpi -llamf77mpi -llammpi++ -llammpio -lnsl -lutil #(mhd|metropolis)
#CFLAGS=-O3 -DFUNDERSC=1 -Wall -m32 #(lynx|opto[1-4])
#CFLAGS=-DFUNDERSC=1 #(obelix)
#CFLAGS=-O3 -DFUNDERSC=2 -Wall #(mhd|metropolis)
#F77=$(FC) -dusty #(nl3|Mephisto|Aladdin)
#F77=$(FC) -lm  #(tycho|monolith)
#F77=$(FC) #(sintef*|vmware|erland|bohm|igor|onsager|vsl21*|vsl22*|vsl230|vsl174|vsl176)
#F77=$(FC) #(Owen|Master|nw17|nl11)
#F77FLAGS=-w90 #(nw[0-9]+|ns0|nw17|nl11|sandin)
#FC=ifort #(lws.Stanford.EDU|lws2.Stanford.EDU)
#F77=$(FC) #(lws.Stanford.EDU|lws2.Stanford.EDU)
#FFLAGS=-O3 -ipo #(lws.Stanford.EDU|lws2.Stanford.EDU)
#LD_MPI=-lmpi #(lws.Stanford.EDU|lws2.Stanford.EDU)
#CC=icc #(lws.Stanford.EDU|lws2.Stanford.EDU)
#CFLAGS=-O3 -ipo -DFUNDERSC=1 #(lws.Stanford.EDU|lws2.Stanford.EDU)
#FC=ifort #(damtp)
#FFLAGS=  #(damtp)
#CFLAGS=-O3  -DFUNDERSC=1 #(damtp)
#LD_MPI=-I/usr/include -pthread  -llamf77mpi -lmpi -llam -lutil #(damtp)
##
## Freiburg:
##
#FC=mpif90 #(damaskus|n00)
#FFLAGS=-xT -ipo -O3 #(damaskus|n00)
#FC=mpif90 #(ui.bfg.uni-freiburg.de)
#FFLAGS=-O3 #(ui.bfg.uni-freiburg.de)
#FFLAGS_DOUBLE=-r8 #(ui.bfg.uni-freiburg.de)
#FC=mpif90 #(bwui|bwui.bfg.uni-freiburg.de)
#FFLAGS=-xT -ipo -O3 #(bwui|bwui.bfg.uni-freiburg.de)
#FFLAGS_DOUBLE=-r8 #(bwui|bwui.bfg.uni-freiburg.de)
##
## FZ Juelich:
##
#FC=mpif90 #(juropa|jj28l0[1-8]|juropa.fz-juelich.de)
#FFLAGS=-xsse4.2 -axsse4.2 -ipo -O3 #(juropa|jj28l0[1-8]|juropa.fz-juelich.de)
#FFLAGS_DOUBLE=-r8 #(juropa|jj28l0[1-8]|juropa.fz-juelich.de)
##For single processor runs on the JUGENE frontend:
##FC=xlf95_r -I/bgsys/drivers/ppcfloor/comm/include #(genius1|jugene[3-4])
##CC=xlc_r -I/bgsys/drivers/ppcfloor/comm/include #(genius1|jugene[3-4])
##For MPI runs on the JUGENE work nodes:
#FC=mpixlf95_r -I/bgsys/drivers/ppcfloor/comm/include #(genius1|jugene[3-4])
#CC=mpixlc_r -I/bgsys/drivers/ppcfloor/comm/include #(genius1|jugene[3-4])
#F77=xlf_r #(genius1|jugene[3-4])
##FFLAGS=-C -g -qsigtrap -O3 #(genius1|jugene[3-4])
#FFLAGS=-O3 #(genius1|jugene[3-4])
#CFLAGS=-O3 #(genius1|jugene[3-4])
#FFLAGS_DOUBLE=-qrealsize=8 #(genius1|jugene[3-4])
#CFLAGS_DOUBLE=-qrealsize=8 #(genius1|jugene[3-4])
##
## Toulouse's machines: efigi, galileo, mithra, & pcgastine
##
#include $(PENCIL_HOME)/src/Makefile_ifort.incl #(efigi|mithra|galileo|pcgastine)
#FFLAGS=-O3 -stand f90 -I/usr/include/lam #(galileo)
#FFLAGS=-O3 -xT  #(mithra)
#FFLAGS=-O3 -xP -I/usr/include/openmpi/1.2.4-gcc -I/usr/include/openmpi/1.2.4-gcc/32#(pcgastine)
#FFLAGS=-O3 -stand f90 -I/home/dintrans/LIB/LAM/include -assume nounderscore #(efigi)
#CC=gcc #(efigi)
#CFLAGS=-O3 -m32 #(efigi|mithra|pcgastine)
#LD_MPI=-L/usr/lib/openmpi -lmpi -lmpi_f77 #(mithra)
#LD_MPI=-L/usr/lib/openmpi/1.2.4-gcc -lmpi -lmpi_f77 #(pcgastine)
#LD_MPI=-pthread -L/home/dintrans/LIB/LAM/lib -llammpio -llamf77mpi -lmpi -llam -lutil -ldl #(efigi)
#LIBMPISUFFIX=_#(efigi)
##
## Axel on Lucidor, h05n35 (ifc 8.1)
##
#FC=mpif90 #(h05n35.*)
#FFLAGS=-O3 #(h05n35.*)
#CC=mpicc #(h05n35.*)
#CFLAGS=-O3 -DFUNDERSC=1 #(h05n35.*)
#LD_MPI= #(h05n35.*)
##
## Axel on Lenngren, d14n36 (ifc 9.1)
## module add i-compilers/latest scampi
## /pdc/vol/i-fce/9.1.039/bin/ifort
##
#FC=ifort #(d14n36.*)
#FFLAGS=-pthread -I/opt/scali/include -no-cpprt #(d14n36.*)
#CC=gcc #(d14n36.*)
#CFLAGS=-DFUNDERSC=1 #(d14n36.*)
#LD_MPI=-pthread -L/opt/scali/lib64 -lfmpi -lmpi #(d14n36.*)
##
## Axel on Horseshoe (ifc 9.0)
##
#FC=~brandenb/apps/intel/fc/9.0/bin/ifort #(fe[0-9])
#FFLAGS=-I/usr/local/lib/LAM/include -O3 -assume 2underscores #(fe[0-4])
#CC=~brandenb/apps/intel/cc/9.0/bin/icc #(fe[0-9])
#CFLAGS=-O3 -DFUNDERSC=2 #(fe[0-4])
#LD_MPI=-pthread -L/usr/local/lib/LAM/lib -llammpio -llamf77mpi -lmpi -llam -lutil #(fe[0-4])
##
## Axel on Horseshoe (ifc 7.1)
##
#FC=~dobler/opt/intel/compiler70/ia32/bin/ifc #(fe[0-9])
#FFLAGS=-I/usr/local/lib/LAM/include -O3 #(fe[0-4])
#CC=icc #(fe[0-9])
#CFLAGS=-O3 -DFUNDERSC=1 #(fe[0-9])
#LD_MPI=-static -L/usr/local/lib/LAM/lib -llamf77mpi -lmpi -llam -lnsl -lutil -pthread #(fe[0-4])
#LIBMPISUFFIX=_#(fe[0-4])
##
## Axel on Monolith (ifc 7.1)
##
#FC=ifort #(login-1.monolith.nsc.liu.se)
#FC=ifc #(login-1.monolith.nsc.liu.se)
#FFLAGS=-O3 -Nscampi#(login-1.monolith.nsc.liu.se)
#CC=icc #(login-1.monolith.nsc.liu.se)
#CFLAGS=-O3 -DFUNDERSC=1 #(login-1.monolith.nsc.liu.se)
#LD_MPI=-Nscampi #(login-1.monolith.nsc.liu.se)
#LD_MPI=-L/opt/scali/lib -lfmpi -lmpi -lpthread #(login-1.monolith.nsc.liu.se)
##LIBMPISUFFIX=_#(login-1.monolith.nsc.liu.se)
##
## Axel on Neolith (ifc 7.1)
##
#FC=ifort #(neolith)
#FFLAGS=-g -Nmpi -L/home/x_axebr/library/lib #(neolith)
#FFLAGS_DOUBLE = -r8 #(neolith)
#CC=icc #(neolith)
#CFLAGS=-O3 -DFUNDERSC=1 -I/home/x_axebr/library/include -L/home/x_axebr/library/lib #(neolith)
#LD_MPI=-Nscampi #(neolith)
#LD_MPI=-L/opt/scali/lib -lfmpi -lmpi -lpthread #(neolith)
##LIBMPISUFFIX=_#(neolith)
##
## Axel on Hexagon (ftn using pgf90)
##
#FC=ftn #(nid00*)
#FFLAGS= #(nid00*)
#FFLAGS_DOUBLE=-r8 #(nid00*)
#CC=cc #(nid00*)
#CFLAGS=-O3 -DFUNDERSC=1 #(nid00*)
#LD_MPI= #(nid00*)
##
## Axel on Sanssouci (ifc 9.1)
##
#FC=mpif90 #(sanssouci|belvedere|octopus)
#FFLAGS= -O3 -xW -mp -vec_report0 #(sanssouci|belvedere|octopus)
#CC=mpicc #(sanssouci|belvedere|octopus)
#CFLAGS=-O3 -DFUNDERSC=1 #(sanssouci|belvedere|octopus)
#LD_MPI= #(sanssouci|belvedere|octopus)
#LIBMPISUFFIX=#(sanssouci|belvedere|octopus)
##
## Axel's laptop (nl6, 2.0 GHz)
##
##FC=g95 -fsecond-underscore#(nl6)
##FC=g95 -fno-second-underscore -freal=nan -finteger=-2147483648 -fbounds-check #(nl6)
##FFLAGS=-O4  -I/home/brandenb/library/include/gsl-1.9/include/ -L/home/brandenb/library/include/gsl-1.9/ #(nl6)
##LD_MPI=#(nl6)
##CFLAGS=-DFUNDERSC=1 #(nl6)
##FFLAGS_DOUBLE = -r8 #(nl6)
##
##  Axel's laptop (nl6, 2.0 GHz)
##  the -CB options checks for out of bounds arrays
##
#FC=ifort #(nl6)
#FFLAGS=-O3 -I/usr/lib/openmpi/include -CB #(nl6)
#FFLAGS=-O3 -I/usr/lib/openmpi/include #(nl6)
#FFLAGS=-O3 -I/usr/lib/openmpi/include -L/usr/lib#(nl6)
#FFLAGS=-O1  -I/usr/lib/openmpi/include -I/home/brandenb/library/include/gsl-1.9/include/ -L/home/brandenb/library/include/gsl-1.9/lib/ #(nl6)
#LD_MPI=-L/usr/lib/openmpi/lib -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl #(nl6)
#CC=icc #(nl6)
#CFLAGS=-O3 -DFUNDERSC=1 #(nl6)
#FFLAGS_DOUBLE=-autodouble #(nl6)
##include $(PENCIL_HOME)/src/Makefile_ifort.incl #(nl6)
##
## Axel on norlx55 (gfortran)
##
#FC=mpif90 #(norlx55*)
#FFLAGS= -O3 #(norlx55*)
#CC=mpicc #(norlx55*)
#CFLAGS=-O3 #(norlx55*)
#LD_MPI= #(norlx55*)
#LIBMPISUFFIX= #(norlx55*)
##
## Axel on fe03 (ifc 8.1)
##
#FC=mpif90 #(fe03*)
#FFLAGS= -O3 #(fe03*)
#CC=mpicc #(fe03*)
#CFLAGS=-O3 #(fe03*)
#LD_MPI= #(fe03*)
#LIBMPISUFFIX= #(fe03*)
#
#FC=ifort #(fe03*)
#CC=gcc #(fe03*)
#FFLAGS=-O3 #(fe03*)
#CFLAGS=-O3 -DFUNDERSC=1 #(fe03*)
#LD_MPI=-lfmpich -lmpich -lmpe -lpmpich -llmpe #(fe03*)
#LIBMPISUFFIX=_#(fe03*)
#
#FC=ifort #(fe03*)
#CC=gcc #(fe03*)
#FFLAGS=-O3 #(fe03*)
#CFLAGS=-O3 -DFUNDERSC=1 #(fe03*)
#LD_MPI=-Wl,-rpath -Wl,/usr/lib -Wl,-rpath -Wl,/opt/shared/intel_fc_81/lib -L/usr/lib farg.o -lmpichfarg -lmpich -lpthread -lrt  #(fe03*)
#LIBMPISUFFIX=_#(fe03*)
##
##  norlx01 Nordita computer
##
#FC=g95 -fno-second-underscore #(norlx01)
#FFLAGS= -freal=nan -finteger=-2147483648 -fbounds-check ftrace=full -Wall -Wno=140,141,109,112,137 -Werror#(norlx01)
#FFLAGS= -freal=nan -finteger=-2147483648 -fbounds-check -Wall -Wno=140,141,109,112,137 -Werror#(norlx01)
#LD_MPI=#(norlx01)
##
##  norlx50 Nordita computer
##
##FC=g95 -fno-second-underscore -std=f95 #(norlx50)
##FFLAGS_DOUBLE= -r8 #(norlx50)
##FFLAGS= #(norlx50)
##F90FLAGS=-I/usr/lib/openmpi/include -freal=nan -finteger=-2147483648 -fbounds-check ftrace=full -Wall -Wno=140,141,109,112,137 -Werror#(norlx50)
##F90FLAGS=-I/usr/lib/openmpi/include -O1 -g -O1 -g -freal=nan -finteger=-2147483648 -fbounds-check -ftrace=full -Wall -Wno=140,141,109,112,137 -Werror#(norlx50)
##F77=g95 #(norlx50)
##F77FLAGS= #(norlx50)
##LD_MPI=#(norlx50)
##
##  norlx51 Nordita computer
##
#FC=g95 -fno-second-underscore #(norlx51)
#F90FLAGS= -freal=nan -finteger=-2147483648 -fbounds-check ftrace=full -Wall -Wno=140,141,109,112,137 -Werror#(norlx51)
#F90FLAGS= -freal=nan -finteger=-2147483648 -fbounds-check -Wall -Wno=140,141,109,112,137 -Werror#(norlx51)
#F77=g95 #(norlx51)
#F77FLAGS= #(norlx51)
#LD_MPI= -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl #(norlx51)
##
##  More stringent settings for auto-testing
##
#FC=g95 -fno-second-underscore -std=f95 -I/usr/lib/openmpi/include #(norlx51)
#F77=$(FC) #(norlx51)
#FFLAGS=-O1 -g #(norlx51)
#FFLAGS_SLOPPY=-O1 -g -freal=nan -finteger=-2147483648 -fbounds-check -ftrace=full -Wall -Wno=140,141,109,112,137#(norlx51)
#F90FLAGS=$(FFLAGS_SLOPPY) -Werror#(norlx51)
#F77FLAGS=$(FFLAGS_SLOPPY)#(norlx51)
#FFLAGS_DOUBLE=-r8#(norlx51)
#LIBMPISUFFIX=#(norlx51)
#CC=gcc#(norlx51)
#CFLAGS=-O3 -Wall -DFUNDERSC=1#(norlx51)
#LD_MPI=-L/usr/lib/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl#(norlx51)
#FFLAGS_DOUBLE=-r8#(norlx51)
##
##  Buenos Aires
##
#FC=mpif90 #(caps.iafe.uba.ar)
#FFLAGS= -O3 #(caps.iafe.uba.ar)
#CC=mpicc #(caps.iafe.uba.ar)
#CFLAGS=-O3 -DFUNDERSC=1 #(caps.iafe.uba.ar)
#LD_MPI= #(caps.iafe.uba.ar)
#LIBMPISUFFIX=#(caps.iafe.uba.ar)
##
##  Piyali's laptop
##
##FC=/usr/bin/gfortran -I/usr/local/lib #(saveri)
#FC=/usr/local/bin/mpif90 -I/usr/local/include/ #(saveri)
#F77=$(FC) #(saveri*)
#CC=gcc #(saveri*)
#FFLAGS=-O3 #(saveri*)
#FFLAGS_DOUBLE=-fdefault-real-8  #(saveri*)
##LD_MPI= #(saveri*)
#LD_MPI=-L/usr/local/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl #(saveri*)
##
##  Pencil-Code Servers
##
##FC=/usr/bin/gfortran -I/usr/lib/openmpi/include #(norlx5*)
##F77=$(FC) #(norlx5*)
##CC=gcc #(norlx5*)
##FFLAGS=-O3 #(norlx5*)
##FFLAGS_DOUBLE=-fdefault-real-8  #(norlx5*)
##LD_MPI=-L/usr/lib/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl #(norlx5*)
##
##  Koen's laptop
##
#FC=/usr/bin/gfortran -I/usr/lib/openmpi/include #(koen-linux*)
#F77=$(FC) #(koen-linux*)
#CC=gcc #(koen-linux*)
#FFLAGS=-O3 #(koen-linux*)
#FFLAGS_DOUBLE=-fdefault-real-8  #(koen-linux*)
##LD_MPI=-L/usr/lib/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl #(koen-linux*)
##
## Ferlin using openmpi (ferlin)
##
#FC=mpif90 #(a07c01n08.pdc.kth.se)
#CC=mpicc #(a07c01n08.pdc.kth.se)
#FFLAGS=-O3 -vec-report0 #(a07c01n08.pdc.kth.se)
#LD_MPI= #(a07c01n08.pdc.kth.se)
#FFLAGS_DOUBLE=-r8 #(a07c01n08.pdc.kth.se)
##
##  Simon's laptop
##
#FC=/usr/bin/gfortran-4.3 #(iomsn-laptop)
#F77=$(FC) #(iomsn-laptop)
#CC=gcc #(iomsn-laptop)
#FFLAGS_SLOPPY=$(FFLAGS) -I/usr/lib/openmpi/include #(iomsn-laptop)
#CFLAGS=-O3 -DFUNDERSC=1 #(iomsn-laptop)
#LD_MPI=-L/usr/lib/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl #(iomsn-laptop)
##
##  Patrik's playstation
##
#FC=/usr/bin/gfortran #(playstation-desktop)
#F77=$(FC) #(playstation-desktop)
#CC=gcc #(playstation-desktop)
#FFLAGS=-O3 #(playstation-desktop)
##
## Natalia's laptop (Natalia, 1.8 GHz)
##
#FC=ifort #(naiad|sky1)
#FFLAGS=-O3 #(naiad|sky1)
#FFLAGS_DOUBLE = -r8 #(naiad|sky1)
#include $(PENCIL_HOME)/src/Makefile_ifort.incl #(naiad|sky1|pchelka)
#FC=ifort #(hikari)
##FC=ifort #(pchelka)
##FFLAGS=-g -O0 #(pchelka)
##FC=ifort -fexceptions -fp-stack-check -fstack-security-check -ftrapuv  #(pchelka)
##FC=ifort -CB -WB -check all -g #(pchelka)
##FC=g95 -finteger=-2147483648 -fexceptions #(pchelka|naiad)
#FC=g95  #(pchelka)
##
## rockall (ngrs's current laptop)
##
##FC=g95 -fno-second-underscore #(rockall)
#FC=gfortran #(rockall)
##FFLAGS=-O3 -I/usr/lib/lam/include -frecord-marker=4 #(rockall)
#FFLAGS=-O3 -I/usr/lib/openmpi/include #(rockall)
#FFLAGS_DOUBLE= -fdefault-real-8 #(rockall)
##LD_MPI=-L/usr/lib/lam/lib -pthread -llammpio -llamf77mpi -lmpi -llam -llammpi++ #(rockall)
#LD_MPI=-L/usr/lib/openmpi/lib -pthread -lmpi -lmpi_f77 -lmpi_f90 -lmpi_cxx -lopen-rte -lopen-pal -lmca_common_sm #(rockall)
##F77FLAGS=-w90 #(rockall)
#LIBMPISUFFIX=_#(rockall) 
##
## valdivia (grsarson's desktop)
##
#FC=ifort #(valdivia)
#FFLAGS=-O3 -I/usr/lib/openmpi/include #(valdivia)
#FFLAGS_DOUBLE= #(valdivia)
#LD_MPI=-L/usr/lib/openmpi/lib -pthread -lmpi -lmpi_f77 -lmpi_f90 -lmpi_cxx -lopen-rte -lopen-pal -lmca_common_sm #(valdivia)
#F77FLAGS=-w90 #(valdivia)
#LIBMPISUFFIX=_#(valdivia)
##
## renton & morvern (ngrs's older desktop & laptop)
##
#FC=ifort #(renton|morvern)
#FFLAGS=-O3 -I/usr/lib/lam/include #(renton|morvern)
#LD_MPI=-L/usr/lib/lam/lib -llammpio -llamf77mpi -lmpi -llam -lutil #(renton|morvern)
#F77FLAGS=-w90 #(renton|morvern)
#LIBMPISUFFIX=_#(renton|morvern)
##
## barilko Apichat Neamvonk's desktop
##
#FC=ifort #(barilko)
#FFLAGS=-O3 -I/usr/local/lib/idl/lam/include #(barilko)
#LD_MPI=-I/usr/local/lib/idl/lam/include -L/usr/local/lib/idl/lam/lib -llammpio -llamf77mpi -lmpi -llam -lutil #(barilko)
#F77FLAGS=-w90 #(barilko)
##
## wormhole Tony's Laptop
##
#MAKEOPTS=-j 3 #(wormhole)
#FFLAGS=-CA -CV -CS -CB -tpp7 -vec_report0 #(wormhole)
#FFLAGS=-O2 -align -tpp7 -vec_report0 #(wormhole)
#FFLAGS=-O2 -mp -vec_report0 #(wormhole)
#FFLAGS=-O3 -ipo0  #(wormhole)
#FCCLEANER=2>&1 | scripts/cleanf95 #(wormhole)
#FC=ifc -i_dynamic -I/usr/lib/lam/include #(wormhole)
#FC=ifort #(wormhole)
##FC=gfortran-4.1.1 -I/usr/include #(wormhole)
#LD_MPI= #(wormhole)
#LIBMPISUFFIX=_#(wormhole)
##LD_MPI=-llammpio -lmpi -llamf77mpi -lmpi -llam -lnsl -lutil -lpthread #(wormhole)
##LD_MPI=-I/usr/include -pthread -llammpio -llamf77mpi -lmpi -llam -lutil -ldl #(wormhole)
#LD_MPI=-I/usr/include -pthread -llammpio -llamf77mpi -lmpi -llam -lutil -ldl #(wormhole)
#F77=$(FC) #(wormhole)
#F77FLAGS=-w90 #(wormhole)
##
## chimay abag's laptop
##
#FC=g95 #(chimay)
#FFLAGS=-O3 #(chimay)
##
##maurice Newcastle machine
##
#FC=gfortran -I/usr/lib/openmpi/lib -pthread -I/usr/lib/openmpi/lib -L/usr/lib/ openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-  dynamic -lnsl -lutil -lm -ldl  -I/usr/lib/openmpi/include #(maurice)
#FFLAGS=-O3 #(maurice)
##
## starlink Newcastle's general access machine
##
#FC=ifort -static -I/usr/local/lib/idl/lam/include #(starlink)
#LD_MpI=-L/usr/local/lib/idl/lam/lib -llammpio -lmpi -llamf77mpi -lmpi -llam -lnsl -lutil -lpthread #(starlink)
#LIBMPISUFFIX=_#(starlink)
#MAKEOPTS=-j 3 #(starlink)
##
##   Triton - Wlad's laptop
##
##FC = /opt/intel/Compiler/11.1/069/bin/ia32/ifort#(triton)
##FFLAGS=-O3 -I /usr/include/mpich2#(triton)
##LD_MPI=-L /usr/lib -pthread $(MPI_LDLIBS) #(triton)
##MPI_LDLIBS= -lmpich #(triton)
##FFLAGS_DOUBLE = -r8 #(triton)
##CFLAGS_DOUBLE = -DDOUBLE_PRECISION #(triton)
## gfortran
#FFLAGS=-O3 -fbounds-check -Wall -Wsurprising -I /usr/include/mpich2#(triton)
## general
#LD_MPI=-L /usr/lib -pthread $(MPI_LDLIBS) #(triton)
#MPI_LDLIBS= -lmpich #(triton)
#CFLAGS_DOUBLE = -DDOUBLE_PRECISION #(triton)
##
##  Aida workstations at MPIA-Heidelberg
##
#F77=$(FC) #(aida*)
#CC = gcc #(aida*)
#MPI_HOME=/usr/local/misc/mpich/mpich2-1.0.8p1-exe#(aida*)
#FFLAGS=-O3 -I$(MPI_HOME)/include #(aida*)
#LD_MPI=-L$(MPI_HOME)/lib -pthread $(MPI_LDLIBS) #(aida*)
#MPI_LDLIBS= -lmpich #(aida*)
##
## Andrew's Laptop (wkfg)
##
#FC=mpif90 #(wkfg)
#FFLAGS=-O2 -frecord-marker=4 -mtune=athlon-4 #(wkfg)
#FFLAGS_DOUBLE= -fdefault-real-8 #(wkfg)
##
## clx IBM Linux Cluster, Bologna IT
##
#LD_MPI=    #(node[0-9]+)
#FC=mpif90 # (node[0-9]+)
#CC=mpicc  # (node[0-9]+)
#FFLAGS=-fast -Mvect=sse -Mipa -Minline  # (node[0-9]+)
#FFLAGS=-fast -tp p7 -fastsse -Mvect=sse -O2 # (node[0-9]+)
##
## giga[0-9] Newcastle eScience (tony,dave,graeme)
##
#MAKEOPTS=-j 3 #(giga[0-9]*)
#FC=mpif90 -static #(giga[0-9]*)
##FC=gfortran_4win -static -I/addon/shared/lam/include #(giga01)
##CC=gcc_4win -static -I/addon/shared/lam/include #(giga01)
#FCCLEANER=2>&1 | scripts/cleanf95 #(giga[0-9]*)
#FCCLEANER=  #(giga01)
#FFLAGS=-O0 -CA -CB -CS -CV #(giga[0-9]*)
#FFLAGS=-O2 -ipo -tpp7 -vec_report0 #(giga[0-9]*)
#FFLAGS=-C -tpp7 -vec_report0  #(giga[0-9]*)
#FFLAGS=-O2 -mp -vec_report0 #(giga[0-9]*)
#LD_MPI= #(giga[0-9]*)
##
## St. Andrews Copson Cluster (tony,dave,graeme)
## copson.st-and.ac.uk
##
#FC=mpif90 # (copson)
#FFLAGS=-gm -fast -Mvect=sse -Mipa -Minline # (copson)
#FFLAGS=-gm -fast -tp p7 -fastsse -Mvect=sse -O2 -Minline # (copson)
#FFLAGS=-gm -fast -tp p7 -fastsse -Mvect=sse -O2 # (copson)
#LD_MPI= # (copson)
##
#FC=ifc #(gwdu102)
#FFLAGS=-O3 -I/opt/scali/include #(gwdu102)
#LD_MPI=-L/opt/scali/lib -lmpi -lfmpi #(gwdu102)
##
## draco in oulu
## (for some reason this machine interpretes also ra[],
## so we have to keep this entry just blow that one.)
##
#FC=ifort #(draco.oulu.fi)
#CC=gcc #(draco.oulu.fi)
##
## CSC cluster - (Espoo, Finland)
## www.csc.fi
##
#FC=mpif90 #(sepeli)
#F90=$(FC) #(sepeli)
#CC=mpicc #(sepeli)
#FFLAGS=-O2 #(sepeli)
#CFLAGS=-DFUNDERSC=1 -O3 #(sepeli)
#LD_MPI= #(sepeli)
##
## CSC cluster Murska - (Espoo, Finland)
## www.csc.fi
##
#FC=mpif90 #(c[0-9][0-9]*)
#F90=$(FC) #(c[0-9][0-9]*)
#CC=mpicc #(c[0-9][0-9]*)
##FFLAGS=-O2 -Mrecursive -mcmodel=medium #(c[0-9][0-9]*)
#FFLAGS=-O2 -Mrecursive #(c[0-9][0-9]*)
#CFLAGS=-DFUNDERSC=1 -O3 #(c[0-9][0-9]*)
#LD_MPI= #(c[0-9][0-9]*)
#FFLAGS_DOUBLE=-r8 #(c[0-9][0-9]*)
##
## Uppmax cluster - (Uppsala)
## www.uppmax.uu.se/systems/ra
##
#FC=/opt/openmpi/1.2.5gcc/bin/mpif90 #(is[0-9]+)
#CC=mpicc    #(is[0-9]+)
#FFLAGS=-O3  #(is[0-9]+)
#CFLAGS=-DFUNDERSC=1 #(is[0-9]+)
#MPI_HOME=/opt/openmpi/1.2.5gcc#(is[0-9]+)
#LD_MPI=-I$(MPI_HOME)/include -L$(MPI_HOME)/lib -lmpi -lmpi_f90 #(is[0-9]+)
##
## RA cluster at uppmax 
## www.uppmax.uu.se/systems/ra/ra-cluster
##
#FC=mpif90 #(ra[1-99]*)
#CC=mpicc  #(ra[1-99]*)
#FFLAGS=-O3 #(ra[0-99]*)
#CFLAGS=-DFUNDERSC=1 #(ra[0-99]*)
#LD_MPI=#(ra[0-99]*)
##
## DCSC cluster - (Copenhagen, not Odense!)
## www.dcsc.ku.dk
#FC=pgf90 #(fend0[1-3])
#CC=pgcc #(fend0[1-3])
#FFLAGS=-fastsse -tp k8-64e -I/usr/local/topspin/mpi/mpich/include #(fend0[1-3])
#CFLAGS=-fastsse -tp k8-64e -DFUNDERSC=1 #(fend0[1-3])
#LD_MPI=-L/usr/local/topspin/mpi/mpich/lib64 -lmpich -lpthread -lmpich_p #(fend0[1-3])
##
## CETUS cluster - (IUCAA)
## http://meghnad.iucaa.ernet.in/~hpc/
##
#FC=mpif90 #(n0)
#CC=mpicc #(n0)
#FFLAGS=-O3 -Mrecursive #(n0)
#CFLAGS=-DFUNDERSC=1 #(n0)
#LD_MPI=#(n0)
##
## Altix clusters at DCSC (brahe) and Columbia (cfe2)
##
#FC=ifort #(brahe|cfe2)
#CC=icc #(brahe|cfe2)
#FFLAGS=-O3 -ip -mp1 #(brahe|cfe2)
#CFLAGS=-O3 -ip -mp1 -DFUNDERSC=1 #(brahe|cfe2)
#FFLAGS_DOUBLE=-autodouble #(brahe|cfe2)
#LD_MPI=-lmpi #(brahe|cfe2)
##
## NASA Pleiades system (pfe)
##
#FC=ifort #(pfe?)
#CC=icc #(pfe?)
#FFLAGS=-O3 -axT -ip -mp1 -w -vec-report0 #(pfe?)
#CFLAGS=-O3 -axT -ip -mp1 -w -vec-report0 -DFUNDERSC=1 #(pfe?)
#FFLAGS_DOUBLE=-autodouble #(pfe?)
#LD_MPI=-lmpi #(pfe?)
##
## Toulouse's machines: 
## Opteron cluster (116+320 cores) + Altix 3700 (256 cores)
##
#FC=ifort #(frontale-pastel*|soleil1)
#FC=mpif90 #(borde*)
#FFLAGS=-O3 -I/usr/local/openmpi/include #(frontale-pastel*)
#FFLAGS=-O3 #(soleil1|borde*)
#LD_MPI= -L/usr/local/openmpi/lib -lmpi #(frontale-pastel*)
#LD_MPI= -lmpi #(soleil1)
##
## Dhruba on maths.qmul cluster
##
#FC=/home/dhruba/mpich/bin/mpif90 -f90=/home/dhruba/bin/g95 -fno-second-underscore  #(cluster.maths.qmul.ac.uk)
#FFLAGS=  -O3 -I/home/dhruba/mpich/include/ #(cluster.maths.qmul.ac.uk)
#CC=/home/dhruba/mpich/bin/mpicc #(cluster.maths.qmul.ac.uk)
#LD_MPI = -lmpich #(cluster.maths.qmul.ac.uk) 
##
## Dhruba on hyades.qmul cluster
##
#FC=/home/dhruba/mpich2/bin/mpif90 -f90=/opt/pathscale/bin/pathf90 -fno-second-underscore  #(hyades.maths.qmul.ac.uk)
#FFLAGS= -O3 -static -I/home/dhruba/mpich2/include/ -L/home/dhruba/Library/lib -I/home/dhruba/Library/include/ -subverbose#(hyades.maths.qmul.ac.uk)
#FFLAGS_DOUBLE = -r8 #(hyades.maths.qmul.ac.uk)
#CFLAGS_DOUBLE = -DDOUBLE_PRECISION #(hyades.maths.qmul.ac.uk)
#CC=/home/dhruba/mpich2/bin/mpicc -I/home/dhruba/Library/include#(hyades.maths.qmul.ac.uk)
#LD_MPI = -L/home/dhruba/mpich2/lib/ -lmpich#(hyades.maths.qmul.ac.uk)
##
## Dhruba on andromeda.qmul cluster
##
#FC=mpif90  -axW  -L${HOME}/Library/lib #(andromeda)
#FFLAGS= -O3  #(andromeda)
#CC=mpicc #(andromeda) 
#CFLAGS=-O3 -DFUNDERSC=1 -I${HOME}/Library/include -L${HOME}/Library/lib #(andromeda)
##
## Dhruba at manchester, lancaster, liverpool
## 
#FC = mpif90 #(man2|penumbra|lv1)
#FFLAGS = #(man2|penumbra|lv1)
#CC = pgcc #(man2|penumbra|lv1)
##
## Dhruba's Desktop (starpc37) 
##
#FC=mpif90  # (starpc37.maths.qmul.ac.uk)
#FFLAGS_DOUBLE = -r8 # (starpc37.maths.qmul.ac.uk)
#F77=$(FC) #(starpc37.maths.qmul.ac.uk)
#FFLAGS=-O3 -fno-second-underscore  -I/home/network/dhruba/mpich2/include -L/home/network/dhruba/mpich2/lib -L/home/network/dhruba/Library/lib#(starpc37.maths.qmul.ac.uk)
#CC=mpicc -I/home/network/dhruba/Library/include/  #(starpc37.maths.qmul.ac.uk)
#CFLAGS=-O3 -DFUNDERSC=1  #(starpc37.maths.qmul.ac.uk)
##
## Dhruba on ukmhd cluster
##
#FC=mpif90 -f90=pgf90 -L${HOME}/Library/lib  #(mhdc)
#FFLAGS=  -O3  #(mhdc)
#CC=mpicc -cc=pgcc#(mhdc)
#CFLAGS=-O3 -DFUNDERSC=1 -I${HOME}/Library/include -L${HOME}/Library/lib  #(mhdc)
#LD_MPI = -lmpich #(mhdc) 
##
## Piyali on nordita laptop on maths.qmul cluster
##
#FC=gfortran -fno-second-underscore  #(nordita-laptop)
#FFLAGS=  -O3  #(nordita-laptop)
#CC=gcc #(nordita-laptop)
##
## Hoffman2 Cluster @ UCLA (Steve B)
##
#FC=mpif90 #(i01|i02)
#F77=$(FC) #(i01|i02)
#FFLAGS=-O3 #(i01|i02)
#CC=mpicc #(i01|i02)
#CFLAGS=-O3 -DFUNDERSC=1 #(i01|i02)
##
##
## CrayXT4 - (Espoo, Finland)
## 1012 Dual-core 2.6GHz Opterons
##
#FC=ftn #(louhi)
#F90=$(FC) #(louhi)
#CC=cc #(louhi)
##FFLAGS=-target=catamount -O2 -Mrecursive #(louhi)
##FFLAGS=-target=linux -fast -Mrecursive #(louhi)
##FFLAGS=-O3 -OPT:Ofast  -fno-math-errno  -ffast-math -static #(louhi)
##FFLAGS=-O3 -OPT:Ofast  -fno-math-errno  -ffast-math -mcmodel=medium #(louhi)
#FFLAGS=-O3 -OPT:Ofast  -fno-math-errno  -ffast-math #(louhi)
#FFLAGS_DOUBLE=-r8 #(louhi)
#CFLAGS=-DFUNDERSC=1 -O3 #(louhi)
#LD_MPI= #(louhi)
##
## Steve's test cluster
##
#FC=mpif90 #(asd|kool)
#FFLAGS=-O3 -m64 -march=opteron -I/usr/local/include -L/lib64 -L/usr/lib64 -L/usr/local/lib64 -L/usr/lib -L/usr/local/lib -I/usr/include -fno-second-underscore #(asd|kool)
#FFLAGS_DOUBLE=-fdefault-real-8 #(asd|kool)
#LDFLAGS=-m64 -m64 -march=opteron #(asd|kool)
#CC=gcc #(asd|kool)
#CFLAGS=-O3 -DFUNDERSC=1 -Wall -march=opteron #(asd|kool)
##
## Marcus on janus (ifc/icc 9.1)
##
#FC=ifort #(janus)
#FFLAGS= -O3 -xP -mp -vec_report0 #(janus)
#CC=icc #(janus)
#CFLAGS=-O3 -DFUNDERSC=1 #(janus)
##
##  Raphael's Nordita Thinkpad
##
#FC=gfortran -I/usr/include -I. -I/usr/include/lam  -frecord-marker=4 #(wintermute)
#F77=$(FC)  #(wintermute)
#FFLAGS_SLOPPY=  #(wintermute)
#FFLAGS=-O3   #(wintermute)
#F90FLAGS=  #(wintermute)
#F77FLAGS=   #(wintermute)
#FFLAGS_DOUBLE=-fdefault-real-8  #(wintermute)
#CC=gcc     #(wintermute)
#CFLAGS=-O3 -DFUNDERSC=1   #(wintermute)
#LD_MPI=-lmpi -llam #(wintermute)
##
##  Oishi's desktop @ berkeley
##
#FC=gfortran -frecord-marker=4 #(volans)
#F77=$(FC)  #(volans)
#FFLAGS_SLOPPY=  #(volans)
#FFLAGS=-O3   #(volans)
#F90FLAGS=  #(volans)
#F77FLAGS=   #(volans)
#FFLAGS_DOUBLE=-fdefault-real-8  #(volans)
#CC=gcc     #(volans)
#CFLAGS=-O3 -DFUNDERSC=1   #(volans)
##LD_MPI=-lmpi  #(volans)
##
##  Crater @ berkeley
##
#FC=mpif90 -frecord-marker=4 #(crater)
#F77=$(FC)  #(crater)
#FFLAGS_SLOPPY=  #(crater)
#FFLAGS=-O3   #(crater)
#F90FLAGS=  #(crater)
#F77FLAGS=   #(crater)
#FFLAGS_DOUBLE=-fdefault-real-8 #(crater)
#CC=mpicc     #(crater)
#CFLAGS=-O3 -DFUNDERSC=1   #(crater)
##
##  ENYO Cluster @ AMNH (New York)
##
#FC=mpif90  #(enyo)
#CC=mpicc   #(enyo)
##
##  IBM BCX/5120, Cineca, Bologna
##
#FC=mpif90 #(node[0-9]*)
#F77=$(FC)  #(node[0-9]*)
#FFLAGS=-O3 -ip -ipo -xW -i_dynamic #(node[0-9]*)
#F90FLAGS=  #(node[0-9]*)
#F77FLAGS=   #(node[0-9]*)
#FFLAGS_DOUBLE=-fdefault-real-8 #(node[0-9]*)
#CC=mpicc     #(node[0-9]*)
#CFLAGS=-O3 -DFUNDERSC=1   #(node[0-9]*)
##
## (Fred's desktop machine)
##
##FC=sunf95 #(dunhuang|couette)
##FFLAGS=-m32 -xO3 -xarch=ssse3 -xcache=32/64/8:4096/64/16 -xchip=core2 -xdepend=yes -dalign -fns=yes -ftrap=common -xlibmil -nofstore -xregs=frameptr -fsimple=0 -I/usr/lib/openmpi/include #(couette)
##FFLAGS=-xO3 -xarch=ssse3 -xcache=16/64/8:1024/64/8 -xchip=pentium4 -xdepend=yes -dalign -fns=yes -ftrap=common -xlibmil -nofstore -xregs=frameptr -fsimple=0 -I/usr/lib/openmpi/include #(dunhuang)
##FFLAGS_DOUBLE= -fprecision=double #(dunhuang|couette)
##LD_MPI=-L/usr/lib/openmpi/lib -lmpi -lmpi_f77 -lmpi_f90 -lopen-rte -lopen-pal -ldl -lnsl -lutil -lm #(dunhuang|couette)
#
#FC=gfortran #(mallock|couette|maurice|dunhuang)
#FFLAGS=-O3 -I/usr/lib/openmpi/include -pthread #(mallock|couette|maurice|dunhuang)
#FFLAGS_DOUBLE=-fdefault-real-8 #(mallock|couette|maurice|dunhuang)
#LD_MPI=-pthread -I/usr/lib/openmpi/lib -L/usr/lib/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl #(mallock|couette|maurice|dunhuang)
##FC=sunf95 #(dunhuang|couette|maurice)
##FFLAGS=-m32 -xO3 -xarch=ssse3 -xcache=32/64/8:4096/64/16 -xchip=core2 -xdepend=yes -dalign -fns=yes -ftrap=common -xlibmil -nofstore -xregs=frameptr -fsimple=0 -I/usr/lib/openmpi/include #(couette|maurice)
##FFLAGS=-xO3 -xarch=ssse3 -xcache=16/64/8:1024/64/8 -xchip=pentium4 -xdepend=yes -dalign -fns=yes -ftrap=common -xlibmil -nofstore -xregs=frameptr -fsimple=0 -I/usr/lib/openmpi/include #(dunhuang)
##FFLAGS_DOUBLE= -fprecision=double #(dunhuang|couette|maurice)
##LD_MPI=-L/usr/lib/openmpi/lib -lmpi -lmpi_f77 -lmpi_f90 -lopen-rte -lopen-pal -ldl -lnsl -lutil -lm #(dunhuang|couette|maurice)
#


## Darwin:
## Power Macintosh
#FC=g95
#F77=$(FC)
#FFLAGS=-O3
#CFLAGS=-DFUNDERSC=2
#LD_MPI=
##
##  Nils' machine
##
#FC=xlf90 #(Nils)
#F77=xlf  #(Nils)
#FFLAGS= -w -qsuppress=1501-510  #(Nils)
#F90FLAGS=-qsuffix=f=f90 #(Nils)
#CFLAGS=-O3 -DFUNDERSC=0 #(Nils)
#LD_MPI=-lSystemStubs #(easymac)
##
## Tarek's laptop (PowerBook G4)
##
#FC=gfortran #(dendara|lapc|tay21)
#FC=g95 -fno-second-underscore #(dendara|lapc|tay21)
##FFLAGS=  -ftrace=full   #(dendara|lapc|tay21)
#CC= gcc-3.3 -03 #(dendara|lapc|tay21)
#FFLAGS= -O2 #(dendara|lapc|tay21)
##LD_MPI= -L${HOME}/opt/lib  #(dendara|lapc|tay21)
##
## Petri's laptop (MacBook Pro)
##
#FC=mpif90 #(Chandrasekhar)
#FFLAGS= -O3 #(Chandrasekhar)
#CFLAGS=-DFUNDERSC=1 #(Chandrasekhar)
##
## norosx52 (Mac Pro, 8 cores)
##
#FC=/opt/ompi/bin/mpif90 #(norosx52)
#FFLAGS= -O3 #(norosx52)
#CFLAGS=-DFUNDERSC=1 -m32 #(norosx52)
##
## Dhruba's laptop 
##
#FC=g95 -fno-second-underscore # (lilabati)
#F77=$(FC) #(lilabati)
#FFLAGS=-O3 -L/Users/dhruba/lib/lib/ #(lilabati)
#CC=gcc #(lilabati)
#CFLAGS=-O3 -DFUNDERSC=1 #(lilabati)
##
## joishi's laptop
## 
##FC=gfortran #(ebisu)
#FC=/usr/local/openmpi_gfortran/bin/mpif90 #(ebisu)
#FFLAGS=-O3 -frecord-marker=4 #(ebisu)
##CFLAGS=-DFUNDERSC=2 #(ebisu)
##CC=gcc #(ebisu)
#CC=/usr/local/openmpi_gfortran/bin/mpicc #(ebisu)
##
## Nordita MacBook
##
#FC=g95 #(normacbook1)
#F77=$(FC) #(normacbook1)
#FFLAGS= -I/usr/local/include #(normacbook1)
#CFLAGS=-DFUNDERSC=2 #(normacbook1)
#LD_MPI= -L/usr/local/include -llammpio -llamf77mpi -lmpi -llam -ldl #(normacbook1)
##
## Nordita Mac Mini
##
#FC=g95 #(norosx01)
#F77=$(FC) #(norosx01)
#FFLAGS=-O3 -I/usr/local/include -freal=nan -finteger=-2147483648 #(norosx01)
#FFLAGS=-O3 -I/usr/local/include -freal=nan -finteger=-2147483648 -fbounds-check -ftrace=full -Wall -Wno=140,141,109,112,137 -Werror #(norosx01)
#FFLAGS=-O3 -I/usr/local/include -freal=nan -finteger=-2147483648 -fbounds-check -ftrace=full -Wall -Wno=140,141,109,112,137 #(norosx01)
#CFLAGS=-DFUNDERSC=2 #(norosx01)
#LD_MPI= -L/usr/local/include -llammpio -llamf77mpi -lmpi -llam -ldl #(norosx01)
##
## Steve's MacBook Pro
##
#FC=g95 #(mac)
#FFLAGS=-O3 -fno-second-underscore -I/usr/local/include -L/usr/local/lib -ftrace=full #(mac)
#CC=gcc #(mac)
#CFLAGS=-O3 -DFUNDERSC=1 #(mac)
#LD_MPI= -L/usr/local/lib -lmpich -lpmpich #(mac)

##
## SunOS:
## Solaris
#CC=mpcc #(corona[1-2])
#FC=f90
#FC=pghpf #(Lomond)
#FC=mpf90 #(corona[1-2])
#FFLAGS=-O4
#FFLAGS=-O3 -dalign -xarch=v9b  #(corona[1-2])
#FFLAGS= -Msmp -O4  #(Lomond)
#CFLAGS=-O4 -DFUNDERSC=1
#CFLAGS=-O4 -DFUNDERSC=0 #(ursa)
#CFLAGS=-O3 -dalign -xarch=v9b -DFUNDERSC=1 #(corona[1-2])
#LD_MPI=-L/opt/local/mpich/lib -lmpich -lsocket -lnsl -laio
#LD_MPI=-lmpi  #(corona[1-2])
#LD_MPI= #(scrooge.)
#F77=$(FC)

## UNICOS/mk:
## Cray T3E
#FC=f90
#FFLAGS=-O3 -em

## HI-UX/MPP:
## Hitachi
#FC=mpif90
#F77=$(FC)
#FFLAGS=-lowercase -I/usr/mpi/include -O4 -pvec -parallel=0
#FFLAGS=-lowercase -Os -noparallel -O4
#CFLAGS=-O4 -DFUNDERSC=0
#LD_MPI=-L/usr/mpi/lib/lib32 -lfmpi -lmpi

## SUPER-UX:
## NEC
#FC=f90 -I/usr/include
#F77=$(FC)
#FFLAGS=-C hopt

## AIX:
## IBM
#CFLAGS=-O3 -DFUNDERSC=0
#F77=xlf
#FC=xlf90
#FFLAGS=-I/usr/lpp/ppe.poe/include -I/usr/lpp/ppe.poe/include/thread -O5 -w
#F90FLAGS=-qsuffix=f=f90
#LD_MPI=-F:mpxlf90
#FC=mpxlf90 #(sp[0-1]*)
#F77=mpxlf #(sp[0-1]*)
#CC=mpcc #(sp[0-1]*)
#CFLAGS=-qarch=pwr4 -qtune=pwr4 -q64 #(sp[0-1]*)
#FFLAGS=-qarch=pwr4 -qtune=pwr4 -q64 #(sp[0-1]*)
#CFLAGS=-O5 -qarch=pwr4 -qtune=pwr4 -q64 #(sp[0-1]*)
#FFLAGS=-O5 -qarch=pwr4 -qtune=pwr4 -q64 #(sp[0-1]*)
#LD_MPI= #(sp[0-1]*)
#FC=mpxlf90_r #(p690*)
#CC=mpcc_r #(p690*)
#FFLAGS=-O2 -qarch=pwr4 -qtune=pwr4 #(p690*)
#CFLAGS=-qarch=pwr4 -qtune=pwr4 -DFUNDERSC=0 #(p690*)
#LD_MPI= #(p690*)
### -bmaxdata:0x7000000


### End machine dependent

LD=$(FC)
MPICOMM_FIX=$(MPICOMM)$(LIBMPISUFFIX)
# 
#  Generic rules.
# 
.SUFFIXES:			# get rid of that annoying Modula rule
.SUFFIXES: .f .f90 .c .o .inc .h .dot .ps .svg
# 
.f.o:
	$(F77) $(FFLAGS) $(FFLAGS_GENERAL) $(F77FLAGS) -o $*.o -c $*.f
.f90.o:
	$(FC) $(FFLAGS) $(FFLAGS_GENERAL) $(F90FLAGS) -o $*.o -c $*.f90
.c.o:
	$(CC) $(CFLAGS) $(CFLAGS_GENERAL) $(CFLAGS_FOURIER) -o $*.o -c $*.c
#
#  Rules for creating images of dot dependency diagrams.
#
.dot.ps:
	cat $*.dot | dot -Tps -o $*.ps
.dot.svg:
	cat $*.dot | dot -Tsvg -o $*.svg
#
#  Technical modules (cannot add to cparam.inc).
#
technical=cparam.o cdata.o messages.o general.o farray.o shared_variables.o $(SLICES).o $(DERIV).o $(BOUNDCOND).o initcond.o register.o diagnostics.o $(GRID).o
#
#  Switchable physics modules.
#
physics=$(VISCOSITY).o $(SHOCK).o $(HYDRO).o $(DENSITY).o $(GRAVITY).o $(ENTROPY).o $(EOS).o $(MAGNETIC).o $(SHEAR).o $(SIGNAL_HANDLING).o
#
#  Add switchable non-physics modules.
#
switchable=$(physics) $(INITIAL_CONDITION).o
#
comm_deps=$(technical) sub.o $(IO).o snapshot.o param_io.o  $(MPICOMM_FIX).o $(switchable)
#
start_deps=$(comm_deps) $(DEBUG).o $(GSL).o
#
run_deps_f90=$(comm_deps) pencil_check.o equ.o $(TIMESTEP).o
#
run_deps=$(run_deps_f90) $(DEBUG).o $(GSL).o
#
start=start.o $(start_deps)
#
run=run.o $(run_deps)
#
combine_videofiles_deps=cparam.o cdata.o general.o
combine_videofiles=combine_videofiles.o $(combine_videofiles_deps)
read_videofiles_deps=cparam.o cdata.o general.o
read_videofiles=read_videofiles.o $(read_videofiles_deps)
read_vectorfiles_deps=cparam.o cdata.o general.o
read_vectorfiles=read_vectorfiles.o $(read_vectorfiles_deps)
TAG_SOURCE=$(run_deps_f90:.o=.f90) start.f90 run.f90 debug_c.c combine_videofiles.f90 read_videofiles.f90
PC_XMLEXPORT=$(PENCIL_HOME)/bin/pc_xmlexport
# 
# Symbolic targets
#
default: start_buildtime Makefile cparam.inc code stop_buildtime buildinfo
# 
pacx: pacx-makefile cparam.inc code
# 
Makefile: Makefile.src
	scripts/check-mkfile Makefile.local Makefile.src
	env ADAPT_MKFILE=$(ADAPT_MKFILE) scripts/adapt-mkfile Makefile.src Makefile
# 
pacx-makefile: Makefile.src
	scripts/acx-adapt-mkfile Makefile.src pacx-Makefile
	cp pacx-Makefile Makefile
# 
depend dep:
	@printf "***** %-45s *****\n" \
	    '*********************************************' \
	    '(Re)-creating src/Makefile.depend.' \
	    'Only use this if you know what you are doing.' \
	    'You can revert with' \
	    '  rm src/Makefile.depend; pc_setupsrc' \
	    '*********************************************'
	rm -f Makefile.depend
	scripts/mkdep start.f90 run.f90 combine_videofiles.f90 read_videofiles.f90 read_vectorfiles.f90 equ.f90 debug_c.c $(GRID).f90 $(comm_deps:.o=.f90)  > Makefile.depend
# 
#  Help us finding out what compiler, MPI library, etc we have and give
#  recommendations
#
semiauto-conf:
	echo "Running semiauto-conf"
	@scripts/semiauto-conf \
	  FC="$(FC)" \
	  FFLAGS="$(FFLAGS)" \
	  FFLAGS_GENERAL="$(FFLAGS_GENERAL)" \
	  FFLAGS_FOURIER="$(FFLAGS_FOURIER)" \
	  F90FLAGS="$(F90FLAGS)" \
	  CC="$(CC)" \
	  CFLAGS="$(CFLAGS)" \
	  CFLAGS_GENERAL="$(CFLAGS_GENERAL)" \
	  CFLAGS_FOURIER="$(CFLAGS_FOURIER)" \
	  LD="$(LD)" \
	  LD_MPI="$(LD_MPI)" \
	  LD_FLAGS="$(LD_FLAGS)" \
	  LD_FOURIER="$(LD_FOURIER)" \
	  LIBMPISUFFIX="$(LIBMPISUFFIX)"
# 
#  Generate files for automated debugging and testing etc.
#
start_buildtime:
	@echo "<buildtime><timestamp type='start'>`date`</timestamp>" > .buildtime
stop_buildtime:
	@echo "<timestamp type='end'>`date`</timestamp></buildtime>" >> .buildtime
buildinfo:
	@$(PC_XMLEXPORT) buildinfo -e "CC='$(CC)';CFLAGS='$(CFLAGS)';F90='$(F90)';F77='$(F77)';" \
	                       -e "FFLAGS='$(FFLAGS)';F90FLAGS='$(F90FLAGS)';F77FLAGS='$(F77FLAGS)';" \
	                       -e "LD_FOURIER='$(LD_FOURIER)';" \
	                       -e "FCCLEANER='$(FCCLEANER)';LD_MPI='$(LD_MPI)';" \
	                       -e "FFLAGS_GENERAL='$(FFLAGS_GENERAL)';CFLAGS_GENERAL='$(CFLAGS_GENERAL)';" \
	                       -e "FC='$(FC)';" \
	                       -e "POWER='$(POWER)';DEBUG='$(DEBUG)';HYDRO='$(HYDRO)';" \
	                       -e "VISCOSITY='$(VISCOSITY)';DENSITY='$(DENSITY)';ENTROPY='$(ENTROPY)';" \
	                       -e "MAGNETIC='$(MAGNETIC)';" \
			       -e "EOS='$(EOS)';SHOCK='$(SHOCK)';" \
	                       -e "GRAVITY='$(GRAVITY)';SHEAR='$(SHEAR)';" \
	                       -e "INITIAL_CONDITION='$(INITIAL_CONDITION)';" > .buildinfo
# 
#  Dot diagrams.
#
all.dot: Makefile.src Makefile.local scripts/mkdot
	scripts/mkdot -T "All f90 dependencies" *.f90 | grep -v "RVID_BOX" | grep -v "SURFACEDATA" | grep -v "MAIN_PROGRAM" | grep -v "WRITE_DEFAULT_NAMELISTS" > all.dot
# 
all_nocdata.dot: all.dot
	cat all.dot | grep -v "CDATA" | grep -v "CPARAM" > all_nocdata.dot
# 
all_nocdataexe.dot: all.dot
	cat all.dot | grep -v "CDATA" | grep -v "CPARAM" | grep -v "RUN" | grep -v "START"| grep -v "READ_VIDEOFILES" | grep -v "READ_VECTORFILES" > all_nocdataexe.dot
# 
switchable.dot: Makefile.src Makefile.local scripts/mkdot
	scripts/mkdot -T "Switchable Module Dependencies" $(switchable:.o=.f90) > switchable.dot
# 
run.dot: Makefile.src Makefile.local scripts/mkdot 
	scripts/mkdot -T "Run Dependencies" $(run:.o=.f90) > run.dot
# 
start.dot: Makefile.src Makefile.local scripts/mkdot
	scripts/mkdot -T "Start Dependencies" $(start:.o=.f90) > start.dot
# 
run_nocdata.dot: run.dot
	cat run.dot | grep -v "CDATA" | grep -v "CPARAM" > run_nocdata.dot
# 
start_nocdata.dot: start.dot
	cat start.dot | grep -v "CDATA" | grep -v "CPARAM" > start_nocdata.dot
# 
switchable_nocdata.dot: switchable.dot
	cat switchable.dot | grep -v "CDATA" | grep -v "CPARAM" > switchable_nocdata.dot
#
all.ps: all.dot
run.ps: run.dot
start.ps: start.dot
#
switchable.ps: switchable_nocdata.dot
all_nocdata.ps: all_nocdata.dot
run_nocdata.ps: run_nocdata.dot
start_nocdata.ps: start_nocdata.dot
switchable_nocdata.ps: switchable_nocdata.dot
#
all_nocdataexe.ps: all_nocdataexe.dot
#
diagrams: run.ps run_nocdata.ps start.ps start_nocdata.ps switchable.ps switchable_nocdata.ps all.ps all_nocdata.ps all_nocdataexe.ps
#
all.svg: all.dot
run.svg: run.dot
start.svg: start.dot
#
switchable.svg: switchable_nocdata.dot
all_nocdata.svg: all_nocdata.dot
run_nocdata.svg: run_nocdata.dot
start_nocdata.svg: start_nocdata.dot
switchable_nocdata.svg: switchable_nocdata.dot
#
all_nocdataexe.svg: all_nocdataexe.dot
#
diagrams_svg: run.svg run_nocdata.svg start.svg start_nocdata.svg switchable.svg switchable_nocdata.svg all.svg all_nocdata.svg all_nocdataexe.svg
#
#  Compilation rules.
#
cparam.inc: Makefile.src Makefile.local cparam.local scripts/mkcparam
	scripts/mkcparam $(switchable:.o=.f90) grid.f90 $(DERIV).f90 cparam.local -o cparam.inc
# 
cparam.o:  cparam.f90 cparam.local cparam.inc
	if [ "" ]; then \
		 rm -f cparam.inc; \
		 rm -f cparam_pencils.inc; \
	     ln -s cparam.inc cparam.inc;\
	     ln -s cparam_pencils.inc cparam_pencils.inc;\
	fi
	$(FC) $(FFLAGS) $(FFLAGS_GENERAL) $(F90FLAGS) -o cparam.o -c cparam.f90
# 
initial_condition_dummies.inc:  noinitial_condition.f90 $(INITIAL_CONDITION).f90
	scripts/mkdummyinc -d noinitial_condition.f90 -s $(INITIAL_CONDITION).f90 > initial_condition_dummies.inc
# 
mpicomm_double.f90: mpicomm.f90
	sed -e 's/REAL/DOUBLE_PRECISION/g' mpicomm.f90 > mpicomm_double.f90
# 
ghostfold_mpicomm_double.f90: ghostfold_mpicomm.f90
	ln -s ghostfold_mpicomm.f90 ghostfold_mpicomm_double.f90
# 
mpicomm_.f90: mpicomm.f90
	perl -pe 's/(MPI_[A-Z1-9_]*)([ (])/$$1_$$2/g' mpicomm.f90 > mpicomm_.f90
# 
mpicomm_double_.f90: mpicomm_double.f90
	perl -pe 's/(MPI_[A-Z1-9_]*)([ (])/$$1_$$2/g' mpicomm_double.f90 > mpicomm_double_.f90
# 
nompicomm_.f90: nompicomm.f90
	cp nompicomm.f90 nompicomm_.f90
# 
EXECUTABLES=start.x run.x \
	combine_videofiles.x read_videofiles.x read_vectorfiles.x
# 
# The last few object files to compile. We need to compile _all_ object
# files before linking, because FC=g95_quick_and_dirty will otherwise
# delete already compiled .x files:
# 
LAST_OBJ=$(EXECUTABLES:.x=.o)
code: Makefile.inc cparam.inc
	@# Realize error even when last command in pipe is FCCLEANER:
	@echo "$(MAKE) $(MAKEOPTS) $(LAST_OBJ) $(EXECUTABLES)"
	@if [ ! -z "$(FCCLEANER)" ]; then \
	    ($(MAKE) $(MAKEOPTS) $(LAST_OBJ) $(EXECUTABLES) \
	    || echo "PENCIL COMPILATION ERROR") $(FCCLEANER) ; \
	else \
	    $(MAKE) $(MAKEOPTS) $(LAST_OBJ) $(EXECUTABLES) ; \
	fi
# 
FASTEXECS=startfast.x runfast.x combine_videofiles.x read_videofiles.x read_vectorfiles.x
fast:
	@echo "$(MAKE) $(MAKEOPTS) $(FASTEXECS)"
	@if [ ! -z "$(FCCLEANER)" ]; then \
	    ($(MAKE) $(MAKEOPTS) $(FASTEXECS) \
	    || echo "PENCIL COMPILATION ERROR") $(FCCLEANER) ; \
	else \
	    $(MAKE) $(MAKEOPTS) $(FASTEXECS) ; \
	fi
# 
debug:
	@echo "$(MAKE) $(MAKEOPTS) FFLAGS='$(FFLAGS) $(DEBUGFLAGS)' start.x run.x"
	@if [ ! -z "$(FCCLEANER)" ]; then \
	    ($(MAKE) $(MAKEOPTS) FFLAGS='$(FFLAGS) $(DEBUGFLAGS)' start.x run.x \
	    || echo "PENCIL COMPILATION ERROR") $(FCCLEANER) ; \
	else \
	    $(MAKE) $(MAKEOPTS) FFLAGS='$(FFLAGS) $(DEBUGFLAGS)' start.x run.x; \
	fi
# 
start.x: $(start) Makefile.local
	$(LD) $(LDFLAGS) $(start) $(LD_MPI) $(LD_FOURIER) $(LD_GSL) -o start.x
# 
run.x: $(run) Makefile.local
	$(LD) $(LDFLAGS) $(run) $(LD_MPI) $(LD_FOURIER) $(LIBSIG) $(LD_GSL) -o run.x
# 
#  Testing spatial differential operators 
#
optest.x: $(optest) Makefile.local
	$(LD) $(LDFLAGS) $(optest) $(LD_MPI) $(LD_FOURIER) -o optest.x
# 
#  Handy for debugging; just compile by hand what is changed.
#  When you use this you must be certain that everying is consistent.
#
linkonly:
	$(LD) $(LDFLAGS) $(start) $(LD_MPI) $(LD_FOURIER) -o start.x
	$(LD) $(LDFLAGS) $(run) $(LD_MPI) $(LD_FOURIER) $(LIBSIG) -o run.x
# 
# Needed for the underscore trick:
#
mpicomm_.f90:      mpicomm.f90
# 
# Use sloppier compiler for MPICOMM and fftpack if specified:
# If set, FFLAGS_SLOPPY overrides '$(FFLAGS) $(F90FLAGS)'. Use like this:
#   FFLAGS_SLOPPY=-O4 -Wall
#   F90FLAGS=$(FFLAGS_SLOPPY) -Werror
#   F77FLAGS=$(FFLAGS_SLOPPY)
# to restrict `-Werror' to F90 files other than MPICOMM.
#
$(MPICOMM_FIX).o: mpicomm.h $(MPICOMM_FIX).f90 cdata.o
	@fflags="$(FFLAGS_SLOPPY)"; \
	if [ -z "$$fflags" ]; then fflags="$(FFLAGS) $(F90FLAGS)"; fi; \
	echo $(FC) $(FFLAGS_GENERAL) $$fflags $(FFLAGS_FOURIER) \
	    -o $(MPICOMM_FIX).o -c $(MPICOMM_FIX).f90; \
	$(FC) $(FFLAGS_GENERAL) $$fflags $(FFLAGS_FOURIER) \
	    -o $(MPICOMM_FIX).o -c $(MPICOMM_FIX).f90
# 
# Remove all build files, but keep executables (misleading name..)
#
run:
	rm -f *.o *.mod *.d
	rm -f work.pc work.pcl
# 
# Alternative to make run. To copy executables to parent directory. Make
# clean(n) could then be run on the source. (misleading name..)
#
install:
	cp *.x ../
# 
# nofft.f90:
#     @ touch nofft.f90
# nofftpack.f90:
#     @ touch nofftpack.f90
# 
# TAGS file for Emacs.
# $(TAG_SOURCE) requires nofftpack.f90 or fft.f90 to exist, so we
# temporarily create them
#
TAGS: $(TAG_SOURCE)
	etags $(TAG_SOURCE)
	@ if [ ! -s nofftpack.f90 ]; then rm -f nofftpack.f90; fi
	@ if [ ! -s fft.f90 ]; then rm -f fft.f90; fi
# 
# Clean up, but leave makefile and TAGS
#
clean:
	rm -f *.x *.o *.mod *.d cparam*.inc cparam_pencils*.inc *.il
	rm -f initial_condition/*.o initial_condition/*.mod	
	rm -f .current-precision
	rm -f *.dot *.ps  # Dependency diagram files
	rm -f work.pc work.pcl .build*
	printf "# %s\n" "Empty" "(This file was written by 'make')" > Makefile.inc
# 
# Clean up all
# (there should be no Makefile_inc; but if there is, `make' just does nothing)
#
cleann: clean
	rm -f Makefile Makefile_inc TAGS  *mpicomm_.f90 mpicomm_double*.f90
	rm -rf semiauto-conf_tmp f90_qnd_log_dir
	rm -f *.inc && touch Makefile.inc
	$(MAKE) $(MAKEOPTS) -f Makefile.src Makefile
# 
# same thing
#
cleanall: cleann
# 
# Try to remove everything generated by pc_setupsrc, compilation, etc.
#
distclean: cleanall
	find . -type l -print0 | xargs -0 rm -f
	rm -rf initial_condition Makefile Makefile.inc Makefile.depend
	rm -rf semiauto-conf* *.log history
#
#  Code targets
#
combine_videofiles.x: $(combine_videofiles)
	$(LD) $(LDFLAGS) $(combine_videofiles) $(LD_MPI) -o combine_videofiles.x
# 
read_videofiles.x: $(read_videofiles)
	$(LD) $(LDFLAGS) $(read_videofiles) $(LD_MPI) -o read_videofiles.x
# 
read_vectorfiles.x: $(read_vectorfiles)
	$(LD) $(LDFLAGS) $(read_vectorfiles) $(LD_MPI) -o read_vectorfiles.x
# 
#  Non-F90 / undetectable dependencies
#
fft.o:	     fft.f Makefile.src
nodebug.o:            nodebug.f90 cdata.o $(MPICOMM_FIX).o
#
# Dependencies
#
include Makefile.depend

# DO NOT DELETE
