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