#
#
# The following variables specify PETSc related info, and can be picked up directly 
# by external packages (like TAO) or PETSc applications that do not use PETSc targets.
#
# PETSC_LIB_DIR          - (defined from $PETSC_DIR) determines where the PETSc libraries are built.
# PETSC_INCLUDE          - locations of include files
# PETSC_[C,F]CPPFLAGS    -  preprocessor flags for *.c, *.F preprocessing
# PETSC_[C,F]SH_LIB_PATH - linker_add_sh_lib_path:sh_lib_path pairs for all the shared library locations
#
PETSC_LIB_DIR	    = ${PETSC_DIR}/lib/${PETSC_ARCH}
PETSC_INCLUDE	    = -I${PETSC_DIR} -I${PETSC_DIR}/bmake/${PETSC_ARCH} -I${PETSC_DIR}/include \
                        ${PACKAGES_INCLUDES} ${TAU_DEFS} ${TAU_INCLUDE} ${PETSC_BLASLAPACK_FLAGS}

PETSC_CC_INCLUDES = ${PETSC_INCLUDE}
PETSC_FC_INCLUDES = ${PETSC_INCLUDE}

PETSC_CCPPFLAGS	    = ${PETSC_CC_INCLUDES} ${PETSCFLAGS} ${CPP_FLAGS} ${CPPFLAGS} -D__SDIR__='"${LOCDIR}"'
PETSC_FCPPFLAGS	    = ${PETSC_FC_INCLUDES} ${PETSCFLAGS} ${FPP_FLAGS} ${FPPFLAGS}
PETSC_C_SH_LIB_PATH = ${CC_LINKER_SLFLAG}${PETSC_LIB_DIR}
PETSC_F_SH_LIB_PATH = ${FC_LINKER_SLFLAG}${PETSC_LIB_DIR}
#
# The following variables are used by PETSc build targets. External Packages (like TAO) can 
# redefine them appropriately.
#
# INSTALL_LIB_DIR   - the location where the libraries are built.
# [C,F]CPPFLAGS     - preprocessor flags for *.c, *.F preprocessing
# [C,F]_SH_LIB_PATH - linker_add_sh_lib_path:sh_lib_path pairs for all the shared library locations
#
INSTALL_LIB_DIR	= ${PETSC_LIB_DIR}
CCPPFLAGS	= ${PETSC_CCPPFLAGS}
FCPPFLAGS	= ${PETSC_FCPPFLAGS}
C_SH_LIB_PATH	= ${PETSC_C_SH_LIB_PATH}
F_SH_LIB_PATH	= ${PETSC_F_SH_LIB_PATH}
#
# The following variables define PETSc compile procedures
#
PETSC_COMPILE         = ${PCC} -c ${PCC_FLAGS} ${CFLAGS} ${CCPPFLAGS}  ${SOURCEC} ${SSOURCE}
PETSC_COMPILE_SINGLE  = ${PCC} -o $*.o -c ${PCC_FLAGS} ${CFLAGS} ${CCPPFLAGS} 
#
# The following additional variables are used by PETSc targets and should not be redefined
#
# LIBNAME    - library name
# SOURCE     - source files
# SSOURCE    - single precision versions of some source code
# OBJS       - object files
# SOBJS      - single precision versions of some object files
#
LIBNAME    = ${INSTALL_LIB_DIR}/${LIBBASE}.${AR_LIB_SUFFIX}
SOURCE     = ${SOURCEC} ${SOURCEF}
OBJS       = ${OBJSC} ${OBJSF}

CLINKER = ${PCC_LINKER} ${PCC_LINKER_FLAGS}
FLINKER = ${FC_LINKER} ${FC_LINKER_FLAGS}
#
# Defines all libraries needed for using linear and nonlinear solvers, 
# and all lower level PETSc components (such as vectors and matrices).
# The order of listing these libraries is important!
#

PETSC_EXTERNAL_LIB_BASIC = ${EXTERNAL_LIB} ${PACKAGES_LIBS} ${PCC_LINKER_LIBS}
PETSC_SYS_LIB_BASIC      = -lpetsc 
PETSC_VEC_LIB_BASIC      = -lpetscvec ${PETSC_SYS_LIB_BASIC}
PETSC_MAT_LIB_BASIC      = -lpetscmat ${PETSC_VEC_LIB_BASIC}
PETSC_DM_LIB_BASIC       = -lpetscdm ${PETSC_MAT_LIB_BASIC}
PETSC_KSP_LIB_BASIC     = -lpetscksp ${PETSC_DM_LIB_BASIC}
PETSC_SNES_LIB_BASIC     = -lpetscsnes ${PETSC_KSP_LIB_BASIC}
PETSC_TS_LIB_BASIC       = -lpetscts ${PETSC_SNES_LIB_BASIC}
PETSC_LIB_BASIC          = ${PETSC_TS_LIB_BASIC}
PETSC_CONTRIB_BASIC      = -lpetsccontrib

