#
# Include file for OASIS3 Makefile for Intel 21 on 
# Linux computer  with OpenMP
# module load intel/21.1.1
# module load intelmpi/2021.1.1
# module load lib/netcdf-fortran/4.4.4_phdf5_1.10.4
# module load python/3.7.7
#
###############################################################################
#
# CHAN	: communication technique used in OASIS3 (MPI1/MPI2)
CHAN            = MPI1
#
# Paths for libraries, object files and binaries
#
# COUPLE	: path for oasis3-mct main directory
COUPLE          = $(HOME)/oasis3-mct
#
# ARCHDIR       : directory created when compiling
 ARCHDIR        := $(COUPLE)/INSTALL_OASIS
#
# MPI library
MPIDIR           = /softs/intel/oneapi/mpi/2021.1.1/
MPIBIN           = $(MPIDIR)/bin
MPI_INCLUDE      = $(MPIDIR)/include
MPILIB           = -L$(MPIDIR)/lib
MPIRUN           = $(MPIBIN)/mpirun
#
# NETCDF library
NETCDF_INCLUDE=/softs/local_intel/netcdf/4.4.4_phdf5_1.10.4/include
NETCDF_LIBRARY  =  -Wl,-rpath,/softs/local_intel/netcdf/4.4.4_phdf5_1.10.4/lib -L/softs/local_intel/netcdf/4.4.4_phdf5_1.10.4/lib -lnetcdff -lnetcdf
#
# Compiling and other commands
MAKE        = gmake
F90         = $(MPIBIN)/mpiifort -I$(MPI_INCLUDE)
F           = $(F90)
f90         = $(F90)
f           = $(F90)
CC          = $(MPIBIN)/mpiicc -I$(MPI_INCLUDE)
LD          = $(MPIBIN)/mpiifort $(MPILIB)
# Static libraries compilation options
STATOPT     =
# Shared libraries options
DYNOPT      = -fPIC
LDDYNOPT    = -shared
AR          = ar
ARFLAGS     = -ruv
# Fortran libraries for C linking
F2C_LIBS    = -lifcore -lifcoremt -lifport -limf
#
# CPP keys and compiler options
# 
CPPDEF    = -Duse_netCDF -Duse_comm_$(CHAN) -D__VERBOSE  -DTREAT_OVERLAY
#
# -g is necessary in F90FLAGS and LDFLAGS for pgf90 versions lower than 6.1
# 
FCBASEFLAGS = -O2 -xCORE-AVX2 -I. -assume byterecl -mt_mpi -qopenmp
#FCBASEFLAGS = -g -traceback -fpe0 -O0 -check all -check noarg_temp_created -I. -assume byterecl -mt_mpi -qopenmp
CCBASEFLAGS  = -O2 -qopenmp
#
# INC_DIR : includes all *mod for each library
 INC_DIR = -I$(ARCHDIR)/include
# FLIBS : for toys when linking in local Makefile
 FLIBS=${NETCDF_LIBRARY}
###################
#
F90FLAGS    = $(FCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE) 
f90FLAGS    = $(FCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE)
FFLAGS      = $(FCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE)
fFLAGS      = $(FCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE)
CCFLAGS     = $(CCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE)
LDFLAGS     = $(FCBASEFLAGS)
F2C_LDFLAGS = $(F2C_LIBS)
#
#############################################################################
