0.pre7.86.flaky7.22:
[sbcl.git] / make.sh
1
2 #!/bin/sh
3
4 # "When we build software, it's a good idea to have a reliable method
5 # for getting an executable from it. We want any two reconstructions
6 # starting from the same source to end up in the same result. That's
7 # just a basic intellectual premise."
8 #     -- Christian Queinnec, in _Lisp In Small Pieces_, p. 313
9
10 # This software is part of the SBCL system. See the README file for
11 # more information.
12 #
13 # This software is derived from the CMU CL system, which was
14 # written at Carnegie Mellon University and released into the
15 # public domain. The software is in the public domain and is
16 # provided with absolutely no warranty. See the COPYING and CREDITS
17 # files for more information.
18
19 # The value of SBCL_XC_HOST should be a command to invoke the
20 # cross-compilation Lisp system in such a way that it reads commands
21 # from standard input, and terminates when it reaches end of file on
22 # standard input. Some suitable values are:
23 #   "sbcl"        to use an existing SBCL binary as a cross-compilation host
24 #   "sbcl --sysinit /dev/null --userinit /dev/null"
25 #                 to use an existing SBCL binary as a cross-compilation host
26 #                 even though you have stuff in your initialization files
27 #                 which makes it behave in such a non-standard way that
28 #                 it keeps the build from working
29 #   "sbcl --noprogrammer"
30 #                 to use an existing SBCL binary as a cross-compilation host
31 #                 and tell it to handle errors as best it can by itself,
32 #                 without trying to use *DEBUG-IO* to ask for help from
33 #                 the programmer
34 #   "lisp -batch" to use an existing CMU CL binary as a cross-compilation host
35 #   "lisp -noinit -batch" 
36 #                 to use an existing CMU CL binary as a cross-compilation host
37 #                 when you have weird things in your .cmucl-init file
38 #
39 # FIXME: Make a more sophisticated command line parser, probably
40 # accepting "sh make.sh --xc-host foolisp" instead of the
41 # the present "sh make.sh foolisp".
42 # FIXME: Tweak this script, and the rest of the system, to support
43 # a second bootstrapping pass in which the cross-compilation host is
44 # known to be SBCL itself, so that the cross-compiler can do some
45 # optimizations (especially specializable arrays) that it doesn't
46 # know how to implement how in a portable way. (Or maybe that wouldn't
47 # require a second pass, just testing at build-the-cross-compiler time
48 # whether the cross-compilation host returns suitable values from 
49 # UPGRADED-ARRAY-ELEMENT-TYPE?)
50 export SBCL_XC_HOST="${1:-sbcl --noprogrammer}"
51 echo //SBCL_XC_HOST=\"$SBCL_XC_HOST\"
52
53 # If you're cross-compiling, you should probably just walk through the
54 # make-config.sh script by hand doing the right thing on both the host
55 # and target machines.
56 sh make-config.sh || exit 1
57
58 # The make-host-*.sh scripts are run on the cross-compilation host,
59 # and the make-target-*.sh scripts are run on the target machine. In
60 # ordinary compilation, we just do these phases consecutively on the
61 # same machine, but if you wanted to cross-compile from one machine
62 # which supports Common Lisp to another which does not (yet:-) support
63 # Common Lisp, you could do something like this:
64 #   Create copies of the source tree on both the host and the target.
65 #   Read the make-config.sh script carefully and emulate it by hand
66 #     on both machines (e.g. creating "target"-named symlinks to
67 #     identify the target architecture).
68 #   On the host system:
69 #     SBCL_XC_HOST=<whatever> sh make-host-1.sh
70 #   Copy src/runtime/sbcl.h from the host system to the target system.
71 #   On the target system:
72 #     sh make-target-1.sh
73 #   Copy src/runtime/sbcl.nm from the target system to the host system.
74 #   On the host system:
75 #     SBCL_XC_HOST=<whatever> sh make-host-2.sh
76 #   Copy output/cold-sbcl.core from the host system to the target system.
77 #   On the target system:
78 #     sh make-host-2.sh
79 sh make-host-1.sh   || exit 1
80 sh make-target-1.sh || exit 1
81 sh make-host-2.sh   || exit 1
82 sh make-target-2.sh || exit 1
83 date