forked from NOAA-EMC/UPP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clean
executable file
·57 lines (51 loc) · 1.51 KB
/
clean
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
#!/bin/bash
if [[ "$1" == '-a' ]]; then
CLEANALL=true
fi
# execute all make clean in subshell to retain PWD
# we don't care about failures so ignore 'em
printf "\n\n<><><><><><><><> CLEAN BEGIN <><><><><><><><>\n\n"
TOPDIR=$PWD
#Use make as specified in configure file unless it is empty
if [ ! -e configure.upp ]; then
MAKE="make"
else
MAKE=`awk '($1~/^MAKE/) {print substr($0,index($0,"=")+1) }' configure.upp`
MAKE=${MAKE:-make} # If above command returned nothing, set MAKE to "make"
fi
cd $TOPDIR/sorc/comlibs
$MAKE clean
cd $TOPDIR/sorc/ncep_post.fd
$MAKE clean -f makefile_dtc
cd $TOPDIR
#
# clear configuration file to force a reconfigure after a clean
# Configuration file exists
if [ -e configure.upp ]; then
#
# If configuration file is empty don't overwrite backup
if [ -s configure.upp ]; then
/bin/mv configure.upp configure.upp.backup
fi
fi
# empty file for clean op
touch configure.upp
printf "\n\n<><><><><><><> CLEAN COMPLETE <><><><><><><><>\n\n"
# Now remove this to force a reconfigure
#
# clean -a -- look for anything that may not have been cleaned up and
# remove it
if [[ "$CLEANALL" == 'true' ]]; then
printf "\n\n<><><><><><><> CLEAN ALL <><><><><><><><>\n\n"
set -x
/bin/rm -rf ./netcdf_links
find . -name \*.exe -exec \rm {} \;
find . -name \*.o -exec \rm {} \;
find . -name \*.a -exec \rm {} \;
find . -name \*.mod -exec \rm {} \;
rm -rf exec
rm -rf lib
rm -rf include
set +x
printf "\n\n<><><><><><> CLEAN ALL COMPLETE <><><><><><><><>\n\n"
fi