#
# Include file for OASIS3 Makefile for a Linux system using 
# Portland Group Fortran Compiler and MPICH
#  Dans .bashrc
#  module load openmpi/410_gcc1020
#
###############################################################################
#
# CHAN	: communication technique used in OASIS3 (MPI1/MPI2)
CHAN            = MPI1
#
# Paths for libraries, object files and binaries
#
# COUPLE	: path for oasis3 main directory
COUPLE          = $(HOME)/oasis3-mct
#
# ARCHDIR       : directory created when compiling
ARCHDIR         = $(COUPLE)/compile_oa3-mct_gfopenmpi_openmp
#
# MPI library
MPIDIR      = /usr/local/openmpi/4.1.0_gcc1020
MPIBIN      = $(MPIDIR)/bin
MPI_INCLUDE = $(MPIDIR)/include
MPILIB      = -L$(MPIDIR)/lib -lmpi
MPIRUN      = $(MPIBIN)/mpirun --oversubscribe
#
# NETCDF library of the system
NETCDF_INCLUDE = /usr/local/netcdf-fortran/4.4.4_gcc1020/include
NETCDF_LIBRARY = -L/usr/local/netcdf-fortran/4.4.4_gcc1020/lib -Wl,-rpath,/usr/local/netcdf-fortran/4.4.4_gcc1020/lib -lnetcdff -lnetcdf -lm
#
# Compiling and other commands
MAKE        = gmake
F90         = $(MPIBIN)/mpif90 -I$(MPI_INCLUDE)
F           = $(F90)
f90         = $(F90)
f           = $(F90)
CC          = $(MPIBIN)/mpicc -I$(MPI_INCLUDE)
LD          = $(MPIBIN)/mpif90 $(MPILIB)
# Static libraries compilation options
STATOPT     =
# Shared libraries options
DYNOPT      = -fPIC
LDDYNOPT    = -shared
AR          = ar
ARFLAGS     = -ruv
# Fortran libraries for C linking
F2C_LIBS    = -lmpi_mpifh -lgfortran -lm
#
# CPP keys and compiler options
#  
CPPDEF    = -Duse_comm_$(CHAN) -D__VERBOSE -DTREAT_OVERLAY
#
#
FCBASEFLAGS = -O2 -fallow-argument-mismatch -ffree-line-length-0 -fopenmp 
#FCBASEFLAGS  = -g -fallow-argument-mismatch -ffree-line-length-0 -fbounds-check -fopenmp
CCBASEFLAGS  = -fopenmp
#
# 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)
#
#############################################################################
