diff --git a/bin/foamEbrowse b/bin/legacy/foamEbrowse
similarity index 100%
rename from bin/foamEbrowse
rename to bin/legacy/foamEbrowse
diff --git a/bin/foamProcessInfo b/bin/legacy/foamProcessInfo
similarity index 100%
rename from bin/foamProcessInfo
rename to bin/legacy/foamProcessInfo
diff --git a/bin/foamTags b/bin/legacy/foamTags
similarity index 100%
rename from bin/foamTags
rename to bin/legacy/foamTags
diff --git a/bin/org-html b/bin/legacy/org-html
similarity index 100%
rename from bin/org-html
rename to bin/legacy/org-html
diff --git a/bin/org-latex b/bin/legacy/org-latex
similarity index 100%
rename from bin/org-latex
rename to bin/legacy/org-latex
diff --git a/bin/org-pdflatex b/bin/legacy/org-pdflatex
similarity index 100%
rename from bin/org-pdflatex
rename to bin/legacy/org-pdflatex
diff --git a/bin/tools/foamListBinDirs b/bin/legacy/tools/foamListBinDirs
similarity index 100%
rename from bin/tools/foamListBinDirs
rename to bin/legacy/tools/foamListBinDirs
diff --git a/bin/tools/foamListSourceFiles b/bin/legacy/tools/foamListSourceFiles
similarity index 100%
rename from bin/tools/foamListSourceFiles
rename to bin/legacy/tools/foamListSourceFiles
diff --git a/bin/tools/foamListThirdPartyBinDirs b/bin/legacy/tools/foamListThirdPartyBinDirs
similarity index 100%
rename from bin/tools/foamListThirdPartyBinDirs
rename to bin/legacy/tools/foamListThirdPartyBinDirs
diff --git a/bin/tools/gtagsrc b/bin/legacy/tools/gtagsrc
similarity index 100%
rename from bin/tools/gtagsrc
rename to bin/legacy/tools/gtagsrc
diff --git a/bin/tools/org-batch b/bin/legacy/tools/org-batch
similarity index 100%
rename from bin/tools/org-batch
rename to bin/legacy/tools/org-batch
diff --git a/bin/findEmptyMake b/bin/tools/findEmptyMake
similarity index 100%
rename from bin/findEmptyMake
rename to bin/tools/findEmptyMake
diff --git a/bin/foamAllHC b/bin/tools/foamAllHC
similarity index 100%
rename from bin/foamAllHC
rename to bin/tools/foamAllHC
diff --git a/bin/foamUpdateCaseFileHeader b/bin/tools/foamUpdateCaseFileHeader
similarity index 100%
rename from bin/foamUpdateCaseFileHeader
rename to bin/tools/foamUpdateCaseFileHeader
diff --git a/etc/codeTemplates/source/foamNewSource b/etc/codeTemplates/source/foamNewSource
index 0e36c4adb4..d3ecd7aaea 100755
--- a/etc/codeTemplates/source/foamNewSource
+++ b/etc/codeTemplates/source/foamNewSource
@@ -110,7 +110,7 @@ else
if [ "$subType" = App -a ! -d Make ]
then
- "${WM_DIR:-$WM_PROJECT_DIR/wmake}/wmakeFilesAndOptions"
+ "${WM_DIR:-$WM_PROJECT_DIR/wmake}/scripts/wmakeFilesAndOptions"
fi
fi
diff --git a/etc/mergeHistory b/etc/mergeHistory
deleted file mode 100644
index b825a958ef..0000000000
--- a/etc/mergeHistory
+++ /dev/null
@@ -1,2 +0,0 @@
-Date SHA1 Commit message
-2015-12-02 9a536b0 fvOptions: Reorganized and updated to simplify use in sub-models and maintenance
diff --git a/wmake/wmakeFilesAndOptions b/wmake/scripts/wmakeFilesAndOptions
similarity index 95%
rename from wmake/wmakeFilesAndOptions
rename to wmake/scripts/wmakeFilesAndOptions
index 19bb585806..8e311a0f21 100755
--- a/wmake/wmakeFilesAndOptions
+++ b/wmake/scripts/wmakeFilesAndOptions
@@ -69,8 +69,8 @@ then
fi
mkdir Make
-[ -e Make/files ] || "${0%/*}"/scripts/makeFiles
-[ -e Make/options ] || "${0%/*}"/scripts/makeOptions
+[ -e Make/files ] || "${0%/*}/makeFiles"
+[ -e Make/options ] || "${0%/*}/makeOptions"
exit 0 # clean exit
diff --git a/wmake/wmake b/wmake/wmake
index 81b32ab548..47a1b40327 100755
--- a/wmake/wmake
+++ b/wmake/wmake
@@ -72,6 +72,7 @@ options:
-j Compile using all local cores/hyperthreads
-jN or -j N Compile using N cores/hyperthreads
-no-scheduler Disable scheduled parallel compilation
+ -pwd Print root directory containing a Make/ directory and exit
-update Update lnInclude directories, dep files, remove deprecated
files and directories
-h | -help Print the usage
@@ -118,7 +119,7 @@ allCores()
#------------------------------------------------------------------------------
# Default to compiling the local target only
-unset all update
+unset all update optPrintRootDir
while [ "$#" -gt 0 ]
do
@@ -159,6 +160,10 @@ do
-no-scheduler)
unset WM_SCHEDULER
;;
+ # Print root directory containing a Make/ directory and exit
+ -pwd)
+ optPrintRootDir=true
+ ;;
# Meant to be used following a pull, this will:
# - remove dep files that depend on deleted files;
# - remove stale dep files;
@@ -224,42 +229,79 @@ fi
unset targetType
MakeDir=Make
-if [ $# -ge 1 ]
+unset dir
+
+if [ -n "$optPrintRootDir" ]
then
- unset dir
- if [ -d "$1" ]
+ if [ $# -ge 1 ]
then
- dir="${1%/}"
- elif [ -f "$1" ]
- then
- dir="${1%/*}"
- : "${dir:=.}"
- else
- targetType="$1"
- fi
+ if [ -d "$1" ]
+ then
+ dir="${1%/}"
+ elif [ -f "$1" ]
+ then
+ dir="${1%/*}"
+ : "${dir:=.}"
+ else
+ echo "$Script error: not a file or directory" 1>&2
+ exit 1
+ fi
- # Specified directory name:
- [ $# -ge 2 ] && dir="${2%/}"
-
- # Specified alternative name for the Make sub-directory:
- [ $# -ge 3 ] && MakeDir="${3%/}"
-
- if [ -n "$dir" ]
- then
- cd $dir 2>/dev/null || {
+ cd "$dir" 2>/dev/null || {
echo "$Script error: could not change to directory '$dir'" 1>&2
exit 1
}
- elif [ -f "$MakeDir/files" ]
- then
- dir="(${PWD##*/})" # Implicit directory information
fi
- # Print command
- echo "$Script $targetType${targetType:+ }$dir"
- unset dir
+ # Locate target with Make/ directory
+ if dir="$(findTarget .)"
+ then
+ (cd "$dir" && pwd -L)
+ exit 0
+ else
+ exit 2
+ fi
+
+else
+
+ if [ $# -ge 1 ]
+ then
+ if [ -d "$1" ]
+ then
+ dir="${1%/}"
+ elif [ -f "$1" ]
+ then
+ dir="${1%/*}"
+ : "${dir:=.}"
+ else
+ targetType="$1"
+ fi
+
+ # Specified directory name:
+ [ $# -ge 2 ] && dir="${2%/}"
+
+ # Specified alternative name for the Make sub-directory:
+ [ $# -ge 3 ] && MakeDir="${3%/}"
+
+ if [ -n "$dir" ]
+ then
+ cd $dir 2>/dev/null || {
+ echo "$Script error: could not change to directory '$dir'" 1>&2
+ exit 1
+ }
+ elif [ -f "$MakeDir/files" ]
+ then
+ dir="(${PWD##*/})" # Implicit directory information
+ fi
+
+ # Print command
+ echo "$Script $targetType${targetType:+ }$dir"
+ unset dir
+ fi
fi
+unset dir
+
#------------------------------------------------------------------------------
# Recurse the source tree to update all
diff --git a/wmake/wmakeLnInclude b/wmake/wmakeLnInclude
index efae4f3a68..02f968bdfd 100755
--- a/wmake/wmakeLnInclude
+++ b/wmake/wmakeLnInclude
@@ -26,7 +26,7 @@
# wmakeLnInclude
#
# Usage
-# wmakeLnInclude [OPTION] [-root |
]
+# wmakeLnInclude [OPTION] [-pwd | ]
#
# Description
# Link all the source files in the directory into /lnInclude
@@ -46,12 +46,12 @@ usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat< into /lnInclude
@@ -72,7 +72,7 @@ USAGE
# Option for 'ln'
optLink="-s"
-unset update optQuiet optRoot
+unset update optQuiet optFindRootDir
while [ "$#" -gt 0 ]
do
@@ -87,8 +87,8 @@ do
-s | -silent)
optQuiet=true
;;
- -root)
- optRoot=true
+ -pwd)
+ optFindRootDir=true
;;
-*)
usage "unknown option: '$1'"
@@ -100,7 +100,7 @@ do
shift
done
-[ "$optRoot" = true ] || [ "$#" -eq 1 ] || \
+[ "$optFindRootDir" = true ] || [ "$#" -eq 1 ] || \
usage "Error: incorrect number of arguments"
#------------------------------------------------------------------------------
@@ -109,7 +109,7 @@ unset dir
baseDir="$1"
# With -root, go on discovery
-if [ "$optRoot" = true ]
+if [ "$optFindRootDir" = true ]
then
if [ -n "$baseDir" ]
then
diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild
deleted file mode 100755
index bafd96bb6c..0000000000
--- a/wmake/wmakePrintBuild
+++ /dev/null
@@ -1,260 +0,0 @@
-#!/bin/sh
-#------------------------------------------------------------------------------
-# ========= |
-# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
-# \\ / O peration |
-# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
-# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-#-------------------------------------------------------------------------------
-# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
-#
-# Script
-# wmakePrintBuild
-#
-# Description
-# Print the version used when building the project
-#
-#------------------------------------------------------------------------------
-# Environment defaults
-: "${WM_DIR:-$WM_PROJECT_DIR/wmake}"
-
-#--------
-usage() {
- exec 1>&2
-
- while [ "$#" -ge 1 ]; do echo "$1"; shift; done
- cat<&2
- echo
- echo "Error encountered:"
- while [ "$#" -ge 1 ]; do echo " $1"; shift; done
- echo
- echo "See '${0##*/} -help' for usage"
- echo
- exit 1
-}
-
-
-#------------------------------------------------------------------------------
-
-cat << WARN_OBSOLETE 1>&2
-###############################################################################
-## The wmakePrintBuild utility is OBSOLETE (Dec-2018). ##
-## The wmakeBuildInfo utility is to be used instead. ##
-###############################################################################
-
-WARN_OBSOLETE
-
-
-#------------------------------------------------------------------------------
-# Parse arguments and options
-#------------------------------------------------------------------------------
-unset checkOnly update package version optApi optShort
-
-while [ "$#" -gt 0 ]
-do
- case "$1" in
- -h | -help*)
- usage
- ;;
- -c | -check)
- checkOnly=true
- ;;
- -major)
- echo ${WM_PROJECT_VERSION:-unknown}
- exit 0
- ;;
- -u | -update)
- update=true
- ;;
- -pkg | -package)
- [ "$#" -ge 2 ] || die "'$1' option requires an argument"
- # Mark empty as 'none', disallow '!' in string
- package=$(echo "${2:-none}" | sed -e 's/!//g')
- shift
- ;;
- -short)
- optShort=true
- ;;
- -v | -version)
- [ "$#" -ge 2 ] || die "'$1' option requires an argument"
- version="$2"
- shift
- ;;
- -api | -plus)
- optApi=true
- break
- ;;
- *)
- die "unknown option/argument: '$1'"
- ;;
- esac
- shift
-done
-
-#------------------------------------------------------------------------------
-
-# Persistent build tag
-build="$WM_PROJECT_DIR/.build"
-
-#------------------------------------------------------------------------------
-# Retrieve old values from the $WM_PROJECT_DIR/.build cache, stored as
-# version [packager]
-#------------------------------------------------------------------------------
-unset oldPackage oldVersion
-getOldValues()
-{
- set -- $(tail -1 $build 2>/dev/null)
- oldVersion="$1"
- [ "$#" -gt 0 ] && shift
- oldPackage="$@"
- [ "${oldPackage:-none}" = none ] && unset oldPackage
-}
-
-#------------------------------------------------------------------------------
-# printTag - output the build tag, reuses the old -package tag if needed
-#------------------------------------------------------------------------------
-printTag()
-{
- if [ "${package:-${oldPackage:-none}}" = none ]
- then
- echo "$version"
- else
- echo "$version ${package:-$oldPackage}"
- fi
-}
-
-
-#------------------------------------------------------------------------------
-# Get the version
-#------------------------------------------------------------------------------
-
-if [ -n "$optApi" ]
-then
- # Extract API version from $WM_DIR/rules/General/general
- # Any of OPENFOAM=, OPENFOAM_API=, OPENFOAM_COM=
- # OPENFOAM_PLUS=
- version=$(
- sed -ne 's@^.*OPENFOAM\(_API\|_COM\|_PLUS\)*=\([0-9][0-9]*\).*@\2@p' \
- $WM_DIR/rules/General/general 2>/dev/null
- )
-
- if [ -n "$version" ]
- then
- echo "$version"
- exit 0
- else
- echo "no wmake definition for OPENFOAM API" 1>&2
- exit 1
- fi
-elif [ -n "$version" ]
-then
- # Specified a version - no error possible
- rc=0
-else
-
- # Abbrev commit hash + data
- # Date format (YYMMDD) for authoring of the commit
- version="$(git --git-dir=$WM_PROJECT_DIR/.git log -1 --date='format:%y%m%d' --format='%h-%ad' 2>/dev/null)"
-
- test -n "$version"
- rc=$?
-fi
-
-
-# Retrieve old values (oldPackage oldVersion)
-getOldValues
-
-if [ -n "$optShort" ]
-then
- unset package oldPackage
-fi
-
-
-#------------------------------------------------------------------------------
-# Update persistent build tag if possible
-#------------------------------------------------------------------------------
-if [ $rc -eq 0 -a -n "$update" ]
-then
- if [ "$version:$package" != "$oldVersion:$oldPackage" ]
- then
- if [ -w "$build" -o \( -w "$WM_PROJECT_DIR" -a ! -e "$build" \) ]
- then
- printTag >| "$build" 2>/dev/null
- fi
- fi
-fi
-
-
-#------------------------------------------------------------------------------
-# Check git vs. persistent build tag
-#------------------------------------------------------------------------------
-if [ -n "$checkOnly" ]
-then
- if [ $rc -eq 0 ]
- then
- test "$version:${package:-$oldPackage}" = "$oldVersion:$oldPackage"
- rc=$?
- if [ $rc -eq 0 ]
- then
- echo "same version as previous build" 1>&2
- else
- echo "version changed from previous build" 1>&2
- fi
- exit $rc
- else
- echo "no git description found" 1>&2
- exit 0
- fi
-fi
-
-
-#------------------------------------------------------------------------------
-# Cannot get git information or -version version
-#------------------------------------------------------------------------------
-if [ $rc -ne 0 ]
-then
- if [ -n "$oldVersion" ]
- then
- # Use previous version info
- version="$oldVersion"
- else
- # Fallback to WM_PROJECT_VERSION alone
- version="${WM_PROJECT_VERSION:-unknown}"
- fi
-fi
-
-
-#------------------------------------------------------------------------------
-# Output the tag
-#------------------------------------------------------------------------------
-printTag
-
-
-#------------------------------------------------------------------------------
diff --git a/wmake/wmakeRoot b/wmake/wmakeRoot
deleted file mode 100755
index 4789c4bf96..0000000000
--- a/wmake/wmakeRoot
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/bin/sh
-#------------------------------------------------------------------------------
-# ========= |
-# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
-# \\ / O peration |
-# \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
-# \\/ M anipulation |
-#-------------------------------------------------------------------------------
-# License
-# This file is part of OpenFOAM.
-#
-# OpenFOAM is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OpenFOAM. If not, see .
-#
-# Script
-# wmakeRoot
-#
-# Description
-# Locate the root directory that has a Make/ directory.
-#
-# See Also
-# wmake
-#
-#------------------------------------------------------------------------------
-Script="${0##*/}" # Use 'Script' for error messages in wmakeFunctions
-. "${0%/*}/scripts/wmakeFunctions" # Source wmake functions
-
-usage() {
- exec 1>&2
- while [ "$#" -ge 1 ]; do echo "$1"; shift; done
- cat<&2
- exit 1
- fi
-
- cd "$dir" 2>/dev/null || {
- echo "$Script error: could not change to directory '$dir'" 1>&2
- exit 1
- }
-fi
-
-
-# Locate target with Make/ directory
-
-if dir="$(findTarget .)"
-then
- (cd "$dir" && pwd -L)
-else
- exit 2
-fi
-
-
-#------------------------------------------------------------------------------