Fix make-array transforms.
[sbcl.git] / clean.sh
1 #!/bin/sh
2 set -e
3
4 # Remove everything in directories which are only used for output.
5 # In most cases, we can remove the directories, too.
6 #
7 # (We don't remove all the directories themselves for a stupid technical
8 # reason: "gmake clean" in the src/runtime directory gets unhappy if the
9 # output/ directory doesn't exist, because it tries to build Depends
10 # before it cleans itself, and src/c-runtime/sbcl.h is a symlink into
11 # the output/ directory, and it gets the gcc dependency processing gets
12 # all confused trying to figure out a header file which is a symlink
13 # into a directory which doesn't exist. We'd like to be able to run
14 # this script (including "gmake clean" in the src/runtime directory)
15 # several times in a row without failure.. so we leave the output/
16 # directory in place.)
17 rm -rf obj/* output/* src/runtime/genesis/
18
19 # Ensure that we know GNUMAKE.
20 . ./find-gnumake.sh
21 find_gnumake
22
23 # Ask some other directories to clean themselves up.
24 original_pwd=`pwd`
25 for d in tools-for-build; do
26     cd ./$d > /dev/null
27     # I hope the -s option is standard. At least GNU make and BSD make
28     # support it. It silences make, since otherwise the output from
29     # this script is just the operations done by these make's, which
30     # is misleading when this script does lotso other operations too.
31     # -- WHN
32     $GNUMAKE -I ../src/runtime -s clean
33     cd "$original_pwd" > /dev/null
34 done
35 ( cd ./doc ; sh ./clean.sh )
36
37 # Within all directories, remove things which don't look like source
38 # files. Some explanations:
39 #   (symlinks)
40 #     are never in the sources, so must've been created
41 #   sbcl
42 #     the runtime environment, created by compiling C code
43 #   sbcl.h
44 #     information about Lisp code needed to build the runtime environment,
45 #     created by running GENESIS
46 #   Config, target
47 #     architecture-dependent or OS-dependent symlinks
48 #   core
49 #     probably a Unix core dump -- not part of the sources anyway
50 #   *.o, *.so, *.lib, *.nm, a.out
51 #     results of C-style linking, assembling, etc.
52 #   *.core, *.map
53 #     looks like SBCL SAVE-LISP-AND-DIE or GENESIS output, and
54 #     certainly not source
55 #   *~, #*#
56 #     common names for editor temporary files
57 #   TAGS, tags
58 #     files created by GNU etags and ctags
59 #   .#*, *.orig, .*.orig, *.rej
60 #     rubbish left behind by CVS updates
61 #   *.htm, *.html
62 #     The system doc sources are mostly texinfo, plus various odds
63 #     and ends like docstrings embedded in .lisp sources; any HTML is
64 #     automatically-generated output.
65 #   depend, *.d
66 #     made by "make depend" (or "gmake depend" or some such thing)
67 #   *.lisp-obj, *.fasl, *.x86f, *.axpf, *.lbytef, *.lib
68 #     typical extensions for fasl files (not just from SBCL, but
69 #     from other Lisp systems which might be used as xc hosts)
70 #   *.tmp, *.lisp-temp
71 #     conventional names for temporary files autogenerated in
72 #     building or testing
73 #   test-passed
74 #     generated by automatic directory-test-thyself procedure
75 find . \( \
76         -name _darcs -o \
77         -name '{arch}' -o \
78         -name CVS -o \
79         -name .hg -o \
80         -name .git -o \
81         -name .svn \) -type d -prune -o \
82        \( \
83         -type l -o \
84         -name '*~' -o \
85         -name '#*#' -o \
86         -name '.#*' -o \
87         -name '*.orig' -o \
88         -name '.*.orig' -o \
89         -name '*.rej' -o \
90         -name '?*.x86f' -o \
91         -name '?*.axpf' -o \
92         -name '?*.lbytef' -o \
93         -name '?*.fasl' -o \
94         -name '?*.FASL' -o \
95         -name 'core' -o \
96         -name '?*.core' -o \
97         -name '*.map' -o \
98         -name '*.nm' -o \
99         -name '*.host-obj' -o \
100         -name '*.lisp-obj' -o \
101         -name '*.target-obj' -o \
102         -name '*.lib' -o \
103         -name '*.tmp' -o \
104         -name '*.lisp-temp' -o \
105         -name '*.o' -o \
106         -name '*.so' -o \
107         -name '*.d' -o \
108         -name 'foo.c' -o \
109         -name 'test-output' -o \
110         -name 'test-lab' -o \
111         -name 'encodings.texi-temp' -o \
112         -name 'stack-alignment-offset' -o \
113         -name 'test-status.lisp-expr' -o \
114         -name 'a.out' -o \
115         -name 'sbcl' -o \
116         -name 'sbcl.h' -o \
117         -name 'depend' -o \
118         -name 'TAGS' -o \
119         -name 'tags' -o \
120         -name 'test-passed' -o \
121         -name 'ldso-stubs.S' -o \
122         -name 'local-target-features.lisp-expr' \) -print | xargs rm -fr