diff --git a/etc/config.csh/mpi b/etc/config.csh/mpi
index 595c1c82d0..58e61af1d6 100644
--- a/etc/config.csh/mpi
+++ b/etc/config.csh/mpi
@@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
-# Copyright (C) 2017-2019 OpenCFD Ltd.
+# Copyright (C) 2017-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.csh/mpi
@@ -80,7 +79,7 @@ case OPENMPI:
breaksw
case USERMPI:
- # Use an arbitrary, user-specified mpi implementation
+ # Arbitrary, user-specified mpi implementation
setenv FOAM_MPI mpi-user
_foamEtc -config mpi-user # <- Adjustments (optional)
breaksw
diff --git a/etc/config.sh/mpi b/etc/config.sh/mpi
index 200b30ddbb..6d0cf4c649 100644
--- a/etc/config.sh/mpi
+++ b/etc/config.sh/mpi
@@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
-# Copyright (C) 2017-2019 OpenCFD Ltd.
+# Copyright (C) 2017-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/mpi
@@ -91,7 +90,7 @@ OPENMPI)
;;
USERMPI)
- # Use an arbitrary, user-specified mpi implementation
+ # Arbitrary, user-specified mpi implementation
export FOAM_MPI=mpi-user
_foamEtc -config mpi-user # <- Adjustments (optional)
;;
diff --git a/src/Pstream/Allwclean b/src/Pstream/Allwclean
index 41b4ec0091..c6b20903e8 100755
--- a/src/Pstream/Allwclean
+++ b/src/Pstream/Allwclean
@@ -1,23 +1,11 @@
#!/bin/sh
-cd "${0%/*}" || exit # Run from this directory
-
-# Clean an mpi-versioned library
-wcleanMpiLib()
-{
- case "$WM_MPLIB" in (*MPI*)
- (
- WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
- for libName
- do
- wclean $libName
- done
- )
- ;;
- esac
-}
-
-
-wclean dummy
-wcleanMpiLib mpi
+cd "${0%/*}" || exit # Run from this directory
+. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
+
+#------------------------------------------------------------------------------
+
+wclean dummy
+
+wcleanLibMpi mpi
#------------------------------------------------------------------------------
diff --git a/src/Pstream/Allwmake b/src/Pstream/Allwmake
index 8673c4ac05..7c89339442 100755
--- a/src/Pstream/Allwmake
+++ b/src/Pstream/Allwmake
@@ -1,37 +1,13 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
+. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
#------------------------------------------------------------------------------
-# Define how to create an mpi-versioned library of $targetType
-# compile into qualified directory
-# use sentinel file to handle version changes
-wmakeMpiLib()
-{
- local objectsDir
- for libName
- do
- (
- WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
- objectsDir="$WM_PROJECT_DIR/build/$WM_OPTIONS/src/Pstream/$libName"
- whichmpi="$objectsDir/using:$FOAM_MPI"
- [ -e "$whichmpi" ] || wclean $libName
- echo "wmake $targetType $libName (mpi=$WM_MPLIB)"
- wmake $targetType $libName
- mkdir -p "$objectsDir"
- touch "$whichmpi"
- )
- done
-}
-
echo "wmake $targetType dummy (mpi=$WM_MPLIB)"
wmake $targetType dummy
-case "$WM_MPLIB" in
-(*MPI*)
- wmakeMpiLib mpi
- ;;
-esac
+wmakeLibMpi mpi
#------------------------------------------------------------------------------
diff --git a/src/parallel/decompose/Allwclean b/src/parallel/decompose/Allwclean
index fe6c9dd2a9..a9d95a9efe 100755
--- a/src/parallel/decompose/Allwclean
+++ b/src/parallel/decompose/Allwclean
@@ -1,27 +1,15 @@
#!/bin/sh
-cd "${0%/*}" || exit # Run from this directory
-
-# Clean an mpi-versioned library
-wcleanMpiLib()
-{
- case "$WM_MPLIB" in (*MPI*)
- (
- WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
- for libName
- do
- wclean $libName
- done
- )
- ;;
- esac
-}
+cd "${0%/*}" || exit # Run from this directory
+. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
+#------------------------------------------------------------------------------
wclean metisDecomp
wclean kahipDecomp
wclean scotchDecomp
wclean decompositionMethods
wclean decompose
-wcleanMpiLib ptscotchDecomp
+
+wcleanLibMpi ptscotchDecomp
#------------------------------------------------------------------------------
diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake
index 755ef7f95e..ad5d2931e6 100755
--- a/src/parallel/decompose/Allwmake
+++ b/src/parallel/decompose/Allwmake
@@ -1,6 +1,7 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
+. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_kahip
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_metis
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_scotch
@@ -10,34 +11,9 @@ cd "${0%/*}" || exit # Run from this directory
: ${FOAM_EXT_LIBBIN:=/usr/lib$WM_COMPILER_LIB_ARCH} # Extra safety?
export FOAM_EXT_LIBBIN
-# Define how to create an mpi-versioned library of $targetType
-# compile into qualified directory
-# use sentinel file(s) to handle version changes
-wmakeMpiLib()
-{
- local decompName="$1"
- local objectsDir
- shift
- for libName
- do
- (
- WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
- objectsDir="$WM_PROJECT_DIR/build/$WM_OPTIONS/src/parallel/decompose/$libName"
- whichmpi="$objectsDir/using:$FOAM_MPI"
- whichdecomp="$objectsDir/using:$decompName"
- [ -e "$whichmpi" ] && [ -e "$whichdecomp" ] || wclean $libName
- echo "wmake $targetType $libName (mpi=$WM_MPLIB)"
- wmake $targetType $libName
- mkdir -p "$objectsDir"
- touch "$whichdecomp" "$whichmpi"
- )
- done
-}
-
wmake $targetType decompositionMethods
wmake $targetType decompose
-
if have_kahip
then
wmake $targetType kahipDecomp
@@ -54,7 +30,7 @@ then
if have_ptscotch
then
- wmakeMpiLib "$SCOTCH_VERSION" ptscotchDecomp
+ wmakeLibMpi ptscotchDecomp "scotch=$SCOTCH_VERSION"
fi
fi
diff --git a/wmake/rules/General/ADIOS1 b/wmake/rules/General/ADIOS1
deleted file mode 100644
index b45241d892..0000000000
--- a/wmake/rules/General/ADIOS1
+++ /dev/null
@@ -1,11 +0,0 @@
-#-------------------------------*- makefile -*---------------------------------
-# ADIOS includes/libraries
-
-sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
-sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
-
-# Obtain compile/link flags via adios_config
-ADIOS_INC := $(shell $(ADIOS1_ARCH_PATH)/bin/adios_config -c)
-ADIOS_LIBS := $(shell $(ADIOS1_ARCH_PATH)/bin/adios_config -l)
-
-#------------------------------------------------------------------------------
diff --git a/wmake/rules/linuxARM7Gcc/mplibHPMPI b/wmake/rules/linuxARM7Gcc/mplibHPMPI
deleted file mode 100644
index c44b3dd3f9..0000000000
--- a/wmake/rules/linuxARM7Gcc/mplibHPMPI
+++ /dev/null
@@ -1,3 +0,0 @@
-PFLAGS =
-PINC = -isystem $(MPI_ARCH_PATH)/include -D_MPICC_H
-PLIBS = -L$(MPI_ARCH_PATH)/lib/linux_ia32 -lmpi
diff --git a/wmake/rules/linuxPPC64Gcc/mplibHPMPI b/wmake/rules/linuxPPC64Gcc/mplibHPMPI
deleted file mode 100644
index d7c4b0cf30..0000000000
--- a/wmake/rules/linuxPPC64Gcc/mplibHPMPI
+++ /dev/null
@@ -1,3 +0,0 @@
-PFLAGS =
-PINC = -isystem $(MPI_ARCH_PATH)/include -D_MPICC_H
-PLIBS = -L$(MPI_ARCH_PATH)/lib/linux_amd64 -lmpi
diff --git a/wmake/rules/linuxPPC64leGcc/mplibHPMPI b/wmake/rules/linuxPPC64leGcc/mplibHPMPI
deleted file mode 100644
index d7c4b0cf30..0000000000
--- a/wmake/rules/linuxPPC64leGcc/mplibHPMPI
+++ /dev/null
@@ -1,3 +0,0 @@
-PFLAGS =
-PINC = -isystem $(MPI_ARCH_PATH)/include -D_MPICC_H
-PLIBS = -L$(MPI_ARCH_PATH)/lib/linux_amd64 -lmpi
diff --git a/wmake/scripts/cmakeFunctions b/wmake/scripts/cmakeFunctions
index 6882e12589..1b560cd6ad 100644
--- a/wmake/scripts/cmakeFunctions
+++ b/wmake/scripts/cmakeFunctions
@@ -37,76 +37,6 @@ export CXXFLAGS="$(wmake -show-cxxflags)"
#------------------------------------------------------------------------------
-#
-# Save build/configure parameter information (dependency) into sentinel file
-#
-# 1 - sentinelFile
-# 2... build/configure parameters
-#
-storeDependency()
-{
- local sentinel="$1"
- local depend
- shift
-
- if [ -n "$sentinel" ]
- then
- mkdir -p "$(dirname "$sentinel")"
-
- echo '# Build/configure parameters' >| "$sentinel"
-
- for depend
- do
- echo "-- $depend"
- done >> "$sentinel"
- fi
- return 0
-}
-
-
-#
-# Check sentinel file(s) to handle changed build/configure parameters
-# such as paraview / vtk version changes
-#
-# 1 - sourceDir
-# 2... build/configure parameters
-#
-sameDependency()
-{
- local sourceDir="$1"
- shift
- local depend objectsDir
- local compare=0
-
- # Where generated files are stored
- objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
- local sentinel="$objectsDir/ThirdParty"
-
- if [ -f "$sentinel" ]
- then
- # Create an .update version
- storeDependency "${sentinel}.update" $@
- cmp "${sentinel}" "${sentinel}.update" >/dev/null 2>&1
- compare=$?
-
- if [ "$compare" -ne 0 ]
- then
- echo "build/configure parameters changed between builds" 1>&2
- fi
-
- else
- # No sentinel file: First time, or failed compilation?
- if [ -f "$objectsDir/CMakeCache.txt" ]
- then
- echo "previous build was incomplete" 1>&2
- compare=1
- fi
- fi
-
- echo "$sentinel"
- return "$compare"
-}
-
# Resolve the location of cmake (if needed) and call with output
# suppressed according to WM_QUIET
diff --git a/wmake/scripts/wmakeFunctions b/wmake/scripts/wmakeFunctions
index 7fdef11fe1..1f8d1f22d9 100644
--- a/wmake/scripts/wmakeFunctions
+++ b/wmake/scripts/wmakeFunctions
@@ -15,7 +15,10 @@
# wmakeFunctions
#
# Description
-# Functions to check wmake environment and find .dep and .o files
+# Support functions for wmake infrastructure.
+# For example, check environment, find .dep and .o files, various
+# wrappers when making libraries.
+#
#------------------------------------------------------------------------------
# Ensure these variables are always defined
@@ -30,10 +33,9 @@ then
fi
-#------------------------------------------------------------------------------
-# Check environment variables
#------------------------------------------------------------------------------
+# Check environment variables
checkEnv()
{
local check failed
@@ -53,11 +55,8 @@ checkEnv()
}
-#------------------------------------------------------------------------------
-# Search up directories tree for the Make sub-directory
-#------------------------------------------------------------------------------
-
-# Return the absolute path for a directory or a file's parent directory
+# Return the absolute (physical) path for a directory or
+# for a file's parent directory
# expandPath dirName
# expandPath fileName
#
@@ -76,6 +75,7 @@ expandPath()
fi
}
+
# Find the target directory, which contains a Make/ directory
# search upwards in its parent directories, but stopping
# when it hits the project root, home, or the file-system root
@@ -199,6 +199,139 @@ removeObjectDir()
}
+# Save build/configure parameter information (dependency) into sentinel file
+#
+# 1 - sentinelFile
+# 2... build/configure parameters
+#
+storeDependency()
+{
+ local sentinel="$1"
+ local depend
+ shift
+
+ if [ -n "$sentinel" ]
+ then
+ mkdir -p "$(dirname "$sentinel")"
+
+ echo '# Build/configure parameters' >| "$sentinel"
+
+ for depend
+ do
+ echo "-- $depend"
+ done >> "$sentinel"
+ fi
+ return 0
+}
+
+
+# Check sentinel file(s) to handle changed build/configure parameters
+# such as paraview / vtk version changes
+#
+# 1 - sourceDir
+# 2... build/configure parameters
+#
+# The additional test for "CMakeCache.txt" helps for cmake projects and
+# has no adverse affect for others
+#
+sameDependency()
+{
+ local sourceDir="$1"
+ shift
+ local objectsDir
+ local compare=0
+
+ # Where generated files are stored
+ objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
+ local sentinel="$objectsDir/ConfigParameters"
+
+ if [ -f "$sentinel" ]
+ then
+ # Create an .update version for comparison
+ storeDependency "${sentinel}.update" $@
+ cmp "${sentinel}" "${sentinel}.update" >/dev/null 2>&1
+ compare=$?
+
+ if [ "$compare" -ne 0 ]
+ then
+ echo "build/configure parameters changed between builds" 1>&2
+ ## cat "${sentinel}.update" 1>&2
+ fi
+
+ else
+ # No sentinel file: First time, or failed compilation?
+ if [ -f "$objectsDir/CMakeCache.txt" ]
+ then
+ echo "previous build was incomplete" 1>&2
+ compare=1
+ fi
+ fi
+
+ echo "$sentinel"
+ return "$compare"
+}
+
+
+# Build a mpi-versioned library (targetType)
+# - use sentinel file(s) to handle paraview version changes
+# compile into qualified directory
+# use sentinel file(s) to handle version changes
+# 1 - libName
+# 2... build/configure information
+#
+# Global variables used:
+# - WM_OPTIONS, WM_MPLIB, FOAM_MPI
+#
+# Requires that WM_MPLIB contain an "MPI" string
+wmakeLibMpi()
+{
+ local libName="$1"
+ shift
+
+ case "$WM_MPLIB" in (*MPI* | *mpi*)
+ (
+ WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
+
+ # Where generated files are stored
+ objectsDir="$(findObjectDir "$libName")" || exit 1 # Fatal
+
+ # Something changed
+ sentinel=$(sameDependency "$libName" "MPLIB=$WM_MPLIB" "MPI=$FOAM_MPI" $@) || \
+ wclean "$libName"
+
+ echo "wmake $targetType $libName (mpi=$WM_MPLIB)"
+ wmake $targetType "$libName" && \
+ storeDependency "$sentinel" "MPLIB=$WM_MPLIB" "MPI=$FOAM_MPI" $@
+ )
+ ;;
+ esac
+}
+
+
+# Clean an mpi-versioned library
+#
+# Global variables used:
+# - WM_OPTIONS, WM_MPLIB
+#
+# Requires that WM_MPLIB contain an "MPI" string
+wcleanLibMpi()
+{
+ case "$WM_MPLIB" in (*MPI* | *mpi*)
+ (
+ WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
+
+ for libName
+ do
+ wclean "$libName"
+ done
+ )
+ ;;
+ esac
+}
+
+
+#------------------------------------------------------------------------------
+
# depToSource depFile
#
# Output: