Sync with WRF
[WPS.git] / cleanCMake.sh
blob06c3a38a8c7f8ebbc58dca9d86d540787bc31938
1 #!/bin/sh
2 buildDirectory=_build
3 installDirectory=install
5 help()
7 echo "./cleanCMake.sh [options]"
8 echo " -c [Default if no options] Basic cmake clean functionality [make -j 1 clean]"
9 echo " -b Remove cmake binary installs [xargs rm < ${buildDirectory}/install_manifest.txt]"
10 echo " -f Remove build & install folders (WRF) [ rm ${buildDirectory} -r; rm ${installDirectory}/ -r ]"
11 echo " -a Remove all (WRF), equivalent to -c -b -f (more specifically -c then -b then-f)"
12 echo "Specific builds/installs"
13 echo " -d directory Specify operating on particular build directory"
14 echo " -i directory Specify operating on particular install directory"
17 cleanBasicBuild=FALSE
18 cleanBasicInstall=FALSE
19 cleanLinks=FALSE
20 cleanFolders=FALSE
21 cleanAll=FALSE
23 while getopts "hcbfad:i:" opt; do
24 case ${opt} in
26 cleanBasicBuild=TRUE
29 cleanBasicInstall=TRUE
32 cleanFolders=TRUE
35 cleanAll=TRUE
38 buildDirectory=$OPTARG
41 installDirectory=$OPTARG
43 h) help; exit 0 ;;
44 *) help; exit 1 ;;
45 :) help; exit 1 ;;
46 \?) help; exit 1 ;;
47 esac
48 done
50 if [ $OPTIND -eq 1 ]; then
51 # Do basic clean I guess
52 cleanBasicBuild=TRUE
55 if [ "${cleanBasicBuild}" = "TRUE" ] || [ "${cleanAll}" = "TRUE" ]; then
56 echo "Doing cmake make clean"
57 OLD_DIR=$PWD
58 cd ${buildDirectory} && make -j 1 clean > /dev/null 2>&1; cd $OLD_DIR
61 if [ "${cleanBasicInstall}" = "TRUE" ] || [ "${cleanAll}" = "TRUE" ]; then
62 echo "Removing binary installs"
63 xargs rm < ${buildDirectory}/install_manifest.txt > /dev/null 2>&1
66 if [ "${cleanFolders}" = "TRUE" ] || [ "${cleanAll}" = "TRUE" ]; then
67 echo "Deleting ${buildDirectory} & ${installDirectory}/"
68 rm ${buildDirectory} -r; rm ${installDirectory}/ -r > /dev/null 2>&1