ENH: support libz disabling via WM_COMPILE_CONTROL (as ~libz)

- eg, for partially incomplete systems (without libz devel header)

ENH: clearer binding of dummy Pstream in OpenFOAM/Make/options

- link of dummy stub Pstream now contingent on linking libOpenFOAM as
  well. This makes the purpose slightly clearer

ENH: cleaner option naming/handling in wmake script

- allow special purpose -no-openfoam option.
  Eg, compiling test programs without OpenFOAM and Pstream libraries
  but using the rest of the wmake system.

ENH: add +openmp support into WM_COMPILE_CONTROL (#2633)

- this adds compile/link flags for openmp.
  For single-use, can also use 'wmake -openmp'.

  If both +openmp and ~openmp are specified in WM_COMPILE_CONTROL
  the ~openmp will have priority.

  This is actually done indirectly since ~openmp will set empty
  COMP_OPENMP, LINK_OPENMP internal variables, which the +openmp then
  adds to the c++FLAGS and linkexe targets (ie, won't actually add
  anything).

ENH: add +ccache or ccache=... support into WM_COMPILE_CONTROL (#2633)

- with the first version (+ccache), simply use ccache from the path
  without any extra options.

- with the second version (ccache=...), can be more specific about
  what is called.

  Using "+ccache" is identical to "ccache=ccache", but the later could
  be used in other ways. For example,

     ccache=/strange/install/path/ccache
     ccache=</path/my-tooling --option>

  Have the choice of unquoted, single or double quoted or '< >' quoted

STYLE: relocate FOAM_EXTRA_LDFLAGS in general makefile

- removes clutter for different linkers (eg, gold, mold, ldd)
  making it easier to extend for other linkers.

STYLE: protect makefile checks with 'strip' function
This commit is contained in:
Mark Olesen
2022-11-01 12:15:08 +01:00
parent e15b103003
commit 9f7cfa9419
76 changed files with 430 additions and 193 deletions

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2014-2017 OpenFOAM Foundation
# Copyright (C) 2019-2021 OpenCFD Ltd.
# Copyright (C) 2019-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -81,11 +81,13 @@ USAGE
#------------------------------------------------------------------------------
# Parse the arguments and options
# Parse the arguments and options.
# Prefix with 'wmakeOpt_' to avoid affecting the sourcing environment.
#
#------------------------------------------------------------------------------
unset optDebug optLog optNonRecursive optQueue
unset optWmakeFrontend
unset wmakeOpt_frontend wmakeOpt_nonRecursive
unset wmakeOpt_debug wmakeOpt_log wmakeOpt_queue
for arg in "$@"
do
@ -99,13 +101,13 @@ do
-with-bear)
# Use 'bear' as frontend wrapper to wmake
optWmakeFrontend="-with-bear"
wmakeOpt_frontend="-with-bear"
continue # Argument handled, remove it
;;
-no-recurs* | -fromWmake)
# Avoid recursion (eg, if called from wmake)
optNonRecursive=true
wmakeOpt_nonRecursive=true
# Pass onwards to other Allwmake scripts
;;
@ -155,29 +157,29 @@ do
;;
-l | -log)
optLog="log.${WM_OPTIONS:-build}"
wmakeOpt_log="log.${WM_OPTIONS:-build}"
continue # Argument handled, remove it
;;
-log=*)
optLog="${arg##*=}"
if [ -d "$optLog" ]
wmakeOpt_log="${arg##*=}"
if [ -d "$wmakeOpt_log" ]
then
optLog="${optLog%/}/log.${WM_OPTIONS:-build}"
elif [ -z "$optLog" ]
wmakeOpt_log="${wmakeOpt_log%/}/log.${WM_OPTIONS:-build}"
elif [ -z "$wmakeOpt_log" ]
then
optLog="log.${WM_OPTIONS:-build}"
wmakeOpt_log="log.${WM_OPTIONS:-build}"
fi
continue # Argument handled, remove it
;;
-debug | -debug-O[0123])
optDebug="$arg"
-debug | -debug-O[g0123])
wmakeOpt_debug="$arg"
continue # Argument handled, remove it
;;
-q | -queue)
optQueue="-queue"
wmakeOpt_queue="-queue"
continue # Argument handled, remove it
;;
@ -196,21 +198,22 @@ done
# Execute wmake -all if not called from wmake
#------------------------------------------------------------------------------
if [ -z "$optNonRecursive" ]
if [ -z "$wmakeOpt_nonRecursive" ]
then
if [ -z "$optLog" ]
if [ -z "$wmakeOpt_log" ]
then
exec wmake $optWmakeFrontend -all \
$optDebug $optQueue $*
exec wmake $wmakeOpt_frontend -all \
$wmakeOpt_debug $wmakeOpt_queue $wmakeOpt_openmp $*
exit $? # Unneeded, but just in case something went wrong
else
echo "Logging wmake -all output to '$optLog'" 1>&2
echo "Logging wmake -all output to '$wmakeOpt_log'" 1>&2
echo 1>&2
exec wmake $optWmakeFrontend -all \
$optDebug $optQueue $* 2>&1 | /usr/bin/tee $optLog
exec wmake $wmakeOpt_frontend -all \
$wmakeOpt_debug $wmakeOpt_queue $wmakeOpt_openmp $* 2>&1 | \
/usr/bin/tee $wmakeOpt_log
# Need to cleanup after the tee
rc=$? # Error code from tee (not wmake), but not entirely important
echo "Done logging to '$optLog'" 1>&2
echo "Done logging to '$wmakeOpt_log'" 1>&2
exit "$rc"
fi
fi
@ -230,8 +233,8 @@ fi
# Cleanup local variables and functions
#------------------------------------------------------------------------------
unset optWmakeFrontend
unset optNonRecursive optDebug optLog optQueue
unset wmakeOpt_frontend wmakeOpt_nonRecursive
unset wmakeOpt_debug wmakeOpt_log wmakeOpt_queue
unset -f usage