stub makefile
[ghc.git] / boot
1 #! /bin/sh
2 set -e
3
4 # Check that we have all boot packages.
5 for dir in `grep "^[^# ][^ ]*  *[^ ][^ ]*  *[^ ][^ ]*$" packages | sed "s/ .*//"`
6 do
7     if test ! -f $dir/LICENSE
8     then
9         echo "Error: $dir/LICENSE doesn't exist." >&2
10         echo "Maybe you haven't done './darcs-all get'?" >&2
11         exit 1
12     fi
13 done
14
15 # autoreconf everything that needs it.
16 for dir in . libraries/*
17 do
18     if test -f $dir/configure.ac
19     then
20         echo "Booting $dir"
21         ( cd $dir && autoreconf )
22     fi
23 done
24
25 # Alas, darcs doesn't handle file permissions, so fix a few of them.
26 for f in boot darcs-all push-all validate
27 do
28     if test -f $f
29     then
30         chmod +x $f
31     fi
32 done
33
34 libraries=
35
36 for f in libraries/*; do
37   pkgs=$f/ghc-packages
38   if test -f $pkgs; then
39     for p in `cat $pkgs`; do
40       libraries="$libraries $f/$p"
41     done
42   else
43     libraries="$libraries $f"
44   fi
45 done
46
47 for f in $libraries; do
48    dir=`basename $f`
49    cabals=`echo $f/*.cabal`
50    if test -f $cabals; then
51        echo "Creating $f/ghc.mk"
52        rm -f $f/ghc.mk
53        pkg=`echo "$cabals" | sed -e 's#.*/##' -e 's#\.cabal$##'`
54        if test -f $f/ghc-stage; then
55            stage=`cat $f/ghc-stage`
56        else
57            stage=1
58        fi
59        top=`echo $f | sed 's#[^/]\+#..#g'`
60        echo "${f}_PACKAGE = ${pkg}" >> $f/ghc.mk
61        echo "${f}_dist-install_GROUP = libraries" >> $f/ghc.mk
62        echo "\$(eval \$(call build-package,${f},dist-install,${stage}))" >> $f/ghc.mk
63        rm -f $f/GNUmakefile
64        echo "Creating $f/GNUmakefile"
65        echo "dir = ${f}" >> $f/GNUmakefile
66        echo "TOP = ${top}" >> $f/GNUmakefile
67        echo "include \$(TOP)/mk/sub-makefile.mk" >> $f/GNUmakefile
68    fi
69 done