ea616bee1d1d06fc5714ff95fd84169069f8adb5
[ghc-hetmet.git] / distrib / cross-port
1 #! /bin/bash
2
3 # This script can be used to generate some unregisterised .hc files
4 # for bootstrapping GHC on a new/unsupported platform.  It involves a
5 # two-stage bootstrap: the first stage builds an unregisterised set of
6 # libraries & RTS, and the second stage builds an unregisterised
7 # compiler.  
8
9 # Take the .hc files from the libraries of stage 1, and the compiler
10 # of stage 2, to the target system and bootstrap from these to get a
11 # working (unregisterised) compiler.
12
13 set -e
14
15 long='-optc-DNO_REGS -optc-DUSE_MINIINTERPRETER -fno-asm-mangling -funregisterised -fvia-C'
16
17 base=`pwd`
18
19 if [ ! -f b1-stamp ]; then
20   mkdir b1
21   cd b1
22   lndir ../fptools
23   cd ..
24
25   mkdir b1-obj
26
27   cd b1
28    ./configure --prefix=$base/b1-obj
29    echo "GhcLibHcOpts = -O -H24m -keep-hc-files-too $long" >> mk/config.mk
30    echo "GhcRtsHcOpts = -O $long" >> mk/config.mk
31    make boot
32    make all
33    make install
34   cd ..
35
36   touch b1-stamp
37 fi
38
39 # exit 0
40
41 if [ ! -f b2-stamp ]; then
42   mkdir b2
43   cd b2
44   lndir ../fptools
45   cd ..
46
47   mkdir b2-obj
48   cd b2
49    ./configure --prefix=$base/b2-obj --with-hc=$base/b1-obj/bin/ghc
50    echo "WithGhcHc = $base/b1-obj/bin/ghc" >> mk/config.mk
51    echo "GhcHcOpts = -O -H24m -keep-hc-files-too $long" >> mk/config.mk
52    echo "GhcWithNativeCodeGen=NO" >> mk/config.mk
53    make boot
54    make all
55    make install
56   cd ..
57
58   touch b2-stamp
59 fi