0.8.6.1:
[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/* doc/user-manual \
17   doc/user-manual.junk doc/DBTOHTML_OUTPUT_DIR*
18 # (The doc/user-manual.junk and doc/DBTOHTML_OUTPUT_DIR* directories
19 # are created by the Cygnus db2html script when it formats the the
20 # user manual, and since this db2html script is the one which is
21 # currently used to format the manual for the standard binary
22 # distribution, we automatically clean up after it here in the 
23 # standard clean.sh file.)
24
25 # Ensure we know GNUMAKE
26 . find-gnumake.sh
27 find_gnumake
28
29 # Ask some other directories to clean themselves up.
30 original_pwd=`pwd`
31 for d in tools-for-build; do
32     cd $d > /dev/null
33     # I hope the -s option is standard. At least GNU make and BSD make
34     # support it. It silences make, since otherwise the output from
35     # this script is just the operations done by these make's, which
36     # is misleading when this script does lotso other operations too.
37     # -- WHN
38     $GNUMAKE -I ../src/runtime -s clean
39     cd $original_pwd  > /dev/null
40 done
41
42 # Within all directories, remove things which don't look like source
43 # files. Some explanations:
44 #   (symlinks)
45 #     are never in the sources, so must've been created
46 #   sbcl
47 #     the runtime environment, created by compiling C code
48 #   sbcl.h 
49 #     information about Lisp code needed to build the runtime environment,
50 #     created by running GENESIS
51 #   Config, target
52 #     architecture-dependent or OS-dependent symlinks
53 #   *.htm, *.html
54 #     probably machine-generated translation of DocBook (*.sgml) files
55 #   core
56 #     probably a Unix core dump -- not part of the sources anyway
57 #   *.o, *.so, *.lib, *.nm, a.out
58 #     results of C-style linking, assembling, etc.
59 #   *.core, *.map
60 #     looks like SBCL SAVE-LISP-AND-DIE or GENESIS output, and
61 #     certainly not source
62 #   *~, #*#
63 #     common names for editor temporary files
64 #   TAGS, tags
65 #     files created by GNU etags and ctags
66 #   .#*, *.orig, .*.orig, *.rej
67 #     rubbish left behind by CVS updates
68 #   *.htm, *.html
69 #     The system doc sources are SGML, any HTML is
70 #     automatically-generated output.
71 #   depend
72 #     made by "make depend" (or "gmake depend" or some such thing)
73 #   *.lisp-obj, *.fasl, *.x86f, *.axpf, *.lbytef, *.lib
74 #     typical extensions for fasl files (not just from SBCL, but
75 #     from other Lisp systems which might be used as xc hosts)
76 #   test-passed
77 #     generated by automatic directory-test-thyself procedure
78 find . \( \
79         -type l -o \
80         -name '*~' -o \
81         -name '#*#' -o \
82         -name '.#*' -o \
83         -name '*.orig' -o \
84         -name '.*.orig' -o \
85         -name '*.rej' -o \
86         -name '?*.x86f' -o \
87         -name '?*.axpf' -o \
88         -name '?*.lbytef' -o \
89         -name '?*.fasl' -o \
90         -name 'core' -o \
91         -name '?*.core' -o \
92         -name '*.map' -o \
93         -name '*.nm' -o \
94         -name '*.host-obj' -o \
95         -name '*.lisp-obj' -o \
96         -name '*.target-obj' -o \
97         -name '*.lib' -o \
98         -name '*.tmp' -o \
99         -name '*.lisp-temp' -o \
100         -name '*.o' -o \
101         -name '*.so' -o \
102         -name 'a.out' -o \
103         -name 'sbcl' -o \
104         -name 'sbcl.h' -o \
105         -name 'depend' -o \
106         -name 'TAGS' -o \
107         -name 'tags' -o \
108         -name 'test-passed' -o \
109         -name 'local-target-features.lisp-expr' \) -print | xargs rm -f
110
111 cd doc && sh ./clean.sh