814426aa8f199e4f2c74ec792564568655cb7151
[ghc.git] / STARTUP.in
1 #! /bin/sh
2 #
3 # die quickly if anything goes astray...
4 set -e
5
6 # figure out the absolute pathname of the "top" directory
7 # (the one which has "mkworld", "nofib", "glafp-utils", etc., as subdirs)
8 hardtop=`pwd`
9 hardtop=`echo $hardtop | sed 's|^/tmp_mnt/|/|' | sed 's|^/export/|/|' | sed 's|^/grasp_tmp|/local/grasp_tmp|'`
10 echo ''
11 echo "*** The top of your build tree is: $hardtop"
12
13 case "$hardtop" in
14   # NeXTStep brain damage
15   /private/tmp_mnt/auto* )
16     echo '***'
17     echo '*** AAARRRGGGHHHH!!!'
18     echo '***'
19     echo '*** Stupid automounter (and pwd) will not tell me'
20     echo '*** the absolute pathname for the current directory.'
21     echo '*** Be sure to set TopDirPwd in mkworld/site-DEF.jm.'
22     echo '*** (Then it does not matter what this script decides.)'
23     echo '***'
24     ;;
25 esac
26
27 # make "mkworld", "literate", and "glafp-utils" (no special configuration)
28
29 #       make all the Makefiles first
30
31 for i in @DoingMkWorld@ @DoingGlaFpUtils@ @DoingLiterate@ ; do
32   if [ -d $i ] ; then
33     ( set -e;                                                                   \
34       cd $i ;                                                                   \
35       echo '' ;                                                                 \
36       echo "*** configuring $i ..." ;                                           \
37       make -f Makefile.BOOT BOOT_DEFINES="-P none -S std -DTopDirPwd=$hardtop"; \
38       echo '' ;                                                                 \
39       echo "*** making Makefiles in $i ..." ;                                   \
40       make Makefile ;                                                           \
41       make Makefiles                                                            \
42     )
43   else
44     echo warning: $i is not a directory -- doing nothing for it
45   fi
46 done
47
48 #       now make the dependencies and Real Stuff
49
50 for i in @DoingMkWorld@ @DoingGlaFpUtils@ @DoingLiterate@ ; do
51   if [ -d $i ] ; then
52     ( set -e;                                                                   \
53       cd $i ;                                                                   \
54       echo '' ;                                                                 \
55       echo "*** making dependencies in $i ..." ;                                \
56       make depend ;                                                             \
57       echo '' ;                                                                 \
58       echo "*** making all in $i ..." ;                                         \
59       make all                                                                  \
60     )
61   else
62     echo warning: $i is not a directory -- doing nothing for it
63   fi
64 done
65
66 # OK, now make the \`real' Makefiles
67
68 passed_in_setup="-S @MkWorldSetup@"
69
70 for i in @DoingGHC@ @DoingHappy@ @DoingHaggis@ @DoingNoFib@ EndOfList ; do
71   if [ $i = nofib ] ; then
72      setup=$passed_in_setup
73   else
74      setup=''
75   fi
76   if [ -d $i ] ; then
77     ( set -e;                                                                   \
78       cd $i ;                                                                   \
79       echo '' ;                                                                 \
80       echo "*** configuring $i ..." ;                                           \
81       make -f Makefile.BOOT BOOT_DEFINES="-P $i $setup -C mkworld -DTopDirPwd=$hardtop"; \
82       echo '' ;                                                                 \
83       echo "*** making Makefiles in $i ..." ;                                   \
84       make Makefile ;                                                           \
85       make Makefiles                                                            \
86     )
87   else
88     if [ $i != EndOfList ] ; then
89         echo warning: $i is not a directory -- doing nothing for it
90     fi
91   fi
92 done
93
94 # Finally, the dependencies
95
96 for i in @DoingGHC@ @DoingHappy@ @DoingHaggis@ @DoingNoFib@ EndOfList ; do
97   if [ -d $i ] ; then
98     ( set -e;                                                                   \
99       cd $i ;                                                                   \
100       echo '' ;                                                                 \
101       echo "*** making dependencies in $i ..." ;                                \
102       make depend                                                               \
103     )
104   else
105     if [ $i != EndOfList ] ; then
106         echo warning: $i is not a directory -- doing nothing for it
107     fi
108   fi
109 done
110
111 echo ''
112 echo '*******************************************************************'
113 echo "* Looking good! All you should need to do now is...               *"
114 echo '*                                                                 *'
115 for i in @DoingGHC@ @DoingHappy@ @DoingHaggis@ @DoingNoFib@ EndOfList ; do
116     if [ $i != EndOfList ] ; then
117         echo "        cd $i"
118         if [ $i = nofib ] ; then
119             echo '        make all        # or...'
120             echo '        make runtests'
121         else
122             echo '        make all'
123             echo '        make install   # if you are so inclined...'
124         fi
125     fi
126 done
127 echo '*                                                                 *'
128 echo '*******************************************************************'
129 exit 0