#
# Include file for OASIS3 Makefile for a Linux system using 
# Portland Group Fortran Compiler and MPICH
#
###############################################################################
#
# 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          = /space/coquart/oasis3-mct_buildbot
#
# ARCHDIR       : directory created when compiling
ARCHDIR         = $(COUPLE)/compile_oa3-mct_pgi_openmpi_openmp
#
# MPI library
MPIDIR      = /usr/local/pgi/linux86-64/18.7/mpi/openmpi-2.1.2
MPIBIN      = $(MPIDIR)/bin
MPI_INCLUDE = $(MPIDIR)/include
MPILIB      = -L$(MPIDIR)/lib
#
# NETCDF library
NETCDF_INCLUDE  = /usr/local/netcdf-fortran/4.4.1/include
NETCDF_LIBRARY  = -L/usr/local/netcdf-fortran/4.4.1/lib -Wl,-rpath,/usr/local/netcdf-fortran/4.4.1/lib -lnetcdff  -Wl,-rpath,/usr/local/netcdf-c/4.6.1/lib  -L/usr/local/netcdf-c/4.6.1/lib -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) -pgf90libs
CXX         = $(MPIBIN)/mpicxx -I$(MPI_INCLUDE)
LD          = $(MPIBIN)/mpif90 $(MPILIB) 
LDCXX       = $(MPIBIN)/mpicxx $(MPILIB) -pgf90libs 
CXXLIBS     = -lmpi_cxx -lmpi -lstdc++
AR          = ar
ARFLAGS     = -ruv
CPP         = /usr/bin/cpp
#
# CPP keys and compiler options
# 
CPPDEF    = -Duse_comm_$(CHAN) -D__VERBOSE -DTREAT_OVERLAY -D__NO_16BYTE_REALS
#
# -g is necessary in F90FLAGS and LDFLAGS for pgf90 versions lower than 6.1
# 
F90FLAGS_1  = -C -g -Mbounds -byteswapio -mp -lpthread
f90FLAGS_1  = $(F90FLAGS_1)
FFLAGS_1    = $(F90FLAGS_1)
fFLAGS_1    = $(F90FLAGS_1)
CCFLAGS_1   = 
CPPFLAGS    =
LDFLAGS     = 
LDCXXFLAGS  = -Mnomain
#
###################
#
# 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) $(INCPSMILE) $(CPPDEF) -I$(NETCDF_INCLUDE)
f90FLAGS  = $(f90FLAGS_1) $(INCPSMILE) $(CPPDEF) -I$(NETCDF_INCLUDE)
FFLAGS    = $(FFLAGS_1) $(INCPSMILE) $(CPPDEF) -I$(NETCDF_INCLUDE)
fFLAGS    = $(fFLAGS_1) $(INCPSMILE) $(CPPDEF) -I$(NETCDF_INCLUDE)
CCFLAGS   = $(CCFLAGS_1) $(INCPSMILE) $(CPPDEF) -I$(NETCDF_INCLUDE)
#
#############################################################################
