0.6.11.13:
[sbcl.git] / make.sh
1 #!/bin/sh
2
3 # "When we build software, it's a good idea to have a reliable method
4 # for getting an executable from it. We want any two reconstructions
5
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. 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 #   "lisp -batch" to use an existing CMU CL binary as a cross-compilation host
30 #   "lisp -noinit -batch" 
31 #                 to use an existing CMU CL binary as a cross-compilation host
32 #                 when you have weird things in your .cmucl-init file
33 #
34 # FIXME: Make a more sophisticated command line parser, probably
35 # accepting "sh make.sh --xc-host foolisp" instead of the
36 # the present "sh make.sh foolisp".
37 # FIXME: Tweak this script, and the rest of the system, to support
38 # a second bootstrapping pass in which the cross-compilation host is
39 # known to be SBCL itself, so that the cross-compiler can do some
40 # optimizations (especially specializable arrays) that it doesn't
41 # know how to implement how in a portable way. (Or maybe that wouldn't
42 # require a second pass, just testing at build-the-cross-compiler time
43 # whether the cross-compilation host returns suitable values from 
44 # UPGRADED-ARRAY-ELEMENT-TYPE?)
45 export SBCL_XC_HOST="${1:-sbcl}"
46 echo //SBCL_XC_HOST=\"$SBCL_XC_HOST\"
47
48 # If you're cross-compiling, you should probably just walk through the
49 # make-config.sh script by hand doing the right thing on both the host
50 # and target machines.
51 sh make-config.sh || exit 1
52
53 # The make-host-*.sh scripts are run on the cross-compilation host,
54 # and the make-target-*.sh scripts are run on the target machine. In
55 # ordinary compilation, we just do these phases consecutively on the
56 # same machine, but if you wanted to cross-compile from one machine
57 # which supports Common Lisp to another which does not (yet:-) support
58 # Common Lisp, you could do something like this:
59 #   Create copies of the source tree on both the host and the target.
60 #   Read the make-config.sh script carefully and emulate it by hand
61 #     on both machines (e.g. creating "target"-named symlinks to
62 #     identify the target architecture).
63 #   On the host system:
64 #     SBCL_XC_HOST=<whatever> sh make-host-1.sh
65 #   Copy src/runtime/sbcl.h from the host system to the target system.
66 #   On the target system:
67 #     sh make-target-1.sh
68 #   Copy src/runtime/sbcl.nm from the target system to the host system.
69 #   On the host system:
70 #     SBCL_XC_HOST=<whatever> sh make-host-2.sh
71 #   Copy output/cold-sbcl.core from the host system to the target system.
72 #   On the target system:
73 #     sh make-host-2.sh
74 sh make-host-1.sh   || exit 1
75 sh make-target-1.sh || exit 1
76 sh make-host-2.sh   || exit 1
77 sh make-target-2.sh || exit 1