diff --git a/bin/foamCleanTutorials b/bin/foamCleanTutorials
index d2d1eeb153..39eb05dc2d 100755
--- a/bin/foamCleanTutorials
+++ b/bin/foamCleanTutorials
@@ -20,7 +20,7 @@
# and all its subdirectories.
#
#------------------------------------------------------------------------------
-. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
+. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
thisScript="$0"
if [ "/${thisScript#/}" != "$thisScript" ]
@@ -41,6 +41,7 @@ options:
Recursively clean an OpenFOAM case directory.
By default uses Allclean, Allwclean when present.
+The -skipFirst option is the same as -self.
USAGE
exit 0 # clean exit
@@ -80,7 +81,7 @@ then
exit 2
}
;;
- -self*)
+ -self* | -skipFirst)
skipSelf=true
;;
--)
@@ -133,7 +134,7 @@ else
# Recurse into subdirectories
for caseName in *
do
- ( cd $caseName 2>/dev/null && "$thisScript" )
+ ( cd "$caseName" 2>/dev/null && "$thisScript" )
done
fi
diff --git a/bin/foamRunTutorials b/bin/foamRunTutorials
index 27553b651d..d64576ce8a 100755
--- a/bin/foamRunTutorials
+++ b/bin/foamRunTutorials
@@ -41,12 +41,13 @@ printHelp() {
Usage: ${0##*/} [OPTION]
options:
-case
specify starting directory, default is cwd
- -self | -skipFirst avoid Allrun, Alltest script (prevent infinite recursion)
+ -self avoid Allrun, Alltest script (prevent infinite recursion)
-test prefer Alltest script, pass -test argument to scripts
-help print the usage
Recursively run Allrun/Alltest or blockMesh+application,
starting with the current directory or the specified -case directory.
+The -skipFirst option is the same as -self.
USAGE
exit 0 # clean exit
diff --git a/modules/Allwmake b/modules/Allwmake
index cd8a210624..1a6ca94867 100755
--- a/modules/Allwmake
+++ b/modules/Allwmake
@@ -10,29 +10,8 @@ targetType=libso
: "${FOAM_MODULE_PREFIX:=${FOAM_LIBBIN%/*}}"
export FOAM_MODULE_PREFIX
-
-#------------------------------------------------------------------------------
-
-# Skip some directory names
-filterDir() {
- case "$1" in
- (build | platforms | doc)
- echo ""
- ;;
- (*)
- echo "$1"
- ;;
- esac
-}
-
-
-# Build each first-level directory with an Allwmake* file
-for moduleName in \
- $(find . -mindepth 2 -maxdepth 2 -name 'Allwmake*' -print | \
- sed -e 's@^\./@@; s@/.*$@@;' | sort | uniq)
+for moduleName in $(./list-modules)
do
- moduleName="$(filterDir "$moduleName")"
-
if [ -d "$moduleName" ]
then
( cd "$moduleName" && wmake -all $targetType )
diff --git a/modules/list-modules b/modules/list-modules
new file mode 100755
index 0000000000..c41c57d466
--- /dev/null
+++ b/modules/list-modules
@@ -0,0 +1,84 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# ========= |
+# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+# \\ / O peration |
+# \\ / A nd | www.openfoam.com
+# \\/ M anipulation |
+#------------------------------------------------------------------------------
+# SPDX-License-Identifier: (GPL-3.0+)
+# Copyright (C) 2020 OpenCFD Ltd.
+#------------------------------------------------------------------------------
+# Script
+# list-modules
+#
+# Description
+# List module directories
+# - each first-level directory with an Allwmake file
+#
+#------------------------------------------------------------------------------
+cd "${0%/*}" || exit # Run from this directory
+
+printHelp() {
+ cat<< HELP 1>&2
+
+Usage: ${0##*/} [OPTION]
+options:
+ -help Display help and exit
+
+List module directories - each first-level directory with an Allwmake file
+
+HELP
+
+ exit 0 # A clean exit
+}
+
+# Report error and exit
+die()
+{
+ exec 1>&2
+ echo
+ echo "Error encountered:"
+ while [ "$#" -ge 1 ]; do echo " $1"; shift; done
+ echo
+ echo "See '${0##*/} -help' for usage"
+ echo
+ exit 1
+}
+
+#------------------------------------------------------------------------------
+
+# Parse options
+while [ "$#" -gt 0 ]
+do
+ case "$1" in
+ -h | -help*) # Short help
+ printHelp
+ ;;
+
+ *)
+ die "Unknown option/argument: '$1'"
+ ;;
+ esac
+ shift
+done
+
+
+# Each first-level directory with an Allwmake file
+for moduleName in *
+do
+ if [ -f "$moduleName/Allwmake" ]
+ then
+ case "$moduleName" in
+ # Skip some directory names
+ (build | doc | platform*)
+ ;;
+ (*)
+ echo "$moduleName"
+ ;;
+ esac
+ fi
+done
+
+
+#------------------------------------------------------------------------------
diff --git a/wmake/scripts/have_adios2 b/wmake/scripts/have_adios2
index 3f9635392c..2283006b4d 100644
--- a/wmake/scripts/have_adios2
+++ b/wmake/scripts/have_adios2
@@ -45,9 +45,9 @@ no_adios2()
echo_adios2()
{
echo "adios2=${HAVE_ADIOS2:-false}"
- echo "root=$ADIOS2_ARCH_PATH"
- echo "include=$ADIOS2_INC_DIR"
- echo "library=$ADIOS2_LIB_DIR"
+ echo "root=\"$ADIOS2_ARCH_PATH\""
+ echo "include=\"$ADIOS2_INC_DIR\""
+ echo "library=\"$ADIOS2_LIB_DIR\""
}
diff --git a/wmake/scripts/have_boost b/wmake/scripts/have_boost
index 301d2c3be6..95886c82c1 100644
--- a/wmake/scripts/have_boost
+++ b/wmake/scripts/have_boost
@@ -45,9 +45,9 @@ no_boost()
echo_boost()
{
echo "boost=${HAVE_BOOST:-false}"
- echo "root=$BOOST_ARCH_PATH"
- echo "include=$BOOST_INC_DIR"
- echo "library=$BOOST_LIB_DIR"
+ echo "root=\"$BOOST_ARCH_PATH\""
+ echo "include=\"$BOOST_INC_DIR\""
+ echo "library=\"$BOOST_LIB_DIR\""
}
diff --git a/wmake/scripts/have_ccmio b/wmake/scripts/have_ccmio
index badeee322c..68050081db 100644
--- a/wmake/scripts/have_ccmio
+++ b/wmake/scripts/have_ccmio
@@ -44,9 +44,9 @@ no_ccmio()
echo_ccmio()
{
echo "ccmio=${HAVE_CCMIO:-false}"
- echo "root=$CCMIO_ARCH_PATH"
- echo "include=$CCMIO_INC_DIR"
- echo "library=$CCMIO_LIB_DIR"
+ echo "root=\"$CCMIO_ARCH_PATH\""
+ echo "include=\"$CCMIO_INC_DIR\""
+ echo "library=\"$CCMIO_LIB_DIR\""
}
diff --git a/wmake/scripts/have_cgal b/wmake/scripts/have_cgal
index 94a247ab3c..eaf1973103 100644
--- a/wmake/scripts/have_cgal
+++ b/wmake/scripts/have_cgal
@@ -50,9 +50,9 @@ echo_cgal()
{
echo "cgal=${HAVE_CGAL:-false}"
echo "flavour=$CGAL_FLAVOUR"
- echo "root=$CGAL_ARCH_PATH"
- echo "include=$CGAL_INC_DIR"
- echo "library=$CGAL_LIB_DIR"
+ echo "root=\"$CGAL_ARCH_PATH\""
+ echo "include=\"$CGAL_INC_DIR\""
+ echo "library=\"$CGAL_LIB_DIR\""
}
diff --git a/wmake/scripts/have_fftw b/wmake/scripts/have_fftw
index 634e2af808..281669c248 100644
--- a/wmake/scripts/have_fftw
+++ b/wmake/scripts/have_fftw
@@ -45,9 +45,9 @@ no_fftw()
echo_fftw()
{
echo "fftw=${HAVE_FFTW:-false}"
- echo "root=$FFTW_ARCH_PATH"
- echo "include=$FFTW_INC_DIR"
- echo "library=$FFTW_LIB_DIR"
+ echo "root=\"$FFTW_ARCH_PATH\""
+ echo "include=\"$FFTW_INC_DIR\""
+ echo "library=\"$FFTW_LIB_DIR\""
}
diff --git a/wmake/scripts/have_hypre b/wmake/scripts/have_hypre
index cf456b847d..bfe4c9a766 100644
--- a/wmake/scripts/have_hypre
+++ b/wmake/scripts/have_hypre
@@ -45,9 +45,9 @@ no_hypre()
echo_hypre()
{
echo "hypre=${HAVE_HYPRE:-false}"
- echo "root=$HYPRE_ARCH_PATH"
- echo "include=$HYPRE_INC_DIR"
- echo "library=$HYPRE_LIB_DIR"
+ echo "root=\"$HYPRE_ARCH_PATH\""
+ echo "include=\"$HYPRE_INC_DIR\""
+ echo "library=\"$HYPRE_LIB_DIR\""
}
diff --git a/wmake/scripts/have_kahip b/wmake/scripts/have_kahip
index 0f5da3a254..04ccc8643e 100644
--- a/wmake/scripts/have_kahip
+++ b/wmake/scripts/have_kahip
@@ -45,9 +45,9 @@ no_kahip()
echo_kahip()
{
echo "kahip=${HAVE_KAHIP:-false}"
- echo "root=$KAHIP_ARCH_PATH"
- echo "include=$KAHIP_INC_DIR"
- echo "library=$KAHIP_LIB_DIR"
+ echo "root=\"$KAHIP_ARCH_PATH\""
+ echo "include=\"$KAHIP_INC_DIR\""
+ echo "library=\"$KAHIP_LIB_DIR\""
}
diff --git a/wmake/scripts/have_metis b/wmake/scripts/have_metis
index 8da19e4a82..7b545d9064 100644
--- a/wmake/scripts/have_metis
+++ b/wmake/scripts/have_metis
@@ -45,9 +45,9 @@ no_metis()
echo_metis()
{
echo "metis=${HAVE_METIS:-false}"
- echo "root=$METIS_ARCH_PATH"
- echo "include=$METIS_INC_DIR"
- echo "library=$METIS_LIB_DIR"
+ echo "root=\"$METIS_ARCH_PATH\""
+ echo "include=\"$METIS_INC_DIR\""
+ echo "library=\"$METIS_LIB_DIR\""
}
diff --git a/wmake/scripts/have_mgridgen b/wmake/scripts/have_mgridgen
index f374e7c375..6c00f401e0 100644
--- a/wmake/scripts/have_mgridgen
+++ b/wmake/scripts/have_mgridgen
@@ -45,9 +45,9 @@ no_mgridgen()
echo_mgridgen()
{
echo "mgridgen=${HAVE_MGRIDGEN:-false}"
- echo "root=$MGRIDGEN_ARCH_PATH"
- echo "include=$MGRIDGEN_INC_DIR"
- echo "library=$MGRIDGEN_LIB_DIR"
+ echo "root=\"$MGRIDGEN_ARCH_PATH\""
+ echo "include=\"$MGRIDGEN_INC_DIR\""
+ echo "library=\"$MGRIDGEN_LIB_DIR\""
}
diff --git a/wmake/scripts/have_petsc b/wmake/scripts/have_petsc
index e6690f0299..2524523c75 100644
--- a/wmake/scripts/have_petsc
+++ b/wmake/scripts/have_petsc
@@ -46,9 +46,9 @@ no_petsc()
echo_petsc()
{
echo "petsc=${HAVE_PETSC:-false}"
- echo "root=$PETSC_ARCH_PATH"
- echo "include=$PETSC_INC_DIR"
- echo "library=$PETSC_LIB_DIR"
+ echo "root=\"$PETSC_ARCH_PATH\""
+ echo "include=\"$PETSC_INC_DIR\""
+ echo "library=\"$PETSC_LIB_DIR\""
}
diff --git a/wmake/scripts/have_readline b/wmake/scripts/have_readline
index 2b3ab9edfa..16b0bba5e4 100644
--- a/wmake/scripts/have_readline
+++ b/wmake/scripts/have_readline
@@ -43,8 +43,8 @@ no_readline()
echo_readline()
{
echo "readline=${HAVE_LIBREADLINE:-false}"
- echo "include=$READLINE_INC_DIR"
- echo "library=$READLINE_LIB_DIR"
+ echo "include=\"$READLINE_INC_DIR\""
+ echo "library=\"$READLINE_LIB_DIR\""
}
diff --git a/wmake/scripts/have_scotch b/wmake/scripts/have_scotch
index 8f8a33d3dd..ca00bba6fc 100644
--- a/wmake/scripts/have_scotch
+++ b/wmake/scripts/have_scotch
@@ -55,14 +55,14 @@ no_scotch()
echo_scotch()
{
echo "scotch=${HAVE_SCOTCH:-false}"
- echo "root=$SCOTCH_ARCH_PATH"
- echo "include=$SCOTCH_INC_DIR"
- echo "library=$SCOTCH_LIB_DIR"
+ echo "root=\"$SCOTCH_ARCH_PATH\""
+ echo "include=\"$SCOTCH_INC_DIR\""
+ echo "library=\"$SCOTCH_LIB_DIR\""
echo
echo "ptscotch=${HAVE_PTSCOTCH:-false}"
- echo "root=$PTSCOTCH_ARCH_PATH"
- echo "include=$PTSCOTCH_INC_DIR"
- echo "library=$PTSCOTCH_LIB_DIR"
+ echo "root=\"$PTSCOTCH_ARCH_PATH\""
+ echo "include=\"$PTSCOTCH_INC_DIR\""
+ echo "library=\"$PTSCOTCH_LIB_DIR\""
}
diff --git a/wmake/scripts/have_zoltan b/wmake/scripts/have_zoltan
index d212eb12ba..b78fcbcdaf 100644
--- a/wmake/scripts/have_zoltan
+++ b/wmake/scripts/have_zoltan
@@ -44,9 +44,9 @@ no_zoltan()
echo_zoltan()
{
echo "zoltan=${HAVE_ZOLTAN:-false}"
- echo "root=$ZOLTAN_ARCH_PATH"
- echo "include=$ZOLTAN_INC_DIR"
- echo "library=$ZOLTAN_LIB_DIR"
+ echo "root=\"$ZOLTAN_ARCH_PATH\""
+ echo "include=\"$ZOLTAN_INC_DIR\""
+ echo "library=\"$ZOLTAN_LIB_DIR\""
}
diff --git a/wmake/scripts/paraviewFunctions b/wmake/scripts/paraviewFunctions
index dc80705975..1791ce5004 100644
--- a/wmake/scripts/paraviewFunctions
+++ b/wmake/scripts/paraviewFunctions
@@ -53,9 +53,9 @@ no_paraview()
echo_paraview()
{
echo "paraview=${HAVE_PVPLUGIN_SUPPORT:-false}"
- echo "root=$ParaView_DIR"
- echo "include=$PARAVIEW_INC_DIR"
- echo "plugin=$FOAM_PV_PLUGIN_LIBBIN"
+ echo "root=\"$ParaView_DIR\""
+ echo "include=\"$PARAVIEW_INC_DIR\""
+ echo "plugin=\"$FOAM_PV_PLUGIN_LIBBIN\""
echo "api=$PARAVIEW_API"
}