mirror of
https://develop.openfoam.com/Development/ThirdParty-common.git
synced 2025-12-08 06:57:50 +00:00
168 lines
4.2 KiB
Bash
Executable File
168 lines
4.2 KiB
Bash
Executable File
#!/bin/sh
|
|
#------------------------------------------------------------------------------
|
|
# ========= |
|
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
# \\ / O peration |
|
|
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
|
#------------------------------------------------------------------------------
|
|
# License
|
|
# This file is part of OpenFOAM.
|
|
#
|
|
# OpenFOAM is free software: you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
# for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
# Script
|
|
# Allclean
|
|
#
|
|
# Description
|
|
# Clean script for ThirdParty applications and libraries
|
|
#
|
|
# ----------------------------------------------
|
|
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
|
|
#------------------------------------------------------------------------------
|
|
# Run from third-party directory only
|
|
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
|
|
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
|
|
echo " Check your OpenFOAM environment and installation"
|
|
exit 1
|
|
}
|
|
# . etc/tools/ThirdPartyFunctions
|
|
#------------------------------------------------------------------------------
|
|
usage() {
|
|
exec 1>&2
|
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
|
cat<<USAGE
|
|
Usage: ${0##*/} [OPTION] [<platform> [ ... <platformN> ]]
|
|
options:
|
|
-all remove all platforms directories.
|
|
-current clean the current platform ($WM_OPTIONS).
|
|
-help print the usage
|
|
|
|
Cleanup intermediate build directories.
|
|
Optionally remove specified platform(s) from the ThirdParty platforms
|
|
directory $WM_THIRD_PARTY_DIR/platforms
|
|
|
|
USAGE
|
|
exit 1
|
|
}
|
|
|
|
# Print help message
|
|
if [ "$1" = "-h" -o "$1" = "-help" ]
|
|
then
|
|
usage
|
|
fi
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Clean various packages via 'distclean'
|
|
for i in \
|
|
openmpi-* metis-* adios-* ADIOS-* gperftools-* qt-* \
|
|
gmp-* mpfr-* mpc-* gcc-* llvm-* \
|
|
;
|
|
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 various packages via 'wclean'
|
|
for i in libccmio*/Make kahip*/lib/Make
|
|
do
|
|
[ -d "$i" ] && (
|
|
echo
|
|
echo "${i%/Make}"
|
|
echo " wclean"
|
|
echo
|
|
cd ${i%/Make} && wclean
|
|
)
|
|
done
|
|
|
|
|
|
# Clean out-of-source build directories
|
|
if [ -d build ]
|
|
then
|
|
echo
|
|
echo "Clean build/ directory"
|
|
rm -rf build/*
|
|
fi
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
#
|
|
# Clean platforms directories
|
|
#
|
|
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
|
|
}
|
|
|
|
if [ "$#" -ge 1 ]
|
|
then
|
|
echo
|
|
echo "Clean platforms/sub-directories"
|
|
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
|
|
|
|
#------------------------------------------------------------------------------
|