make make.sh run clean.sh
[sbcl.git] / make.sh
1 #!/bin/sh
2 set -e
3
4 LANG=C
5 LC_ALL=C
6 export LANG LC_ALL
7
8 # "When we build software, it's a good idea to have a reliable method
9 # for getting an executable from it. We want any two reconstructions
10 # starting from the same source to end up in the same result. That's
11 # just a basic intellectual premise."
12 #     -- Christian Queinnec, in _Lisp In Small Pieces_, p. 313
13
14 # This software is part of the SBCL system. See the README file for
15 # more information.
16 #
17 # This software is derived from the CMU CL system, which was
18 # written at Carnegie Mellon University and released into the
19 # public domain. The software is in the public domain and is
20 # provided with absolutely no warranty. See the COPYING and CREDITS
21 # files for more information.
22
23 # Running make.sh with different options without clean.sh in the middle
24 # can break things.
25 sh clean.sh
26
27 # If you're cross-compiling, make-config.sh should "do the right
28 # thing" when run on the target machine, with the minor caveat that
29 # any --xc-host parameter should be suitable for the host machine
30 # instead of the target.
31 sh make-config.sh "$@" || exit $?
32
33 . output/prefix.def
34 . output/build-config
35
36 build_started=`date`
37 echo "//Starting build: $build_started"
38 # Apparently option parsing succeeded. Print out the results.
39 echo "//Options: --prefix='$SBCL_PREFIX' --xc-host='$SBCL_XC_HOST'"
40
41 # Enforce the source policy for no bogus whitespace
42 tools-for-build/canonicalize-whitespace
43
44 # The make-host-*.sh scripts are run on the cross-compilation host,
45 # and the make-target-*.sh scripts are run on the target machine. In
46 # ordinary compilation, we just do these phases consecutively on the
47 # same machine, but if you wanted to cross-compile from one machine
48 # which supports Common Lisp to another which does not (yet:-) support
49 # Common Lisp, you could do something like this:
50 #   Create copies of the source tree on both the host and the target.
51 #   Read the make-config.sh script carefully and emulate it by hand
52 #     on both machines (e.g. creating "target"-named symlinks to
53 #     identify the target architecture).
54 #   On the host system:
55 #     SBCL_XC_HOST=<whatever> sh make-host-1.sh
56 #   Copy src/runtime/genesis/*.h from the host system to the target
57 #     system.
58 #   On the target system:
59 #     sh make-target-1.sh
60 #   Copy src/runtime/sbcl.nm and output/stuff-groveled-from-headers.lisp
61 #     from the target system to the host system.
62 #   On the host system:
63 #     SBCL_XC_HOST=<whatever> sh make-host-2.sh
64 #   Copy output/cold-sbcl.core from the host system to the target system.
65 #   On the target system:
66 #     sh make-target-2.sh
67 #     sh make-target-contrib.sh
68 # Or, if you can set up the files somewhere shared (with NFS, AFS, or
69 # whatever) between the host machine and the target machine, the basic
70 # procedure above should still work, but you can skip the "copy" steps.
71 time sh make-host-1.sh
72 time sh make-target-1.sh
73 time sh make-host-2.sh
74 time sh make-target-2.sh
75 time sh make-target-contrib.sh
76
77 NCONTRIBS=`find contrib -name Makefile -print | wc -l`
78 NPASSED=`find contrib -name test-passed -print | wc -l`
79 echo
80 echo "The build seems to have finished successfully, including $NPASSED (out of $NCONTRIBS)"
81 echo "contributed modules. If you would like to run more extensive tests on"
82 echo "the new SBCL, you can try:"
83 echo
84 echo "  cd tests && sh ./run-tests.sh"
85 echo
86 echo "  (All tests should pass on x86/Linux, x86/FreeBSD4, and ppc/Darwin. On"
87 echo "  other platforms some failures are currently expected; patches welcome"
88 echo "  as always.)"
89 echo
90 echo "To build documentation:"
91 echo
92 echo "  cd doc/manual && make"
93 echo
94 echo "To install SBCL (more information in INSTALL):"
95 echo
96 echo "  sh install.sh"
97
98 # This is probably the best place to ensure people will see this.
99 if test -n "$legacy_xc_spec"
100 then
101     echo <<EOF
102 ******************************************************************************
103 **
104 **  Old-style XC-host specification detected: '$SBCL_XC_HOST'
105 **
106 **  Since 1.0.41.45 SBCL expects the XC-host to be specified using
107 **  the --xc-host='myhost' command line option, not with a positional
108 **  argument. The legacy style still works, but will not be supported
109 **  indefinitely. Please update your build procedure.
110 **
111 ******************************************************************************
112 EOF
113 fi
114
115 build_finished=`date`
116 echo
117 echo "//build started:  $build_started"
118 echo "//build finished: $build_finished"