[project @ 2001-07-23 23:10:03 by ken]
[ghc-hetmet.git] / distrib / hc-build
1 #!/bin/sh -e
2
3 # Manuel M. T. Chakravarty <chak@acm.org>, June 2000
4 # Updated for GHC 5.00, Simon Marlow, March 2001
5 #
6 # Script to build GHC from .hc files (must be run in the fptools/ root
7 # directory into which the source and .hc files must already have been
8 # unpacked).  All options are passed through to ./configure (especially
9 # useful with --prefix).
10
11 configopts="$*"         # e.g., --enable-hc-boot-unregisterised
12
13 # check for GNU make
14 #
15 MAKENAMES="gmake make no-make"
16 for make in $MAKENAMES; do
17   MAKE=$make
18   $make --version 2>&1 | grep "GNU Make" >/dev/null && break
19 done
20 if [ $MAKE = no-make ]; then
21   echo "Fatal error: Cannot find the GNU make utility"
22   exit 1
23 fi
24
25 # build configuration
26 #
27 cat >mk/build.mk <<END
28 # nothing!
29 END
30
31 # touch happy generated files; so that in non-bootstrapping mode for
32 # installation, no attempt is made to call happy
33 #
34 touch ghc/compiler/rename/ParseIface.hs
35 touch ghc/compiler/parser/Parser.hs
36 touch ghc/compiler/main/ParsePkgConf.hs
37
38 echo "*** Building hsc..."
39 ./configure --enable-hc-boot $configopts
40 $MAKE -C glafp-utils boot all
41 $MAKE -C ghc boot
42 $MAKE -C hslibs boot all
43 $MAKE -C ghc all
44
45 echo "*** Building libraries..."
46 GHC="$PWD/ghc/compiler/ghc-inplace" HappyCmd="$PWD/distrib/fake-happy" ./configure
47
48 # make ghc/utils while we still have libraries in ghc/lib
49 $MAKE -C ghc/utils clean boot
50 $MAKE -C ghc/utils all
51
52 # now, clean and build the libraries
53 $MAKE -C ghc/lib   clean boot
54 $MAKE -C ghc/lib   all
55 $MAKE -C hslibs    clean boot
56 $MAKE -C hslibs    all