ENH: robustness, consistency for wmake -show-api, -version

- add to wmakeFunctions to ensure it works even without 'make' being
  installed. Exit immediately after -show-api for consistency with
  -version.

foamEtcFile:
  - drop warnings for some old (pre-v1812) defunct options
    and simply flag as unknown options.
  - handle -version, --version as equivalent to -show-api
This commit is contained in:
Mark Olesen
2021-06-09 10:33:45 +02:00
parent 1afa6f1b46
commit c7bde70ecb
4 changed files with 42 additions and 24 deletions

View File

@ -55,6 +55,28 @@ checkEnv()
}
# (api) from WM_DIR/rules/General/general
# - extract WM_VERSION = OPENFOAM=<digits>
getApiOpenFOAM()
{
local rulesFile="$WM_DIR/rules/General/general"
local value
if [ -n "$WM_DIR" ] && [ -f "$rulesFile" ]
then
value="$(sed -ne 's@^ *WM_VERSION *= *OPENFOAM=\([0-9][0-9]*\).*@\1@p' "$rulesFile" 2>/dev/null)"
fi
if [ -n "$value" ]
then
echo "$value"
else
echo "Could not extract OpenFOAM API value" 1>&2
return 1
fi
}
# Set FOAM_MODULE_PREFIX according to
# - absolute/relative path
# - predefined type (u,user | g,group | o,openfoam)