# Fortran compiler executable -*- Makefile -*-
FC = gfortran

# Tell the compiler to accept C-preprocessor directives
CPPFLAGS = -cpp

# Basic flags such as where to write module files. We used to have the
# flag "-fconvert=big-endian" here because the RRTM input files are
# big endian Fortran unformatted files, but now the file ordering has
# been specified at the OPEN command so no compiler flags are needed.
BASICFLAGS = -J../mod -fno-range-check

# OpenMP flag; type "make OMPFLAG=-DNO_OPENMP" to compile with OpenMP
# disabled
OMPFLAG = -fopenmp

ifndef DEBUG
# --NORMAL CONFIGURATION--

# Optimization flags
OPTFLAGS = -O3
# -march=native

# Warning flags: all except those that warn about unused stuff
WARNFLAGS = -Wall -Wno-unused-label -Wno-unused-dummy-argument -Wno-unused-variable

# Debugging flags, such as "-g" to store debugging symbols, and
# instructions to abort if certain floating-point exceptions occur
DEBUGFLAGS = -g -ffpe-trap=invalid,zero,overflow

else
# --DEBUGGING CONFIGURATION--
OPTFLAGS = -O0
WARNFLAGS = -Wall
DEBUGFLAGS = -g -ffpe-trap=invalid,zero,overflow -fcheck=bounds -finit-real=snan -fbacktrace

endif

ifdef GPROF
# Add gprof output
DEBUGFLAGS += -pg
endif
