aboutsummaryrefslogtreecommitdiff
path: root/unix/hlib/util.csh/mkclean
blob: 6b7d3198c34c1b0910bfebf787e3e72f43aebba9 (plain) (blame)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/csh -f
#
#  MKCLEAN -- Make a pure source tree and configure the links for the 
#  current architecture.


unset	noclobber
onintr	cleanup_
unalias cd cp cmp echo ln mv rm sed set grep ls chmod chown pwd touch sort which

setenv	path  "(/sbin /usr/sbin /bin /usr/bin /usr/5bin /usr/ucb /etc /usr/etc $path /usr/local/bin /opt/local/bin /local/bin /home/local/bin /usr/openwin/bin /usr/X11R6/bin /usr/X11/bin)"

# Utility aliases.
alias PUT      "mv -f \!*; chown $user \!$ "                   # [MACHDEP]
alias BOLD_ON  "(tput bold)"
alias BOLD_OFF "(tput sgr0)"
alias SO_ON    "(tput smso)"
alias SO_OFF   "(tput sgr0)"

alias DO_OK    "(echo -n '[ '; BOLD_ON; echo -n ' OK '; BOLD_OFF; echo ' ]')"
alias DO_WARN  "(echo -n '[ '; BOLD_ON; echo -n 'WARN'; BOLD_OFF; echo ' ]')"
alias DO_FAIL  "(echo -n '[ ';   SO_ON; echo -n 'FAIL';   SO_OFF; echo ' ]')"

alias ERRMSG   "(echo -n '   ';BOLD_ON;echo -n 'ERROR: '  ;BOLD_OFF; echo \!*)"
alias WARNING  "(echo -n '   ';BOLD_ON;echo -n 'WARNING: ';BOLD_OFF; echo \!*)"
alias NEWLINE  "(echo '')"



# set echo

if (! $?iraf) then
    echo ""
    echo "Error:  You must have the iraf env variable defined !"
    echo ""
    exit 1
endif

set	exec	= yes
set	arch	= `$iraf/unix/hlib/irafarch.csh`


#=============================================================================
# Process any command line arguments.
#=============================================================================
while ("$1" != "")
    switch ("$1")
    case -n:                            # no execute
        set exec = no
        breaksw
    default:
        ERRMSG  "$0: unknown argument $1"
        breaksw
    endsw

    if ("$2" == "") then
        break
    else
        shift
    endif
end





#----------------------------------
# Determine platform architecture.
#----------------------------------

set mach 	= `$iraf/unix/hlib/irafarch.csh -actual`
set hmach 	= `$iraf/unix/hlib/irafarch.csh -actual`

echo "mach = " $mach
echo "hmach = " $hmach

echo -n "Clean host directories ...."
  if ($exec == "yes") then
    /bin/rm -f unix/bin.$arch/[agm-z]*.e unix/bin.$arch/lib[bco]*.a >& /dev/null
  else
    /bin/ls -l unix/bin.$arch/[agm-z]*.e unix/bin.$arch/lib[bco]*.a
  endif
echo "		Done"



echo -n "Clean src directories ...."
foreach i (local math pkg sys noao/[adfimnorst]*)
  if ($exec == "yes") then
    find $i -type f -name \*.a -exec /bin/rm -f {} \;		>& /dev/null
    find $i -type f -name \*.e -exec /bin/rm -f {} \;		>& /dev/null
    find $i -type f -name \*.o -exec /bin/rm -f {} \;		>& /dev/null
  else
    find $i -type f -name \*.a -exec /bin/ls -l {} \;
    find $i -type f -name \*.e -exec /bin/ls -l {} \;
    find $i -type f -name \*.o -exec /bin/ls -l {} \;
  endif
end
echo "		Done"


echo -n "Clean '$arch' bin directories ...."
if ($exec == "yes") then
    /bin/rm -rf bin.$arch/lib[a-z]*.a 				>& /dev/null
    /bin/rm -rf bin.$arch/*.[eoZ] 				>& /dev/null
    /bin/rm -rf noao/bin.$arch/*.[aeoZ] 			>& /dev/null
else
    /bin/ls -l  bin.$arch/lib[a-z]*.a 				>& /dev/null
    /bin/ls -l  bin.$arch/*.[aeoZ] 				>& /dev/null
    /bin/ls -l  noao/bin.$arch/*.[aeoZ] 			>& /dev/null
endif
echo "		Done"


echo -n "Cleaning spool files ...."
if ($exec == "yes") then
    find . -name spool\* -print -exec /bin/rm -f {} \;		>& /dev/null
else
    find . -name spool\* -print 
endif
echo "		Done"