#------------------------------------------------------------------------------
# SIONlib Makefile Definitions (Makefile.defs.bgq-be)
#------------------------------------------------------------------------------

CFGKEY = bgq
CONFIG = IBM BlueGene/Q

PREFIX = $(TOPDIR)/../../install/sionlib_bgq

#------------------------------------------------------------------------------
# Platform Settings
#------------------------------------------------------------------------------
# don't let it overwrite from configure (multi-platform)
BGPREC   = 64
PREC     = ${BGPREC}  
PFLAG  =
AFLAG  =

PLAT       = bgq
MACHINE    = -DMACHINE=\"IBM\ BG/Q\"
PLAT_LDIR  = -DPFORM_LDIR=\".\"
PLAT_CONF  = $(MACHINE) $(PLAT_LDIR)
PLATCC     = mpicc -O -I/bgsys/drivers/ppcfloor
#PLATCC     = mpicc -O -I/bgsys/drivers/ppcfloor -I/bgsys/drivers/ppcfloor/spi/include/kernel/cnk
BGQ_SYS = /bgsys/drivers/ppcfloor
BG_INCLUDE=-I$(BGQ_SYS)/comm/include -I$(BGQ_SYS)/arch/include -I$(BGQ_SYS) -I/bgsys/drivers/ppcfloor/spi/include/kernel/cnk
BGQPERSINC=$(BG_INCLUDE) -L$(BGQ_SYS)/lib
LARGEFILE=-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D__USE_LARGEFILE64 -D__USE_FILE_OFFSET64

#------------------------------------------------------------------------------
# SIONlib General Settings
#------------------------------------------------------------------------------
OPTFLAGS =
CC       = bgxlc_r
CFLAGS   = $(OPTFLAGS) $(LARGEFILE) $(BGQPERSINC)
CXX      = bgxlC_r
CXXFLAGS = $(OPTFLAGS) -O3  $(LARGEFILE)
F77      = bgxlf_r -qsuppress=cmpmsg
F90      = bgxlf_r -qfree=f90 -qsuffix=f=f90 -qsuppress=cmpmsg
FFLAGS   = $(OPTFLAGS) $(BGQPERSINC)
FPP      = -qsuffix=cpp=F90
FDOPT    = -WF,-D
LDFLAGS  = $(OPTFLAGS) $(BGQPERSINC)
UTILLIB  = 

#------------------------------------------------------------------------------
# SIONlib Settings
#------------------------------------------------------------------------------

SION_PLATFORM    = -D_SION_BGQ
ARCH             = BGQ

# Library Naming Scheme: see Makefile.defs.linux-gomp
SION_LIBNAME_COM = sioncom_$(BGPREC)
SION_LIBNAME_SER = sionser_$(BGPREC)
SION_LIBNAME_GEN = siongen_$(BGPREC)
SION_LIBNAME_OMP     = sionomp_$(BGPREC)
SION_LIBNAME_MPI     = sionmpi_$(BGPREC)
SION_LIBNAME_OMPI    = sionompi_$(BGPREC)

PARUTILENABLE    = 1

FORTRANENABLE    = 1
FORTRANNAMES     = -D_FORTRANNOUNDERSCORE
SION_LIBNAME_F77_SER = sionser_f77_$(BGPREC)
SION_LIBNAME_F77_MPI = sionmpi_f77_$(BGPREC)
SION_LIBNAME_F90_SER = sionser_f90_$(BGPREC)
SION_LIBNAME_F90_MPI = sionmpi_f90_$(BGPREC)
SION_MODPATH = mod_$(BGPREC)

CXXENABLE            = 1
SION_LIBNAME_CXX_SER = sionser_cxx_$(BGPREC)
SION_LIBNAME_CXX_MPI = sionmpi_cxx_$(BGPREC)

PYTHONENABLE    = 0

SION_DEBUG       = 


#------------------------------------------------------------------------------
# MPI Settings
#------------------------------------------------------------------------------

MPIENABLE = 1
MPICC     = mpixlc_r
MPICXX    = mpixlcxx_r
MPIF77    = mpixlf77_r
MPIF90    = mpixlf90_r
MPILIB    =
PMPILIB   = ${MPILIB}
FMPILIB   = 
FMPIOBJ   = 
MPITEST   = mpi_test mpi_test2
MPIFTEST  = mpi_ftest
MPITESTRUN = runjob -n 4 -p 1 --exp_env SION_ERROR_MSG_RANK --exp_env SION_DEBUG --exp_env SION_DEBUG_MASK --exp_env SION_DEBUG_RANK1 --exp_env SION_DEBUG_RANK2 --exp_env SION_DEBUG_SILENT --exp_env OMP_NUM_THREADS :
MPI_CONFIG_TARGETS  = 

#------------------------------------------------------------------------------
# OpenMP Settings
#------------------------------------------------------------------------------

OMPENABLE  = 1
OMPCC      = $(CC)
OMPCXX     = $(CXX)
OMPF77     = $(F77)
OMPF90     = $(F90)
OMPFLAG    = -qsmp=omp

#------------------------------------------------------------------------------
# Hybrid MPI/OpenMP Settings
#------------------------------------------------------------------------------

HYBENABLE  = 1
HYBCC      = $(MPICC)
HYBCXX     = $(MPICXX)
HYBF77     = $(MPIF77)
HYBF90     = $(MPIF90)
HYBFLAG    = $(OMPFLAG)


#------------------------------------------------------------------------------
# Compression Support
#------------------------------------------------------------------------------

SZLIB          = szlib
SZLIB_OPTFLAGS = -O3
SZLIB_CFLAGS   = -I$(TOPDIR)/utils/szlib -DELG_COMPRESSED
SZLIB_LIBPATH  = -L$(TOPDIR)/utils/szlib
SZLIB_LIB      = -lsc.z

#------------------------------------------------------------------------------
# SIONlib HINTS library
#------------------------------------------------------------------------------
GPFS_HINTS_LIB  = -L/bgsys/drivers/ppcfloor/cnk/lib -lgpfs
GPFS_HINTS_INC  = -I/usr/lpp/mmfs/include
LINUX_HINTS_LIB = -L/usr/lib
LINUX_HINTS_INC = -I/usr/include

HINTSDEF=
HINTSINC=
HINTSLIB=



#------------------------------------------------------------------------------
# SIONlib Cache Settings
#------------------------------------------------------------------------------

CACHEFLAGS=
CACHELIB=
#CACHEFLAGS=-D_SION_CACHE
#CACHELIB=-lrt
