Skip to content
Snippets Groups Projects
Commit 418cc9b2 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

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'
parent f9a956ba
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
...@@ -11,14 +11,14 @@ ...@@ -11,14 +11,14 @@
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
# #
# Script # Script
# wcleanBuild # wcleanBuild, wcleanPlatform
# #
# Usage # Usage
# wcleanBuild <option | platform> [.. <option | platform>] # wcleanBuild <option | platform> [.. <option | platform>]
# #
# Description # Description
# Deletes the specified 'build/' object files directories from the # 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 # special platforms
# - 'all' removes all platforms. # - 'all' removes all platforms.
...@@ -57,7 +57,7 @@ Usage: ${0##*/} <option | platform> [.. <option | platform>] ...@@ -57,7 +57,7 @@ Usage: ${0##*/} <option | platform> [.. <option | platform>]
options: options:
-a, -all Same as 'all' -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) -comp, -compiler Use \$WM_ARCH\$WM_COMPILER* ($WM_ARCH$WM_COMPILER)
-compiler=NAME Use \$WM_ARCH<NAME>* ($WM_ARCH<NAME>*) -compiler=NAME Use \$WM_ARCH<NAME>* ($WM_ARCH<NAME>*)
-h, -help Print the usage -h, -help Print the usage
...@@ -124,7 +124,7 @@ do ...@@ -124,7 +124,7 @@ do
echo echo
break # Removed everything - can stop now break # Removed everything - can stop now
;; ;;
-c | -current | current) -curr | -current | current)
name="$WM_OPTIONS" name="$WM_OPTIONS"
;; ;;
-comp | -compiler | compiler) -comp | -compiler | compiler)
......
...@@ -34,10 +34,8 @@ ...@@ -34,10 +34,8 @@
# lnInclude directories generated for libraries. # lnInclude directories generated for libraries.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/} # Note: need 'Script' for some functions in wmakeFunctions Script=${0##*/} # Use 'Script' for error messages in wmakeFunctions
. ${0%/*}/scripts/wmakeFunctions # Source wmake functions
# Source the wmake functions
. ${0%/*}/scripts/wmakeFunctions
usage() { usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done while [ "$#" -ge 1 ]; do echo "$1"; shift; done
......
scripts/wcleanBuild scripts/wcleanObjects
\ No newline at end of file \ No newline at end of file
scripts/wcleanBuild scripts/wcleanObjects
\ No newline at end of file \ No newline at end of file
...@@ -35,10 +35,8 @@ ...@@ -35,10 +35,8 @@
# the first occurrence. # the first occurrence.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/} Script=${0##*/} # Use 'Script' for error messages in wmakeFunctions
. ${0%/*}/scripts/wmakeFunctions # Source wmake functions
# Source the wmake functions
. ${0%/*}/scripts/wmakeFunctions
usage() { usage() {
exec 1>&2 exec 1>&2
...@@ -92,7 +90,7 @@ sourceFile=$1 ...@@ -92,7 +90,7 @@ sourceFile=$1
if [ ! -e "$sourceFile" ] if [ ! -e "$sourceFile" ]
then then
sourceFile=$(find . -name $sourceFile -print -quit) sourceFile=$(find . -name "$sourceFile" -print -quit)
if [ -z "$sourceFile" ] if [ -z "$sourceFile" ]
then then
echo "$Script: cannot find source file $1" 1>&2 echo "$Script: cannot find source file $1" 1>&2
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM.
...@@ -53,10 +53,8 @@ ...@@ -53,10 +53,8 @@
# wclean, wcleanPlatform, wcleanLnIncludeAll # wclean, wcleanPlatform, wcleanLnIncludeAll
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/} # Note: need 'Script' for some functions in wmakeFunctions Script=${0##*/} # Use 'Script' for error messages in wmakeFunctions
. ${0%/*}/scripts/wmakeFunctions # Source wmake functions
# Source the wmake functions
. ${0%/*}/scripts/wmakeFunctions
usage() { usage() {
exec 1>&2 exec 1>&2
...@@ -106,13 +104,11 @@ make="make" ...@@ -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 nCores=0
allCores() 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} : ${nCores:=1}
} }
...@@ -132,7 +128,7 @@ do ...@@ -132,7 +128,7 @@ do
usage usage
;; ;;
-s | -silent) -s | -silent)
export WM_QUIET=1 export WM_QUIET=true
;; ;;
-a | -all | all) -a | -all | all)
all=all all=all
...@@ -146,10 +142,7 @@ do ...@@ -146,10 +142,7 @@ do
test $# -ge 2 && expr $2 + 1 > /dev/null 2>&1 \ test $# -ge 2 && expr $2 + 1 > /dev/null 2>&1 \
&& shift && nCores=$1 && shift && nCores=$1
if [ "$nCores" = 0 ] [ "$nCores" = 0 ] && allCores
then
allCores
fi
export WM_NCOMPPROCS=$nCores export WM_NCOMPPROCS=$nCores
echo "Compiling enabled on $WM_NCOMPPROCS cores" echo "Compiling enabled on $WM_NCOMPPROCS cores"
;; ;;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM.
...@@ -79,10 +79,7 @@ do ...@@ -79,10 +79,7 @@ do
test $# -ge 2 && expr $2 + 1 > /dev/null 2>&1 \ test $# -ge 2 && expr $2 + 1 > /dev/null 2>&1 \
&& shift && nCores=$1 && shift && nCores=$1
if [ "$nCores" = 0 ] [ "$nCores" = 0 ] && nCores=1
then
nCores=1
fi
;; ;;
# Parallel compilation on specified number of cores # Parallel compilation on specified number of cores
-j[1-9]*) -j[1-9]*)
......
...@@ -17,14 +17,12 @@ ...@@ -17,14 +17,12 @@
# Print the version used when building the project # Print the version used when building the project
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/}
usage() { usage() {
exec 1>&2 exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
Usage: $Script [OPTION] Usage: ${0##*/} [OPTION]
options: options:
-check check the git head commit vs. \$WM_PROJECT_DIR/.build -check check the git head commit vs. \$WM_PROJECT_DIR/.build
(exit code 0 for no changes) (exit code 0 for no changes)
......
...@@ -52,10 +52,8 @@ ...@@ -52,10 +52,8 @@
# $WM_PROJECT_DIR. # $WM_PROJECT_DIR.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/} # Note: need 'Script' for some functions in wmakeFunctions Script=${0##*/} # Use 'Script' for error messages in wmakeFunctions
. ${0%/*}/scripts/wmakeFunctions # Source wmake functions
# Source the wmake functions
. ${0%/*}/scripts/wmakeFunctions
usage() { usage() {
exec 1>&2 exec 1>&2
......
...@@ -35,10 +35,8 @@ ...@@ -35,10 +35,8 @@
# are removed for all platforms rather than just the current platform. # are removed for all platforms rather than just the current platform.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/} # Note: need 'Script' for some functions in wmakeFunctions Script=${0##*/} # Use 'Script' for error messages in wmakeFunctions
. ${0%/*}/scripts/wmakeFunctions # Source wmake functions
# Source the wmake functions
. ${0%/*}/scripts/wmakeFunctions
usage() { usage() {
exec 1>&2 exec 1>&2
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment