# Knuts home directory (contains some libs/includes)
KHOME = /home/fimm/nersc/knutali/

#Compiler -- F90
CF90 = /local/openmpi/bin/mpif90

#Compiler -- F77
CF77 = $(CF90)

# Compiler -- C
CC=/local/openmpi/bin/mpicc

#Linker 
LD =  $(CF90)


#Paralellization opts
#PARO = -openmp 
PARO =

#Size defaults - Change to real_size 64 for default double...
SIZEO = -real_size 64 -double_size 64
#SIZEO = 

#Arch opts
ARCHO= 

#Optimalization opts
OPTO= -O2

#Inlining opts
#INLO= -ip
INLO=

# Diverse options -swap endian IO -use medium memory model
DIVO= -convert big_endian -mcmodel=medium

# Flags for debugging. Empty optimization (OPTO above) to use debugging properly
#
#DEBUG_FLAGS = -g  -check bounds -fpstkchk -traceback -fpe0 
DEBUG_FLAGS = -g  -check all -traceback -fpe0  -CA -CB -CS -CU -CV
#DEBUG_FLAGS = 




CFLAGS = -O
F77FLG = -fixed
F90FLG = -free

# C preprocessor
CPP = /usr/bin/cpp

#CPP flags 
CPPARCH = -traditional -DIA32 -DFFTW

#This uses the OpenMPI implementation of mpi-2
LIBS =  -L/local/netcdf/lib/ -lnetcdf  -L/local/openmpi/lib/ -lmpi \
        -L/local/fftw/lib/ -lfftw3   \
        -L/local/acml/ifort64/lib/ -lacml_mv -lacml -lg2c

# Include dir for header and module files
INCLUDEDIR= -I/local/netcdf/include -I/local/fftw/include \
-I/local/openmpi/include


# Put together flags
FFLAGS    = $(SIZEO) $(OPTO) $(ARCHO) $(PARO)    $(INLO) $(DIVO) $(DEBUG_FLAGS) $(INCLUDEDIR)
LINKFLAGS = $(SIZEO) $(OPTO) $(PARO) $(INLO) $(DIVO) $(DEBUG_FLAGS)  

