#
# Include file for OASIS3 Makefile for a Linux system using 
# GNU and OPENMPI
# Dans .bashrc
# module load mpi/openmpi-x86_64
#
###############################################################################
#
# CHAN	: communication technique used in OASIS3 (MPI1/MPI2)
CHAN            = MPI1
#
# Paths for libraries, object files and binaries
#
# COUPLE	: path for oasis3 main directory
COUPLE          = /space/coquart/oasis3-mct_4.0
#
# ARCHDIR       : directory created when compiling
ARCHDIR         = $(COUPLE)/compile_oa3-mct_gfopenmpi_gcc_openmp
#
# MPI library ((see the file /etc/modulefiles/mpi/openmpi-x86_64)
MPIDIR      = /usr/lib64/openmpi
MPIBIN      = $(MPIDIR)/bin
MPI_INCLUDE = /usr/include/openmpi-x86_64
MPILIB      = -L$(MPIDIR)/lib -lmpi
#
# NETCDF library of the system
NETCDF_INCLUDE1 = /usr/include
# netcdf.mod and hdf5.mod
NETCDF_INCLUDE2 = /usr/lib64/gfortran/modules
NETCDF_LIBRARY  =  -L/usr/lib64 -lnetcdff -lnetcdf
#
# 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)
AR          = ar
ARFLAGS     = -ruv
#
# CPP keys and compiler options
#  
CPPDEF    = -Duse_comm_$(CHAN) -D__VERBOSE -DTREAT_OVERLAY
#
# 
#F90FLAGS_1  = -g -ffree-line-length-0 -fbounds-check -fopenmp
F90FLAGS_1  = -ffree-line-length-none -fopenmp
f90FLAGS_1  = $(F90FLAGS_1)
FFLAGS_1    = $(F90FLAGS_1)
fFLAGS_1    = $(F90FLAGS_1)
CCFLAGS_1   = 
LDFLAGS     = -fopenmp
#
#
###################
#
# Additional definitions that should not be changed
#
FLIBS		= $(NETCDF_LIBRARY)
# BINDIR        : directory for executables
BINDIR          = $(ARCHDIR)/bin
# LIBBUILD      : contains a directory for each library
LIBBUILD        = $(ARCHDIR)/build/lib
# INCPSMILE     : includes all *o and *mod for each library
INCPSMILE       = -I$(LIBBUILD)/psmile.$(CHAN) -I$(LIBBUILD)/scrip  -I$(LIBBUILD)/mct 

F90FLAGS  = $(F90FLAGS_1) $(CPPDEF) $(INCPSMILE) -I$(NETCDF_INCLUDE1) -I$(NETCDF_INCLUDE2)
f90FLAGS  = $(f90FLAGS_1) $(CPPDEF) $(INCPSMILE) -I$(NETCDF_INCLUDE1) -I$(NETCDF_INCLUDE2)
FFLAGS    = $(FFLAGS_1) $(CPPDEF) $(INCPSMILE) -I$(NETCDF_INCLUDE1) -I$(NETCDF_INCLUDE2)
fFLAGS    = $(fFLAGS_1) $(CPPDEF) $(INCPSMILE) -I$(NETCDF_INCLUDE1) -I$(NETCDF_INCLUDE2)
CCFLAGS   = $(CCFLAGS_1) $(CPPDEF) $(INCPSMILE) -I$(NETCDF_INCLUDE1) -I$(NETCDF_INCLUDE2)
#
#############################################################################
