/*
 * NB: mplib PINC must appear after PTSCOTCH_INC_DIR to ensure we
 * do not accidentally get a ptscotch header from the MPI distribution.
 */
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)

/* Default is PROJECT LIB/mpi target */
ifeq (,$(strip $(FOAM_MPI_LIBBIN)))
    FOAM_MPI_LIBBIN := $(FOAM_LIBBIN)/$(FOAM_MPI)
endif

EXE_INC = \
    -I$(PTSCOTCH_INC_DIR) \
    -I$(SCOTCH_INC_DIR) \
    $(PFLAGS) $(PINC) \
    -I../decompositionMethods/lnInclude

/*
 * The '-lscotch' is a slight hack:
 * ptscotch 6 requires scotch linked in, but does not declare the dependency
 */
LIB_LIBS = \
    -L$(FOAM_LIBBIN) -ldecompositionMethods \
    -L$(PTSCOTCH_LIB_DIR) \
    -L$(SCOTCH_LIB_DIR) \
    -lscotch \
    -lptscotch

/* errexit, except for windows compile (already in library) */
ifeq (,$(findstring windows,$(WM_OSTYPE)))
    LIB_LIBS += -lptscotcherrexit
endif

/* May require librt, but scotch does not declare the dependency */
ifeq ($(EXT_SO),.so)
    LIB_LIBS += -lrt
endif
