ENH: allow silent operation (-s) for wmake, wclean, wmakeLnInclude

- reduces verbosity for dynamicCode

- non-silent wmakeLnInclude output to stderr to avoid polluting logs
This commit is contained in:
Mark Olesen
2011-03-08 09:32:30 +01:00
parent e0311539fc
commit 82ba4e5419
5 changed files with 68 additions and 24 deletions

View File

@ -523,7 +523,7 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const
bool Foam::dynamicCode::wmakeLibso() const
{
const Foam::string wmakeCmd("wmake libso " + this->codeRelPath());
const Foam::string wmakeCmd("wmake -s libso " + this->codeRelPath());
Info<< "Invoking " << wmakeCmd << endl;
if (Foam::system(wmakeCmd))

View File

@ -1,4 +1,4 @@
#------------------------------------------------------------------------------
#-------------------------------*- makefile -*---------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |

View File

@ -40,6 +40,7 @@ Usage: $Script [OPTION] [dir]
$Script [OPTION] target [dir [MakeDir]]
options:
-s | -silent ignored - for compatibility with wmake
-help print the usage
Clean up the wmake control directory Make/\$WM_OPTIONS and remove the
@ -55,11 +56,25 @@ USAGE
exit 1
}
# provide immediate help
if [ "$1" = "-h" -o "$1" = "-help" ]
then
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
fi
;;
-s | -silent) # ignored - for compatibility with wmake
shift
;;
-*)
usage "unknown option: '$*'"
;;
*)
break
;;
esac
done
#------------------------------------------------------------------------------

View File

@ -40,8 +40,10 @@ Usage: $Script [OPTION] [dir]
$Script [OPTION] target [dir [MakeDir]]
options:
-s | -silent invoke make in 'silent' mode (do not echo commands)
-help print the usage
A general, easy-to-use make system for multi-platform development
The 'target' is a Makefile target:
@ -59,12 +61,28 @@ USAGE
exit 1
}
# provide immediate help, even if environment is not set
if [ "$1" = "-h" -o "$1" = "-help" ]
then
usage
fi
# normally use "make"
make="make"
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-s | -silent)
make="$make -s"
shift
;;
-*)
usage "unknown option: '$*'"
;;
*)
break
;;
esac
done
#
# check environment variables
@ -77,6 +95,7 @@ do
}
done
# when compiling anything but a standalone exe:
# WM_PROJECT and WM_PROJECT_DIR must be set
[ "$1" = exe -o \( "$WM_PROJECT" -a "$WM_PROJECT_DIR" \) ] || {
@ -91,8 +110,6 @@ done
# Select the version of make to be used
#------------------------------------------------------------------------------
make="make"
# set WM_NCOMPPROCS automatically when both WM_HOSTS and WM_SCHEDULER are set
if [ -z "$WM_NCOMPPROCS" -a -n "$WM_HOSTS" -a -n "$WM_SCHEDULER" ]
then
@ -113,7 +130,7 @@ then
mkdir -p $lockDir
fi
make="make --no-print-directory -j "$WM_NCOMPPROCS
make="$make --no-print-directory -j "$WM_NCOMPPROCS
fi
fi

View File

@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
@ -40,10 +40,16 @@
Script=${0##*/}
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: $Script [-f] <dir>
Usage: $Script [OPTION] dir
options:
-f | -force force update
-s | -silent use 'silent' mode (do not echo command)
-help print the usage
Link all the source files in the <dir> into <dir>/lnInclude
@ -63,7 +69,7 @@ unset findOpt
# default 'ln' option
lnOpt="-s"
unset forceUpdate
unset forceUpdate silentOpt
# simple parse options
while [ "$#" -gt 0 ]
@ -72,10 +78,14 @@ do
-h | -help) # provide immediate help
usage
;;
-f)
shift
-f | -force)
forceUpdate=true
lnOpt="-sf"
shift
;;
-s | -silent)
silentOpt=true
shift
;;
-*)
usage "unknown option: '$*'"
@ -128,10 +138,12 @@ fi
cd $incDir || exit 1
#------------------------------------------------------------------------------
# Link include files
# ~~~~~~~~~~~~~~~~~~
echo "$Script: linking include files to $incDir"
if [ "$silentOpt" != true ]
then
echo "$Script: linking include files to $incDir" 1>&2
fi
#
# remove any broken links first (this helps when file locations have moved)