mirror of
https://develop.openfoam.com/Development/ThirdParty-common.git
synced 2025-12-08 06:57:50 +00:00
BUG: Allclean removes platforms/ instead of build/ (closes #7)
- Now only cleans the build/ directory. - Add -all, -current options etc for also removing platforms, if wishing a complete clean.
This commit is contained in:
125
Allclean
125
Allclean
@ -4,7 +4,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) 2011 OpenFOAM Foundation
|
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM.
|
# This file is part of OpenFOAM.
|
||||||
@ -23,7 +23,7 @@
|
|||||||
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Script
|
# Script
|
||||||
# AllClean
|
# Allclean
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# Clean script for third-party applications and libraries
|
# Clean script for third-party applications and libraries
|
||||||
@ -39,24 +39,115 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
|
|||||||
}
|
}
|
||||||
# . etc/tools/ThirdPartyFunctions
|
# . etc/tools/ThirdPartyFunctions
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
Script=${0##*/}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
exec 1>&2
|
||||||
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||||
|
cat<<USAGE
|
||||||
|
Usage: $Script [OPTION] [<platform> [ ... <platformN> ]]
|
||||||
|
options:
|
||||||
|
-all remove all platforms directories.
|
||||||
|
-current clean the current platform ($WM_OPTIONS).
|
||||||
|
-help print the usage
|
||||||
|
|
||||||
# clean various packages via 'distclean'
|
Cleanup intermediate build directories.
|
||||||
for i in openmpi-*
|
Optionally remove specified platform(s) from the ThirdParty platforms
|
||||||
do
|
directory $WM_THIRD_PARTY_DIR/platforms
|
||||||
[ -d "$i" ] && ( set -x; cd $i && make distclean )
|
|
||||||
done
|
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# clean various packages via 'realclean'
|
# Print help message
|
||||||
for i in scotch*/src
|
if [ "$1" = "-h" -o "$1" = "-help" ]; then
|
||||||
do
|
usage
|
||||||
[ -d "$i" ] && ( set -x; cd $i && make realclean )
|
fi
|
||||||
done
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
# clean out-of-source build directories
|
# Clean various packages via 'distclean'
|
||||||
[ -d platforms ] && ( set -x; rm -rf platforms/* )
|
for i in openmpi-* ADIOS-*
|
||||||
|
do
|
||||||
|
[ -d "$i" ] && (
|
||||||
|
echo
|
||||||
|
echo "${i%/*}"
|
||||||
|
echo " make distclean"
|
||||||
|
echo
|
||||||
|
cd $i && make distclean
|
||||||
|
)
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# Clean various packages via 'realclean'
|
||||||
|
for i in scotch*/src
|
||||||
|
do
|
||||||
|
[ -d "$i" ] && (
|
||||||
|
echo
|
||||||
|
echo "${i%/*}"
|
||||||
|
echo " make realclean"
|
||||||
|
echo
|
||||||
|
cd $i && make realclean
|
||||||
|
)
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# Clean out-of-source build directories
|
||||||
|
if [ -d build ]
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "Clean build/ directory"
|
||||||
|
rm -rf build/*
|
||||||
|
fi
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#
|
||||||
|
# Clean platforms directories
|
||||||
|
#
|
||||||
|
if [ "$#" -ge 1 ]
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "Clean platforms/sub-directories"
|
||||||
|
fi
|
||||||
|
|
||||||
|
removePlatform()
|
||||||
|
{
|
||||||
|
local platform="$1"
|
||||||
|
if [ -n "$platform" -a -d "platforms/$platform" ]
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "Cleaning platform '$platform'"
|
||||||
|
\rm -rf "platforms/$platform"
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "Platform '$platform' not built"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Optionally cleanup platforms specified from the arguments
|
||||||
|
while [ "$#" -ge 1 ]
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-all)
|
||||||
|
echo
|
||||||
|
echo "Removing all platforms/sub-directories"
|
||||||
|
echo
|
||||||
|
\rm -rf platforms/*
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
|
||||||
|
-current)
|
||||||
|
echo "Current platform '$WM_OPTIONS'"
|
||||||
|
removePlatform "$WM_OPTIONS"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
removePlatform "$1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user