STYLE: minor adjustments in wmake scripts.

- comments
- avoid egrep for getting processor count.
- wcleanBuild, wcleanPlatform with shorter form '-curr' instead of '-c'
  to avoid any potential user confusion with '-comp'
This commit is contained in:
Mark Olesen
2018-07-22 18:28:29 +02:00
parent f9a956ba7e
commit 418cc9b268
10 changed files with 26 additions and 46 deletions

View File

@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
@ -11,14 +11,14 @@
# <http://www.gnu.org/licenses/>.
#
# Script
# wcleanBuild
# wcleanBuild, wcleanPlatform
#
# Usage
# wcleanBuild <option | platform> [.. <option | platform>]
#
# Description
# Deletes the specified 'build/' object files directories from the
# the project top-level 'build/' directory $WM_PROJECT_DIR.
# project top-level 'build/' directory $WM_PROJECT_DIR.
#
# special platforms
# - 'all' removes all platforms.
@ -57,7 +57,7 @@ Usage: ${0##*/} <option | platform> [.. <option | platform>]
options:
-a, -all Same as 'all'
-c, -current Use \$WM_OPTIONS ($WM_OPTIONS)
-curr, -current Use \$WM_OPTIONS ($WM_OPTIONS)
-comp, -compiler Use \$WM_ARCH\$WM_COMPILER* ($WM_ARCH$WM_COMPILER)
-compiler=NAME Use \$WM_ARCH<NAME>* ($WM_ARCH<NAME>*)
-h, -help Print the usage
@ -124,7 +124,7 @@ do
echo
break # Removed everything - can stop now
;;
-c | -current | current)
-curr | -current | current)
name="$WM_OPTIONS"
;;
-comp | -compiler | compiler)

View File

@ -34,10 +34,8 @@
# lnInclude directories generated for libraries.
#
#------------------------------------------------------------------------------
Script=${0##*/} # Note: need 'Script' for some functions in wmakeFunctions
# Source the wmake functions
. ${0%/*}/scripts/wmakeFunctions
Script=${0##*/} # Use 'Script' for error messages in wmakeFunctions
. ${0%/*}/scripts/wmakeFunctions # Source wmake functions
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done

View File

@ -1 +1 @@
scripts/wcleanBuild
scripts/wcleanObjects

View File

@ -1 +1 @@
scripts/wcleanBuild
scripts/wcleanObjects

View File

@ -35,10 +35,8 @@
# the first occurrence.
#
#------------------------------------------------------------------------------
Script=${0##*/}
# Source the wmake functions
. ${0%/*}/scripts/wmakeFunctions
Script=${0##*/} # Use 'Script' for error messages in wmakeFunctions
. ${0%/*}/scripts/wmakeFunctions # Source wmake functions
usage() {
exec 1>&2
@ -92,7 +90,7 @@ sourceFile=$1
if [ ! -e "$sourceFile" ]
then
sourceFile=$(find . -name $sourceFile -print -quit)
sourceFile=$(find . -name "$sourceFile" -print -quit)
if [ -z "$sourceFile" ]
then
echo "$Script: cannot find source file $1" 1>&2

View File

@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@ -53,10 +53,8 @@
# wclean, wcleanPlatform, wcleanLnIncludeAll
#
#------------------------------------------------------------------------------
Script=${0##*/} # Note: need 'Script' for some functions in wmakeFunctions
# Source the wmake functions
. ${0%/*}/scripts/wmakeFunctions
Script=${0##*/} # Use 'Script' for error messages in wmakeFunctions
. ${0%/*}/scripts/wmakeFunctions # Source wmake functions
usage() {
exec 1>&2
@ -106,13 +104,11 @@ make="make"
#------------------------------------------------------------------------------
# Set nCores to the number of cores on the local machine
# Set nCores to the number of cores on the machine
nCores=0
allCores()
{
nCores=$(egrep -c "^processor" /proc/cpuinfo 2>/dev/null) || \
nCores=$(getconf _NPROCESSORS_ONLN 2>/dev/null) || \
nCores=1
nCores=$(getconf _NPROCESSORS_ONLN 2>/dev/null) || nCores=1
: ${nCores:=1}
}
@ -132,7 +128,7 @@ do
usage
;;
-s | -silent)
export WM_QUIET=1
export WM_QUIET=true
;;
-a | -all | all)
all=all
@ -146,10 +142,7 @@ do
test $# -ge 2 && expr $2 + 1 > /dev/null 2>&1 \
&& shift && nCores=$1
if [ "$nCores" = 0 ]
then
allCores
fi
[ "$nCores" = 0 ] && allCores
export WM_NCOMPPROCS=$nCores
echo "Compiling enabled on $WM_NCOMPPROCS cores"
;;

View File

@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation |
# \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@ -79,10 +79,7 @@ do
test $# -ge 2 && expr $2 + 1 > /dev/null 2>&1 \
&& shift && nCores=$1
if [ "$nCores" = 0 ]
then
nCores=1
fi
[ "$nCores" = 0 ] && nCores=1
;;
# Parallel compilation on specified number of cores
-j[1-9]*)

View File

@ -17,14 +17,12 @@
# Print the version used when building the project
#
#------------------------------------------------------------------------------
Script=${0##*/}
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
Usage: $Script [OPTION]
Usage: ${0##*/} [OPTION]
options:
-check check the git head commit vs. \$WM_PROJECT_DIR/.build
(exit code 0 for no changes)

View File

@ -52,10 +52,8 @@
# $WM_PROJECT_DIR.
#
#------------------------------------------------------------------------------
Script=${0##*/} # Note: need 'Script' for some functions in wmakeFunctions
# Source the wmake functions
. ${0%/*}/scripts/wmakeFunctions
Script=${0##*/} # Use 'Script' for error messages in wmakeFunctions
. ${0%/*}/scripts/wmakeFunctions # Source wmake functions
usage() {
exec 1>&2

View File

@ -35,10 +35,8 @@
# are removed for all platforms rather than just the current platform.
#
#------------------------------------------------------------------------------
Script=${0##*/} # Note: need 'Script' for some functions in wmakeFunctions
# Source the wmake functions
. ${0%/*}/scripts/wmakeFunctions
Script=${0##*/} # Use 'Script' for error messages in wmakeFunctions
. ${0%/*}/scripts/wmakeFunctions # Source wmake functions
usage() {
exec 1>&2