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 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; Info<< "Invoking " << wmakeCmd << endl;
if (Foam::system(wmakeCmd)) if (Foam::system(wmakeCmd))

View File

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

View File

@ -40,6 +40,7 @@ Usage: $Script [OPTION] [dir]
$Script [OPTION] target [dir [MakeDir]] $Script [OPTION] target [dir [MakeDir]]
options: options:
-s | -silent ignored - for compatibility with wmake
-help print the usage -help print the usage
Clean up the wmake control directory Make/\$WM_OPTIONS and remove the Clean up the wmake control directory Make/\$WM_OPTIONS and remove the
@ -52,14 +53,28 @@ The targets correspond to a subset of the 'wmake' special targets:
clean Make, any *.dep files and lnInclude directories clean Make, any *.dep files and lnInclude directories
USAGE USAGE
exit 1 exit 1
} }
# provide immediate help
if [ "$1" = "-h" -o "$1" = "-help" ] # parse options
then while [ "$#" -gt 0 ]
usage do
fi case "$1" in
-h | -help)
usage
;;
-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]] $Script [OPTION] target [dir [MakeDir]]
options: options:
-s | -silent invoke make in 'silent' mode (do not echo commands)
-help print the usage -help print the usage
A general, easy-to-use make system for multi-platform development A general, easy-to-use make system for multi-platform development
The 'target' is a Makefile target: The 'target' is a Makefile target:
@ -59,12 +61,28 @@ USAGE
exit 1 exit 1
} }
# provide immediate help, even if environment is not set # normally use "make"
if [ "$1" = "-h" -o "$1" = "-help" ] make="make"
then
usage
fi
# 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 # check environment variables
@ -77,6 +95,7 @@ do
} }
done done
# when compiling anything but a standalone exe: # when compiling anything but a standalone exe:
# WM_PROJECT and WM_PROJECT_DIR must be set # WM_PROJECT and WM_PROJECT_DIR must be set
[ "$1" = exe -o \( "$WM_PROJECT" -a "$WM_PROJECT_DIR" \) ] || { [ "$1" = exe -o \( "$WM_PROJECT" -a "$WM_PROJECT_DIR" \) ] || {
@ -91,8 +110,6 @@ done
# Select the version of make to be used # Select the version of make to be used
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
make="make"
# set WM_NCOMPPROCS automatically when both WM_HOSTS and WM_SCHEDULER are set # 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" ] if [ -z "$WM_NCOMPPROCS" -a -n "$WM_HOSTS" -a -n "$WM_SCHEDULER" ]
then then
@ -113,7 +130,7 @@ then
mkdir -p $lockDir mkdir -p $lockDir
fi fi
make="make --no-print-directory -j "$WM_NCOMPPROCS make="$make --no-print-directory -j "$WM_NCOMPPROCS
fi fi
fi fi

View File

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