0.pre7.137:
[sbcl.git] / slam.sh
1 #!/bin/sh
2
3 # a quick and dirty way of partially rebuilding the system after a
4 # change
5 #
6 # ("smooth duct tape: the mark of a true craftsman":-)
7
8 # This software is part of the SBCL system. See the README file for
9 # more information.
10 #
11 # This software is derived from the CMU CL system, which was
12 # written at Carnegie Mellon University and released into the
13 # public domain. The software is in the public domain and is
14 # provided with absolutely no warranty. See the COPYING and CREDITS
15 # files for more information.
16
17 #######################################################################
18 # You probably don't want to be using this script unless you
19 # understand the ordinary system build process pretty well already.
20 #
21 # This script is not a reliable way to build the system, but it is
22 # fast.:-| It can be useful if you are trying to debug a low-level
23 # problem, e.g. a problem in src/runtime/*.c or in
24 # src/code/cold-init.lisp. Soon, you'll find yourself wanting to 
25 # test a small change in a file compiled into cold-sbcl.core without
26 # redoing the entire rebuild-the-system-from-scratch process. You may be
27 # able to avoid a complete make-host-2.sh by just letting this script
28 # rebuild only files that have changed. On the other hand, it might
29 # not work...
30 #
31 # It's not anywhere rigorously correct for all small changes, much
32 # less for all large changes. It can't be, unless we either solve the
33 # halting problem or totally rearchitect the SBCL sources to support
34 # incremental recompilation. Beyond that fundamental limitation, even
35 # an easy special case might not work unless someone's paid attention
36 # to making it work. Here are some highlights to help you understand
37 # when it will work:
38 #  * It will rebuild a .fasl file when the corresponding
39 #    .lisp file is out of date.
40 #  * It rebuilds the src/runtime/ files completely, since that
41 #    doesn't take very long anyway.
42 #  * Apparently it will not rebuild assembly-code-in-.lisp files
43 #    even when the sources are out of date. This is probably not a
44 #    fundamental limitation, it's just that I (WHN 2002-01-16)
45 #    have made vanishingly nontrivial changes to assembler files,
46 #    so I'm not motivated. If you're motivated, please send a patch.
47 #  * It will not notice when you change something in one .lisp file
48 #    which should affect the compilation of code in another .lisp
49 #    file. E.g.
50 #    ** changing the definition of a macro used in another file (or a
51 #       function or a variable which is used at macroexpansion time)
52 #    ** changing the value of a DEFCONSTANT used in another file
53 #    ** changing the layout of a structure used in another file
54 #    ** changing the PROCLAIMed type of something used in another
55 #       file
56 #    Mostly it looks as though such limitations aren't fixable without
57 #    the aforementioned rearchitecting or solving the halting problem.
58 #######################################################################
59
60 if [ "" != "$*" ]; then
61     echo no command line arguments supported in this version of slam
62     exit 1
63 fi
64
65 # We don't try to be general about this in this script the way we are
66 # in make.sh, since the idiosyncrasies of SBCL command line argument
67 # order dependence, the meaninglessness of duplicate --core arguments,
68 # and the SBCL-vs-CMUCL dependence of --core/-core argument syntax
69 # make it too messy to try deal with arbitrary SBCL_XC_HOST variants.
70 # So you have no choice:
71 export SBCL_XC_HOST='sbcl --noprogrammer'
72
73 # (We don't do make-host-1.sh at all. Hopefully nothing relevant has
74 # changed.)
75
76 sh make-target-1.sh || exit 1
77
78 # Instead of doing the full make-host-2.sh, we (1) use after-xc.core
79 # to rebuild only obviously-out-of-date Lisp files, then (2) run
80 # GENESIS.
81 sbcl --core output/after-xc.core --sysinit /dev/null --userinit /dev/null <<'EOF' || exit 1
82   (load "src/cold/slam.lisp")
83 EOF
84 # (This ^ used to be
85 #   for f in $*; do echo "(target-compile-stem \"$f\")"; done \
86 #     | sbcl --core output/after-xc.core || exit 1
87 # and perhaps we do something like this again, allowing explicit
88 # rebuild-this-stem requests on the command line to supplement
89 # the rebuild-obviously-outdated-stems logic above.)
90 #
91 sh make-genesis-2.sh || exit 1 
92
93 sh make-target-2.sh || exit 1
94
95 echo //ordinary termination of slam.sh
96 date