0.7.9.5:
[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 # To make this work, you need an after-xc.core file. To cause the 
60 # system to generate an after-xc.core file, you need
61 # :SB-AFTER-XC-CORE in target features during an ordinary build.
62 # See the comments in base-target-features.lisp-expr for the 
63 # recommended way to make that happen.
64 #######################################################################
65
66 HOST_TYPE="${1:-sbcl}"
67
68 echo //HOST_TYPE=\"$HOST_TYPE\"
69
70 # We don't try to be general about this in this script the way we are
71 # in make.sh, since the idiosyncrasies of SBCL command line argument
72 # order dependence, the meaninglessness of duplicate --core arguments,
73 # and the SBCL-vs-CMUCL dependence of --core/-core argument syntax
74 # make it too messy to try deal with arbitrary SBCL_XC_HOST variants.
75 # So you have no choice:
76 case "$HOST_TYPE" in
77     cmucl) LISP="lisp -batch"
78            INIT="-noinit"
79            CORE="-core"
80            ;;
81     sbcl)  LISP="sbcl"
82            INIT="--sysinit /dev/null --userinit /dev/null"
83            CORE="--core"
84            ;;
85     *)     echo unknown host type: "$HOST_TYPE"
86            echo should be one of "sbcl" or "cmucl"
87            exit 1
88 esac
89
90 export SBCL_XC_HOST="$LISP $INIT"
91
92 # (We don't do make-host-1.sh at all. Hopefully nothing relevant has
93 # changed.)
94
95 sh make-target-1.sh || exit 1
96
97 # Instead of doing the full make-host-2.sh, we (1) use after-xc.core
98 # to rebuild only obviously-out-of-date Lisp files, then (2) run
99 # GENESIS.
100 $LISP $CORE output/after-xc.core $INIT <<'EOF' || exit 1
101   (load "src/cold/slam.lisp")
102 EOF
103 # (This ^ used to be
104 #   for f in $*; do echo "(target-compile-stem \"$f\")"; done \
105 #     | sbcl --core output/after-xc.core || exit 1
106 # and perhaps we do something like this again, allowing explicit
107 # rebuild-this-stem requests on the command line to supplement
108 # the rebuild-obviously-outdated-stems logic above.)
109 #
110 sh make-genesis-2.sh || exit 1 
111
112 sh make-target-2.sh || exit 1
113
114 echo //ordinary termination of slam.sh
115 date