-echo "*** Building library..."
-echo "GhcWithHscBuiltViaC=NO" >>mk/build.mk
-$MAKE -C ghc/lib clean boot all || exit 1
-$MAKE -C hslibs clean boot all
+echo "*** Building libraries..."
+GHC="$PWD/ghc/compiler/ghc-inplace" HappyCmd="$PWD/distrib/fake-happy" ./configure
+
+# make ghc/utils while we still have libraries in ghc/lib
+$MAKE -C ghc/utils clean boot
+$MAKE -C ghc/utils all
+
+# now, clean and build the libraries
+$MAKE -C ghc/lib clean boot
+$MAKE -C ghc/lib all
+$MAKE -C hslibs clean boot
+$MAKE -C hslibs all