forked from wrf-model/WRF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanCMake.sh
executable file
·69 lines (62 loc) · 1.83 KB
/
cleanCMake.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
buildDirectory=_build
installDirectory=install
help()
{
echo "./cleanCMake.sh [options]"
echo " -c [Default if no options] Basic cmake clean functionality [make -j 1 clean]"
echo " -b Remove cmake binary installs [xargs rm < ${buildDirectory}/install_manifest.txt]"
echo " -f Remove build & install folders (WRF) [ rm ${buildDirectory} -r; rm ${installDirectory}/ -r ]"
echo " -a Remove all (WRF), equivalent to -c -b -f (more specifically -c then -b then-f)"
echo "Specific builds/installs"
echo " -d directory Specify operating on particular build directory"
echo " -i directory Specify operating on particular install directory"
}
cleanBasicBuild=FALSE
cleanBasicInstall=FALSE
cleanLinks=FALSE
cleanFolders=FALSE
cleanAll=FALSE
while getopts "hcbfad:i:" opt; do
case ${opt} in
c)
cleanBasicBuild=TRUE
;;
b)
cleanBasicInstall=TRUE
;;
f)
cleanFolders=TRUE
;;
a)
cleanAll=TRUE
;;
d)
buildDirectory=$OPTARG
;;
i)
installDirectory=$OPTARG
;;
h) help; exit 0 ;;
*) help; exit 1 ;;
:) help; exit 1 ;;
\?) help; exit 1 ;;
esac
done
if [ $OPTIND -eq 1 ]; then
# Do basic clean I guess
cleanBasicBuild=TRUE
fi
if [ "${cleanBasicBuild}" = "TRUE" ] || [ "${cleanAll}" = "TRUE" ]; then
echo "Doing cmake make clean"
OLD_DIR=$PWD
cd ${buildDirectory} && make -j 1 clean > /dev/null 2>&1; cd $OLD_DIR
fi
if [ "${cleanBasicInstall}" = "TRUE" ] || [ "${cleanAll}" = "TRUE" ]; then
echo "Removing binary installs"
xargs rm < ${buildDirectory}/install_manifest.txt > /dev/null 2>&1
fi
if [ "${cleanFolders}" = "TRUE" ] || [ "${cleanAll}" = "TRUE" ]; then
echo "Deleting ${buildDirectory} & ${installDirectory}/"
rm ${buildDirectory} -r; rm ${installDirectory}/ -r > /dev/null 2>&1
fi