# EC-EARTH3 ec-conf-based configuration
#
# NCDF_HOME   root directory containing lib and include subdirectories for netcdf4
# HDF5_HOME   root directory containing lib and include subdirectories for HDF5
# XIOS_HOME   root directory containing lib for XIOS
# OASIS_HOME  root directory containing lib for OASIS
#
# NCDF_INC    netcdf4 include file
# NCDF_LIB    netcdf4 library
# XIOS_INC    xios include file    (taken into accound only if key_iomput is activated)
# XIOS_LIB    xios library         (taken into accound only if key_iomput is activated)
# OASIS_INC   oasis include file   (taken into accound only if key_oasis3 is activated)
# OASIS_LIB   oasis library        (taken into accound only if key_oasis3 is activated)
#
# FC          Fortran compiler command
# FCFLAGS     Fortran compiler flags
# FFLAGS      Fortran 77 compiler flags
# LD          linker
# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries
# FPPFLAGS    pre-processing flags
# AR          assembler
# ARFLAGS     assembler flags
# MK          make
# USER_INC    complete list of include files
# USER_LIB    complete list of libraries to pass to the linker
#
# Note that:
#  - unix variables "$..." are accpeted and will be evaluated before calling fcm.
#  - fcm variables are starting with a % (and not a $)

%HDF5_HOME           $(EBROOTHDF5)
%HDF5_LIB            $(addprefix -L,$(addsuffix /,$(EBROOTHDF5))lib) \
                     $(addprefix -l,hdf5_hl hdf5)

%NCDF_INC            $(addprefix -I,$(addsuffix /,/)$(EBROOTNETCDF)/include $(EBROOTNETCDFMINFORTRAN)/include)
%NCDF_LIB            $(addprefix -L,$(addsuffix /,/)$(EBROOTNETCDF)/lib64 $(EBROOTNETCDFMINFORTRAN)/lib) \
                     $(addprefix -l,netcdff netcdf)

%MPI_INC             $(addprefix -I,/)
%MPI_LIB             $(addprefix -L,$(addsuffix /,)) \
                     $(addprefix -l,)

%XIOS_HOME           ${HOME}/models/ecearth_3.3.3.2/sources/xios-2.5
%XIOS_INC            -I%XIOS_HOME/inc
%XIOS_LIB            -L%XIOS_HOME/lib -lxios

%OASIS_HOME          ${HOME}/models/ecearth_3.3.3.2/sources/oasis3-mct/ecconf
%OASIS_INC           -I%OASIS_HOME/build/lib/psmile.MPI1
%OASIS_LIB           -L%OASIS_HOME/lib -lpsmile.MPI1 -lmct -lmpeu -lscrip

%CPP                 cpp

%FC                  mpif90
%FCFLAGS             -r8 -O3 -march=core-avx2 -ip -fp-model precise 
%FFLAGS              %FCFLAGS

%FPPFLAGS            -P -traditional

%LD                  mpif90
%LDFLAGS              -lstdc++

%AR                  ar
%ARFLAGS             curv

%MK                  make

%USER_INC            %XIOS_INC %OASIS_INC %NCDF_INC %MPI_INC
%USER_LIB            %XIOS_LIB %OASIS_LIB %NCDF_LIB %MPI_LIB