PETSC_SYS_LIB     = ${C_SH_LIB_PATH} -L${PETSC_LIB_DIR} ${PETSC_SYS_LIB_BASIC}  ${PETSC_EXTERNAL_LIB_BASIC}
PETSC_VEC_LIB     = ${C_SH_LIB_PATH} -L${PETSC_LIB_DIR} ${PETSC_VEC_LIB_BASIC}  ${PETSC_EXTERNAL_LIB_BASIC}
PETSC_MAT_LIB     = ${C_SH_LIB_PATH} -L${PETSC_LIB_DIR} ${PETSC_MAT_LIB_BASIC}  ${PETSC_EXTERNAL_LIB_BASIC}
PETSC_DM_LIB      = ${C_SH_LIB_PATH} -L${PETSC_LIB_DIR} ${PETSC_DM_LIB_BASIC}   ${PETSC_EXTERNAL_LIB_BASIC}
PETSC_KSP_LIB     = ${C_SH_LIB_PATH} -L${PETSC_LIB_DIR} ${PETSC_KSP_LIB_BASIC}  ${PETSC_EXTERNAL_LIB_BASIC}
PETSC_SNES_LIB    = ${C_SH_LIB_PATH} -L${PETSC_LIB_DIR} ${PETSC_SNES_LIB_BASIC} ${PETSC_EXTERNAL_LIB_BASIC}
PETSC_TS_LIB      = ${C_SH_LIB_PATH} -L${PETSC_LIB_DIR} ${PETSC_TS_LIB_BASIC}   ${PETSC_EXTERNAL_LIB_BASIC}
PETSC_LIB         = ${C_SH_LIB_PATH} -L${PETSC_LIB_DIR} ${PETSC_LIB_BASIC}      ${PETSC_EXTERNAL_LIB_BASIC}
PETSC_CONTRIB     = ${C_SH_LIB_PATH} -L${PETSC_LIB_DIR} ${PETSC_CONTRIB_BASIC}
# no longer required
PETSC_FORTRAN_LIB = 

#-----------------------------------------------------------------------------------------
PETSC_LIB_DIR_COMPLEX = ${PETSC_DIR}/lib/${PETSC_ARCH}
PETSC_SYS_LIB_BASIC_COMPLEX      = -lpetsc 
PETSC_VEC_LIB_BASIC_COMPLEX      = -lpetscvec ${PETSC_SYS_LIB_BASIC_COMPLEX}
PETSC_MAT_LIB_BASIC_COMPLEX      = -lpetscmat ${PETSC_VEC_LIB_BASIC_COMPLEX}
PETSC_DM_LIB_BASIC_COMPLEX       = -lpetscdm ${PETSC_MAT_LIB_BASIC_COMPLEX}
PETSC_KSP_LIB_BASIC_COMPLEX     = -lpetscksp ${PETSC_DM_LIB_BASIC_COMPLEX}
PETSC_SNES_LIB_BASIC_COMPLEX     = -lpetscsnes ${PETSC_KSP_LIB_BASIC_COMPLEX}
PETSC_TS_LIB_BASIC_COMPLEX       = -lpetscts ${PETSC_SNES_LIB_BASIC_COMPLEX}
PETSC_LIB_BASIC_COMPLEX          = ${PETSC_TS_LIB_BASIC_COMPLEX}

PETSC_SYS_LIB_COMPLEX     = -L${PETSC_LIB_COMPLEX_DIR} ${PETSC_SYS_LIB_COMPLEX_BASIC} ${PETSC_EXTERNAL_LIB_BASIC}
PETSC_VEC_LIB_COMPLEX     = -L${PETSC_LIB_COMPLEX_DIR} ${PETSC_VEC_LIB_COMPLEX_BASIC}
PETSC_MAT_LIB_COMPLEX     = -L${PETSC_LIB_COMPLEX_DIR} ${PETSC_MAT_LIB_COMPLEX_BASIC}
PETSC_DM_LIB_COMPLEX      = -L${PETSC_LIB_COMPLEX_DIR} ${PETSC_DM_LIB_COMPLEX_BASIC} 
PETSC_KSP_LIB_COMPLEX    = -L${PETSC_LIB_COMPLEX_DIR} ${PETSC_KSP_LIB_COMPLEX_BASIC}
PETSC_SNES_LIB_COMPLEX    = -L${PETSC_LIB_COMPLEX_DIR} ${PETSC_SNES_LIB_COMPLEX_BASIC}
PETSC_TS_LIB_COMPLEX      = -L${PETSC_LIB_COMPLEX_DIR} ${PETSC_TS_LIB_COMPLEX_BASIC}
PETSC_LIB_COMPLEX         = -L${PETSC_LIB_COMPLEX_DIR} ${PETSC_LIB_COMPLEX_BASIC}

SIEVE_FLAGS = -DALE_USE_DEBUGGING -DALE_HAVE_CXX_ABI -DALE_USE_LOGGING -DALE_LOGGING_USE_EVENTS -DALE_LOGGING_VERBOSE # -DALE_LOGGING_LOG_MEM

#
# ----------------------------------------------------------------------------------------
#
#   Currently ignore this entry
#
PETSC_ADIC_LIB  = -L${PETSC_LIB_DIR} ${PETSC_LIB_BASIC} -lpetscblas -lmpiuni  ${EXTERNAL_LIB_BASIC}
#
# Some variables used to build shared libraries
SHLIBS   = libpetsc libpetscvec libpetscmat libpetscdm libpetscksp libpetscsnes libpetscts libpetsccontrib
#
# The following include files set customized site, optimization, and version
# options.
#
include ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf
