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