#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
-# ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
+# ETH Zurich D-INFK, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
##########################################################################
DFLTARCHS="\"x86_64\""
RUN_HAKE="Yes"
+TOOLCHAIN="ubuntu"
+HAKEDIR=$(dirname $0)
usage() {
echo "Usage: $0 <options>"
echo " $DFLTARCHS"
echo " -n|--no-hake: just rebuild hake itself, don't run it (only useful"
echo " for debugging hake)"
+ echo " -t|--toolchain: toolchain to use when bootstrapping a new"
+ echo " build tree (-t list for available options)."
echo ""
echo " The way you use this script is to create a new directory for your"
echo " build tree, cd into it, and run this script with the --source-dir"
echo " argument specifying the top of the source tree."
echo ""
echo " Known architectures may include: "
- echo " x86_64 x86_32 armv5 arm11mp scc xscale armv7 armv7-m k10m"
+ echo " x86_64 x86_32 armv5 arm11mp xscale armv7 armv7-m k10m"
exit 1;
}
+toolchains() {
+ TOOLCHAINS=$(ls ${HAKEDIR}/Config.hs.* | sed s/.*Config\.hs\.//)
+ echo "Available toolchains:"
+ for tc in ${TOOLCHAINS}; do
+ echo " $tc"
+ done
+ exit 1
+}
+
#
# Legacy compatibility to avoid breaking the harness...
#
case $1 in
"-a"|"--architecture")
if [ -z "$NEWARCHS" ] ; then
- NEWARCHS="\"$2\""
+ NEWARCHS="\"$2\""
else
- NEWARCHS="$NEWARCHS, \"$2\""
+ NEWARCHS="$NEWARCHS, \"$2\""
fi
+ shift
;;
"-i"|"--install-dir")
INSTALLDIR="$2"
+ shift
;;
"-s"|"--source-dir")
SRCDIR="$2"
+ shift
;;
"-n"|"--no-hake")
RUN_HAKE="No"
;;
+ "-t"|"--toolchain")
+ TOOLCHAIN="$2"
+ shift
+ if [ "${TOOLCHAIN}" == "list" ]; then
+ toolchains
+ fi
+ if [ ! -f ${HAKEDIR}/Config.hs.${TOOLCHAIN} ]; then
+ echo "Unknown toolchain \"${TOOLCHAIN}\""
+ exit 1
+ fi
+ ;;
*)
usage
;;
esac
- shift
shift
done
echo "Setting up hake build directory..."
if [ ! -f hake/Config.hs ]; then
- cp $SRCDIR/hake/Config.hs.template hake/Config.hs
+ echo "Bootstrapping with toolchain \"${TOOLCHAIN}\""
+ cp $SRCDIR/hake/Config.hs.${TOOLCHAIN} hake/Config.hs
cat >> hake/Config.hs <<EOF
-- Automatically added by hake.sh. Do NOT copy these definitions to the defaults
echo "Building hake..."
ghc -O --make -XDeriveDataTypeable \
-package ghc \
+ -package ghc-mtl \
-package ghc-paths \
-o hake/hake \
-outputdir hake \
-ihake \
-rtsopts=all \
-threaded \
- -with-rtsopts="-K32m" \
$SRCDIR/hake/Main.hs $LDFLAGS || exit 1
# -eventlog \
echo "Running hake..."
#./hake/hake --output-filename Makefile --source-dir "$SRCDIR" +RTS -s -N -K64M -A64M -ls -lf || exit
-./hake/hake --output-filename Makefile --source-dir "$SRCDIR" +RTS -N -K64M -A64M || exit
-cat <<EOF
-
-OK - Hake has bootstrapped. You should now have a Makefile in this
-directory, and you can type "make" to build a predefined target.
+#./hake/hake --output-filename Makefile --source-dir "$SRCDIR" +RTS -N -K64M -A64M || exit
+./hake/hake --output-filename Makefile --source-dir "$SRCDIR" +RTS -T || exit
-To change configuration options, edit the Config.hs file in the hake
-subdirectory of this directory and run "make rehake".
-
-To change the set of symbolic make targets available (for example, to
-build a different set of modules or architectures for your boot image),
-edit the local copy of the symbolic_targets.mk in this directory.
-EOF
+echo "Now running initial make to build dependencies."
+echo " (remove the '-j 4' if your system has trouble handling this"
+make -j 4 help