ENH: support wmake -all=FILE option

- allows specialized versions of ./Allwmake in the local directory
This commit is contained in:
Mark Olesen
2025-08-21 09:31:51 +02:00
parent 8aa69ad976
commit f3c97d41bd
10 changed files with 146 additions and 34 deletions

View File

@ -89,7 +89,8 @@ USAGE
#------------------------------------------------------------------------------
unset wmakeOpt_frontend wmakeOpt_frontend_arg wmakeOpt_nonRecursive
unset wmakeOpt_debug wmakeOpt_log wmakeOpt_openmp wmakeOpt_strict wmakeOpt_queue
unset wmakeOpt_debug wmakeOpt_log wmakeOpt_openmp wmakeOpt_strict
unset wmakeOpt_all wmakeOpt_queue
for arg in "$@"
do
@ -99,7 +100,7 @@ do
case "$arg" in
('') continue ;; # Empty argument, ignore it
-h | -help*)
-h | -help* | --help*)
usage
;;
@ -123,6 +124,17 @@ do
# Pass onwards to other Allwmake scripts
;;
-all=*)
# Alternative entry point to ./Allwmake
wmakeOpt_all="$arg"
if [ -z "${wmakeOpt_all##*=}" ]
then
echo "ignoring -all=... (missing filename)" 1>&2
unset wmakeOpt_all
fi
continue # Argument handled, remove it
;;
-build-root=*)
# Alternative location for build intermediates
export FOAM_BUILDROOT="${arg#*=}"
@ -222,15 +234,18 @@ done
if [ -z "$wmakeOpt_nonRecursive" ]
then
# wmake -all=FILE or wmake -all
: "${wmakeOpt_all:=-all}"
if [ -z "$wmakeOpt_log" ]
then
exec wmake $wmakeOpt_frontend "$wmakeOpt_frontend_arg" -all \
exec wmake $wmakeOpt_frontend "$wmakeOpt_frontend_arg" "$wmakeOpt_all" \
$wmakeOpt_debug $wmakeOpt_strict $wmakeOpt_queue $wmakeOpt_openmp $*
exit $? # Unneeded, but just in case something went wrong
else
echo "Logging wmake -all output to '$wmakeOpt_log'" 1>&2
echo "Logging wmake output to '$wmakeOpt_log'" 1>&2
echo 1>&2
exec wmake $wmakeOpt_frontend "$wmakeOpt_frontend_arg" -all \
exec wmake $wmakeOpt_frontend "$wmakeOpt_frontend_arg" "$wmakeOpt_all" \
$wmakeOpt_debug $wmakeOpt_strict $wmakeOpt_queue $wmakeOpt_openmp $* 2>&1 | \
/usr/bin/tee $wmakeOpt_log
# Need to cleanup after the tee
@ -256,7 +271,8 @@ fi
#------------------------------------------------------------------------------
unset wmakeOpt_frontend wmakeOpt_frontend_arg wmakeOpt_nonRecursive
unset wmakeOpt_debug wmakeOpt_log wmakeOpt_openmp wmakeOpt_strict wmakeOpt_queue
unset wmakeOpt_debug wmakeOpt_log wmakeOpt_openmp wmakeOpt_strict
unset wmakeOpt_all wmakeOpt_queue
unset -f usage