Skip to content
Snippets Groups Projects
Commit b9f77260 authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: fix wcleanAll, wcleanMachine to work with new platforms/ layout

parent 28e63891
Branches
Tags
No related merge requests found
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
......@@ -30,33 +30,44 @@
# directories of all machines and delete them.
#
#------------------------------------------------------------------------------
if [ "$1" = "-h" -o "$1" = "-help" ]
then
echo "Usage: ${0##*/}"
echo
echo " Remove all object files and *.dep files"
exit 1
fi
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/}
Remove all object files and *.dep files
[ -d bin -a -d src ] || {
echo "${0##*/}: not in the project top level directory"
USAGE
exit 1
}
for dir in lib bin applications/bin
# parse options
while [ "$#" -gt 0 ]
do
echo "Removing non-tools directories from $dir/"
if [ -d $dir ]
then
find $dir -mindepth 1 -type d \! -name tools | xargs rm -rf
fi
case "$1" in
-h | -help)
usage
;;
*)
usage "unknown option/argument: '$*'"
;;
esac
done
[ -d bin -a -d src ] || usage "not in the project top level directory"
echo "Removing platforms/ subdirectores"
rm -rf platforms/*
echo "Removing *.dep files"
find . -name '*.dep' -exec rm {} \;
echo "Cleaning Make subdirectories"
find `find . -depth \( -name "Make.[A-Za-z]*" -o -name Make \) -type d -print` -depth \( -type d ! -name "*Make.[A-Za-z]*" ! -name "*Make" \) -exec rm -rf {} \;
find . -depth \( -name Make -o -name "Make.[A-Za-z]*" \) -type d -print | \
xargs -i find '{}' -mindepth 1 -maxdepth 1 -type d -print | \
xargs rm -rf
echo "Removing lnInclude and intermediate directories"
find . -depth -type d \( -name lnInclude -o -name ii_files -o -name Templates.DB \) -exec rm -rf {} \;
......
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
......@@ -33,6 +33,7 @@
#
#------------------------------------------------------------------------------
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/} machineType [... machineTypeN]
......@@ -40,32 +41,39 @@ usage: ${0##*/} machineType [... machineTypeN]
Searches the directories below the current directory for the object file
directories of the specified machine type(s) and deletes them
Note:
can also use '-current' for the current value of \$WM_OPTIONS
USAGE
exit 1
}
# needs some machine types ... or provide immediate help
if [ "$#" -lt 1 -o "$1" = "-h" -o "$1" = "-help" ]
then
usage
fi
[ -d lib -a -d src ] || usage "not in the project top level directory"
[ -d bin -a -d src ] || usage "not in the project top level directory"
for machType
do
echo "Cleaning machine type: $machType"
if [ "$machType" = "-current" ]
then
machType="$WM_OPTIONS"
echo "Using current = $machType"
[ -n "$machType" ] || continue
fi
find `find . -depth \( -name "Make.[A-Za-z]*" -o -name Make \) -type d -print` \
-depth \( -type d -name "*$machType" -o -name "*$machType$WM_MPLIB" \) -exec rm -r {} \;
echo "Cleaning machine type: $machType"
# find . -depth -type d \( -name ii_files -o -name Templates.DB \) -exec rm -rf {} \;
find . -depth \( -name Make -o -name "Make.[A-Za-z]*" \) -type d -print | \
xargs -i find '{}' -mindepth 1 -maxdepth 1 \
\( -type d -name "*$machType" -o -name "*$machType$WM_MPLIB" \) -print |
xargs rm -rf
for dir in lib/$machType bin/$machType applications/bin/$machType
do
[ -d $dir ] && rm -rf $dir
done
rm -rf platforms/$machType
done
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment