#
#  This file is part of MUMPS 5.5.1, released
#  on Tue Jul 12 13:17:24 UTC 2022
#
#
#Begin orderings

# NOTE that PORD is distributed within MUMPS by default. It is recommended to
# install other orderings. For that, you need to obtain the corresponding package
# and modify the variables below accordingly.
# For example, to have Metis available within MUMPS:
#          1/ download Metis and compile it
#          2/ uncomment (suppress # in first column) lines
#             starting with LMETISDIR,  LMETIS
#          3/ add -Dmetis in line ORDERINGSF
#             ORDERINGSF  = -Dpord -Dmetis
#          4/ Compile and install MUMPS
#             make clean; make   (to clean up previous installation)
#
#          Metis/ParMetis and SCOTCH/PT-SCOTCH (ver 6.0 and later) orderings are recommended.
#

#SCOTCHDIR  = ${HOME}/scotch_6.0
#ISCOTCH    = -I$(SCOTCHDIR)/include
#
# You have to choose one among the following two lines depending on
# the type of analysis you want to perform. If you want to perform only
# sequential analysis choose the first (remember to add -Dscotch in the ORDERINGSF
# variable below); for both parallel and sequential analysis choose the second 
# line (remember to add -Dptscotch in the ORDERINGSF variable below)

#LSCOTCH    = -L$(SCOTCHDIR)/lib -lesmumps -lscotch -lscotcherr
#LSCOTCH    = -L$(SCOTCHDIR)/lib -lptesmumps -lptscotch -lptscotcherr


LPORDDIR = $(topdir)/PORD/lib/
IPORD    = -I$(topdir)/PORD/include/
LPORD    = -L$(LPORDDIR) -lpord

#
# The following section deals with Vector Host offloading of scalar code
# like METIS or symbolic factorization. By default it is activated. If you
# prefer run all code on the VE (not recommended), set WITH_VHOFFLOAD to no.
# Activation is recommended for optimal performance.
#
# In case WITH_VHOFFLOAD is set to yes, Make.inc/Makefile.NEC.VH should
# be edited (e.g. to provide the path to METIS library on the Vector Host)

WITH_VHOFFLOAD := yes

ifeq ($(WITH_VHOFFLOAD),yes)

include $(topdir)/Make.inc/Makefile.NEC.VH

else

#LMETISDIR = -L/opt/metis-5.1.0/build/ve/libmetis
#IMETIS    = -I/opt/metis-5.1.0/include

# You have to choose one among the following two lines depending on
# the type of analysis you want to perform. If you want to perform only
# sequential analysis choose the first (remember to add -Dmetis in the ORDERINGSF
# variable below); for both parallel and sequential analysis choose the second 
# line (remember to add -Dparmetis in the ORDERINGSF variable below)

#LMETIS    = -L$(LMETISDIR) -lmetis
#LMETIS    = -L$(LMETISDIR) -lparmetis -lmetis
endif

# The following variables will be used in the compilation process.
# Please note that -Dptscotch and -Dparmetis imply -Dscotch and -Dmetis respectively.
# If you want to use Metis 4.X or an older version, you should use -Dmetis4 instead of -Dmetis
# or in addition with -Dparmetis (if you are using parmetis 3.X or older).
#ORDERINGSF = -Dscotch -Dmetis -Dpord -Dptscotch -Dparmetis
ORDERINGSF += -Dpord
ORDERINGSC += $(ORDERINGSF)

LORDERINGS  = $(LMETIS) $(LPORD) $(LSCOTCH)
IORDERINGSF = $(ISCOTCH)
IORDERINGSC = $(IMETIS) $(IPORD) $(ISCOTCH)

#End orderings
################################################################################
PLAT    =
LIBEXT  = .a
LIBEXT_SHARED  = .so
FPIC_OPT = -fPIC
# Adapt/uncomment RPATH_OPT to avoid modifying
# LD_LIBRARY_PATH in case of shared libraries
# RPATH_OPT = -Wl,-rpath,/path/to/MUMPS_x.y.z/lib/
OUTC    = -o 
OUTF    = -o 
RM      = rm -f
CC      = mpincc
FC      = mpinfort
FL      = mpinfort
AR      = nar vr 
RANLIB  = echo

LAPACK  = -llapack
SCALAP  = -lscalapack

#INCPAR = 
LIBPAR  = $(SCALAP) $(LAPACK)

LIBBLAS = -lblas_openmp
LIBOTHERS = -lpthread

#Preprocessor defs for calling Fortran from C (-DAdd_ or -DAdd__ or -DUPPER)
CDEFS   = -DAdd_

#
# Inline basics
#
STRIP_TOPDIR = $(strip $(topdir))
MUMPS_INLINE_LIST = -finline-functions -finline-max-depth=5 -finline-max-function-size=250
#
# Inline search on the whole directory
#
MUMPS_INLINE_LIST += -finline-directory=$(STRIP_TOPDIR)/src

#Begin Optimization options
OPTF   += -O2 -fpp -fopenmp -Wobsolescent -Wextension -Wall -Woverflow $(MUMPS_INLINE_LIST) # -DGEMMT_AVAILABLE
OPTL   = -O2 -fopenmp
OPTC   = -O2 -fopenmp -Wall
#End Optimization options

 

INCS = $(INCPAR)
LIBS = $(LIBPAR)
LIBSEQNEEDED =
