+empty=
+space=$(empty) $(empty)
+
+# -----------------------------------------------------------------------------
+
+ifeq "$(ghc_ge_609)" "YES"
+GhcLibHcOpts += -fno-warn-deprecated-flags
+endif
+
+ifeq "$(RelocatableBuild)" "YES"
+# On Windows we want to make moveable bindists, but we need to tell
+# ghc-pkg where the haddock docs are. Therefore we completely ignore
+# where the user tells us to put the haddock documentation and put it
+# somewhere whose relative location we know. When installing we need
+# to give Cabal a real path, though.
+iprefix = $$topdir
+ibindir = $$topdir
+ilibdir = $$topdir
+ilibexecdir = $$topdir
+idynlibdir = $$topdir
+idatadir = $$topdir
+idocdir = $$topdir/doc/libraries/$$pkg
+ihaddockdir = $$topdir/doc/libraries/$$pkg
+ihtmldir = $$httptopdir/doc/libraries/$$pkg
+html_installed_root = $(prefix)/doc/libraries
+else
+# On non-Windows we can just give absolute paths all the time, and
+# thus obey the htmldir that we are given.
+iprefix = $(prefix)
+ibindir = $(bindir)
+ilibdir = $(libdir)
+ilibexecdir = $(libexecdir)
+idynlibdir = $(dynlibdir)
+idatadir = $(datadir)
+idocdir = $(docdir)/libraries/$$pkg
+ihaddockdir = $(htmldir)/libraries/$$pkg
+ihtmldir = $(htmldir)/libraries/$$pkg
+html_installed_root = $(htmldir)/libraries
+endif
+
+ifneq "$(DOING_BIN_DIST)" "YES"
+
+CONFIGURE_OPTS =
+CONFIGURE_STAMP_EXTRAS :=
+
+ifneq "$(findstring $(space)p$(space), $(space)$(GhcLibWays)$(space))" ""
+CONFIGURE_OPTS += --enable-library-profiling
+CONFIGURE_STAMP_EXTRAS := $(CONFIGURE_STAMP_EXTRAS)-profiling
+endif
+
+ifneq "$(findstring $(space)dyn$(space), $(space)$(GhcLibWays)$(space))" ""
+CONFIGURE_OPTS += --enable-shared
+CONFIGURE_STAMP_EXTRAS := $(CONFIGURE_STAMP_EXTRAS)-shared
+endif
+
+ifeq "$(SplitObjs)" "YES"
+CONFIGURE_OPTS += --enable-split-objs
+CONFIGURE_STAMP_EXTRAS := $(CONFIGURE_STAMP_EXTRAS)-splitting
+endif
+
+ifneq "$(HSCOLOUR)" ""
+CONFIGURE_OPTS += --with-hscolour=$(HSCOLOUR)
+endif
+
+DEPLOYMENT_OPTS = $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS)) \
+ $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
+
+.PHONY: subdirs
+
+subdirs:
+ @echo $(SUBDIRS)
+
+.PHONY: boot
+
+boot: ifBuildable/ifBuildable cabal-bin ghc-prim/Setup
+
+HERE_ABS=$(FPTOOLS_TOP_ABS)/libraries
+
+IFBUILDABLE=ifBuildable/ifBuildable $(HERE_ABS)/boot-packages
+CABAL=$(HERE_ABS)/cabal-bin
+
+CABAL_GHC_FLAGS = -Wall
+ifeq "$(ghc_ge_605)" "NO"
+CABAL_GHC_FLAGS += -cpp
+endif
+
+BOOTSTRAPPING_FLAGS = $(CABAL_GHC_FLAGS) -DCABAL_VERSION=1,3 -odir $(HERE_ABS)/bootstrapping -hidir $(HERE_ABS)/bootstrapping -i$(HERE_ABS)/Cabal -i$(HERE_ABS)/filepath
+
+# We use -main-is so that GHC doesn't get confused and think
+# Main.hi/Main.o from cabal belongs to ghc-prim/Setup, or vice-versa.
+cabal-bin: cabal-bin.hs
+ $(GHC) $(BOOTSTRAPPING_FLAGS) --make cabal-bin -o cabal-bin -main-is Cabal
+
+# ghc-prim/Setup doesn't really depend on cabal-bin, but pretending that it
+# does sequentialises building the two of them, which is nice given
+# they're sharing -odir and -hidir.
+ghc-prim/Setup: ghc-prim/Setup.hs cabal-bin
+ cd ghc-prim && $(GHC) $(BOOTSTRAPPING_FLAGS) --make Setup -o Setup
+
+installPackage/installPackage: installPackage.hs
+ -$(RM) -rf installPackage
+ mkdir installPackage
+ $(CP) installPackage.hs installPackage/
+ cd installPackage && $(FPTOOLS_TOP_ABS)/compiler/stage1/ghc-inplace \
+ --make installPackage -o installPackage \
+ $(DEPLOYMENT_OPTS)
+
+ifBuildable/ifBuildable: ifBuildable.hs
+ -$(RM) -rf ifBuildable
+ mkdir ifBuildable
+ $(CP) ifBuildable.hs ifBuildable/
+ifeq "$(stage)" "2"
+ cd ifBuildable && ../$(HC) -Wall --make ifBuildable -o ifBuildable \
+ $(DEPLOYMENT_OPTS)
+else
+ cd ifBuildable && $(GHC) -Wall --make ifBuildable -o ifBuildable
+endif
+
+.PHONY: all build configure
+
+all: build
+
+ifeq "$(HADDOCK_DOCS)" "YES"
+all: doc
+endif
+
+.PHONY: rebuild.library.%
+.PHONY: remake.library.%
+
+$(foreach SUBDIR,$(SUBDIRS),rebuild.library.$(SUBDIR)):\
+rebuild.library.%: clean.library.% build.library.%
+
+$(foreach SUBDIR,$(SUBDIRS),remake.library.$(SUBDIR)):\
+remake.library.%: clean.library.% make.library.%
+
+# NB. we're depending on make chasing dependencies from left to right here.
+# This bit goes wrong with 'make -j'.
+build: $(foreach SUBDIR,$(SUBDIRS),make.library.$(SUBDIR)) \
+ installPackage/installPackage
+
+configure: $(foreach SUBDIR,$(SUBDIRS), \
+ stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).$(SUBDIR))
+
+.PHONY: build.library.%
+.PHONY: make.library.%
+
+# We should depend on %/%.cabal here (and in other rules), but make
+# makes that difficult.
+
+# We put non-existant paths in when configuring, as we require that
+# builds don't depend on these paths when making bindists.
+
+# We rely on all the CONFIGURE_ARGS being quoted with '...', and there
+# being no 's inside the values.
+FLAGGED_CONFIGURE_ARGS = $(subst $(space)',\
+ $(space)--configure-option=',\
+ $(space)$(CONFIGURE_ARGS))
+
+ifeq "$(Windows)" "YES"
+NONEXISTENT=c:/NONEXISTENT
+else
+NONEXISTENT=/NONEXISTENT
+endif