mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add 'subcommand' handling to wclean (#1693)
- wcleanBuild, wcleanPlatform now accessible as "wclean -build" and "wclean -platform", respectively
This commit is contained in:
1
wmake/scripts/wclean-build
Symbolic link
1
wmake/scripts/wclean-build
Symbolic link
@ -0,0 +1 @@
|
||||
wcleanObjects
|
||||
1
wmake/scripts/wclean-platform
Symbolic link
1
wmake/scripts/wclean-platform
Symbolic link
@ -0,0 +1 @@
|
||||
wcleanObjects
|
||||
@ -12,10 +12,11 @@
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# wcleanBuild, wcleanPlatform
|
||||
# wmake/scripts/wcleanObjects
|
||||
# Backend for "wclean -build", "wclean -platform"
|
||||
#
|
||||
# Usage
|
||||
# wcleanBuild <option | platform> [.. <option | platform>]
|
||||
# wclean-build <option | platform> [.. <option | platform>]
|
||||
#
|
||||
# Description
|
||||
# Deletes the specified 'build/' object files directories from the
|
||||
@ -34,10 +35,9 @@
|
||||
# tutorials
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
Script="${0##*/}"
|
||||
targetDir=build # Safe default - override based on script name
|
||||
|
||||
case "$Script" in
|
||||
case "${0##*/}" in
|
||||
(*[Pp]latform*)
|
||||
targetDir=platforms
|
||||
;;
|
||||
@ -57,15 +57,15 @@ usage() {
|
||||
Usage: ${0##*/} <option | platform> [.. <option | platform>]
|
||||
|
||||
options:
|
||||
-a, -all Same as 'all'
|
||||
-curr, -current Use \$WM_OPTIONS ($WM_OPTIONS)
|
||||
-comp, -compiler Use \$WM_ARCH\$WM_COMPILER* ($WM_ARCH$WM_COMPILER)
|
||||
-a | -all Same as 'all'
|
||||
-curr | -current Use \$WM_OPTIONS ($WM_OPTIONS)
|
||||
-comp | -compiler Use \$WM_ARCH\$WM_COMPILER* ($WM_ARCH$WM_COMPILER)
|
||||
-compiler=NAME Use \$WM_ARCH<NAME>* ($WM_ARCH<NAME>*)
|
||||
-h, -help Print the usage
|
||||
-h | -help Print the usage
|
||||
|
||||
|
||||
Deletes the specified $targetDir/ object file directories from the project
|
||||
top-level $targetDir/ directory $WM_PROJECT_DIR.
|
||||
Deletes specified $targetDir object file directories from project top-level:
|
||||
Project: $WM_PROJECT_DIR
|
||||
Directory: $targetDir/
|
||||
|
||||
special platforms:
|
||||
all Remove all platforms$extraText
|
||||
@ -90,7 +90,7 @@ done
|
||||
wmake -check-dir -quiet "$WM_PROJECT_DIR" 2>/dev/null || \
|
||||
wmake -check-dir -quiet "$WM_THIRD_PARTY_DIR" 2>/dev/null || \
|
||||
{
|
||||
cat<<ERROR
|
||||
cat<<ERROR
|
||||
${0##*/}: Error incorrect top-level directory
|
||||
|
||||
Not in Project: $WM_PROJECT_DIR
|
||||
|
||||
44
wmake/wclean
44
wmake/wclean
@ -31,30 +31,51 @@
|
||||
# Usage
|
||||
# wclean [OPTION] [dir]
|
||||
# wclean [OPTION] target [dir [MakeDir]]
|
||||
# wclean -subcommand ...
|
||||
#
|
||||
# Description
|
||||
# Clean up the wmake control directory Make/\$WM_OPTIONS and remove the
|
||||
# lnInclude directories generated for libraries.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
Script="${0##*/}" # Use 'Script' for error messages in wmakeFunctions
|
||||
. "${0%/*}"/scripts/wmakeFunctions # Source wmake functions
|
||||
Script="${0##*/}" # Need 'Script' for wmakeFunctions messages
|
||||
scriptsDir="${0%/*}"/scripts # wmake/scripts directory
|
||||
. "$scriptsDir"/wmakeFunctions # Source wmake functions
|
||||
|
||||
printHelp() {
|
||||
cat<<HELP_INFO
|
||||
cat<<HELP_HEAD
|
||||
|
||||
Usage: $Script [OPTION] [dir]
|
||||
$Script [OPTION] target [dir [MakeDir]]
|
||||
$Script -subcommand ...
|
||||
|
||||
options:
|
||||
-a | -all All subdirectories, uses Allwclean, Allclean if they exist
|
||||
-s | -silent Ignored - for compatibility with wmake
|
||||
-s | -silent Silent mode (ignored - for compatibility with wmake)
|
||||
-h | -help Display short help and exit
|
||||
-help-full Display full help and exit
|
||||
|
||||
subcommands (wclean subcommand -help for more information):
|
||||
HELP_HEAD
|
||||
|
||||
if [ -n "$1" ]
|
||||
then
|
||||
cat<<HELP_SUBCOMMANDS
|
||||
-build Remove specified build/ object directories
|
||||
-platform Remove specified platforms/ object directories
|
||||
HELP_SUBCOMMANDS
|
||||
else
|
||||
cat<<HELP_SUBCOMMANDS
|
||||
-build -platform
|
||||
HELP_SUBCOMMANDS
|
||||
fi
|
||||
|
||||
cat<<HELP_TAIL_COMMON
|
||||
|
||||
Clean up the wmake control directory Make/\$WM_OPTIONS and remove the
|
||||
lnInclude directories generated for libraries.
|
||||
|
||||
HELP_INFO
|
||||
HELP_TAIL_COMMON
|
||||
|
||||
cat<<HELP_TAIL_FULL
|
||||
Special targets:
|
||||
@ -99,6 +120,19 @@ do
|
||||
-h | -help*) # Short help
|
||||
printHelp
|
||||
;;
|
||||
|
||||
# Forward to scripts/wclean-build
|
||||
-build) shift
|
||||
exec "$scriptsDir/wclean-build" "$@"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
# Forward to scripts/wclean-platform
|
||||
-platform*) shift
|
||||
exec "$scriptsDir/wclean-platform" "$@"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-a | -all | all)
|
||||
targetType=all
|
||||
;;
|
||||
|
||||
@ -1 +0,0 @@
|
||||
scripts/wcleanObjects
|
||||
@ -1 +0,0 @@
|
||||
scripts/wcleanObjects
|
||||
Reference in New Issue
Block a user