-# override default definition of HS_IFACES so we can add $(odir)
-HS_IFACES = $(addsuffix .$(way_)hi,$(basename $(HS_OBJS)))
-endif
-
-# Haddock can't handle recursive modules currently, so we disable it for now.
-override HADDOCK_DOCS = NO
-
-# Tell package.mk not to set $(HC)
-NO_SET_HC = YES
-
-# The stage 2 GHC binary itself is built by compiling main/Main.hs
-# (the same as used in stage 1) against the GHC package.
-#
-# This is done by compiling Main.hs separately and linking it with
-# -package ghc. This is done using a separate Makefile, Makefile.ghcbin
-# Why? See comments in Makefile.ghcbin
-
-# The stage 2 and stage 3 package.conf.in files are different, because they
-# point to either the stage2/ or stage3/ dirs in import-dirs. Hence before
-# linking the ghc binary we must install the correct version of the package
-# configuration. Yeuch... maybe one day this will all be done more cleanly.
-STAMP_PKG_CONF = $(GHC_DRIVER_DIR)/stamp-pkg-conf-$(PACKAGE)
-
-# Propagate standard targets to Makefile.ghcbin
-docs runtests $(BOOT_TARGET) TAGS clean distclean mostlyclean maintainer-clean $(INSTALL_TARGET) $(INSTALL_DOCS_TARGET) html chm HxS ps dvi txt::
- $(MAKE) -f Makefile.ghcbin $(MFLAGS) $@
-endif
-
-#-----------------------------------------------------------------------------
-# clean
-
-MAINTAINER_CLEAN_FILES += parser/Parser.info main/ParsePkgConf.info
-
-#-----------------------------------------------------------------------------
-# Include target-rule boilerplate
-
-# Don't use the default MKDEPENDHS stuff... we'll do our own, below
-MKDEPENDHS_SRCS =
-MKDEPENDC_SRCS =
-
-# Make doesn't work this out for itself, it seems
-parser/Parser.y : parser/Parser.y.pp
-EXTRA_SRCS += parser/Parser.y
-
-
-#-----------------------------------------------------------------------------
-# Source files for tags file generation
-#
-# We want to excluded derived sources, because they won't be in the source
-# tree, which is where we are going to move the TAGS file to.a
-
-TAGS_HS_SRCS = parser/Parser.y.pp $(filter-out $(DERIVED_SRCS) main/Config.hs parser/Parser.y, $(sort $(SRCS)))
-
-WRONG_GHCTAGS_HS_SRCS = $(filter-out $(DERIVED_SRCS) main/Config.hs parser/Parser.y, $(sort $(SRCS)))
-# above is wrong because of the following problem:
-# module `main:DataCon' is defined in multiple files: basicTypes/DataCon.lhs
-# basicTypes/DataCon.lhs-boot
-
-GHCTAGS_HS_SRCS = $(HS_SRCS)
-GHCTAGS_HC_OPTS = $(patsubst -i$(odir)/%, -i%, $(HC_OPTS))
-GHCTAGS_HC_OPTS += -DSTAGE='"$(stage)"'
-
-#------------------------------------------------------------
-# Tags
-
-.PHONY: ghctags
-
-ghctags :: $(GHCTAGS_HS_SRCS) $(TAGS_C_SRCS)
- @if [ "$(stage)" != 2 ]; then echo "Must use 'make stage=2 ghctags'"; exit 1; fi
- @$(RM) TAGS
- @touch TAGS
- @echo SOURCES ARE "$(GHCTAGS_HS_SRCS)"
- : ifneq "$(GHCTAGS_HS_SRCS)" ""
- @echo TIME TO ROCK AND ROLL
- # $(GHCTAGS_INPLACE) -- $(MKDEPENDHS_OPTS) $(filter-out -split-objs, $(MKDEPENDHS_HC_OPTS)) -- $(GHCTAGS_HS_SRCS)
- $(GHCTAGS_INPLACE) -- $(GHCTAGS_HC_OPTS) -- $(GHCTAGS_HS_SRCS)
- : endif
-ifneq "$(TAGS_C_SRCS)" ""
- etags -a $(TAGS_C_SRCS)
-endif
- @( DEREFFED=`ls -l Makefile | sed -e 's/.*-> \(.*\)/\1/g'` && $(RM) `dirname $$DEREFFED`/TAGS && $(CP) TAGS `dirname $$DEREFFED` ) 2>/dev/null || echo TAGS file generated, perhaps copy over to source tree?
-
-include $(TOP)/mk/target.mk
-
-ifeq "$(BUILD_GHC_PACKAGE)" "YES"
-all :: $(GHC_PROG)
-endif
-
-$(odir)/main/Config.$(way_)o: SRC_HC_OPTS+=-DSTAGE='"$(stage)"'
-
-ifneq "$(findstring $(stage), 2 3)" ""
-$(warning LIBRARY is $(LIBRARY))
-
-ifneq "$(DOING_BIN_DIST)" "YES"
-$(GHC_PROG) : $(LIBRARY) main/Main.hs
- $(RM) package.conf.inplace
- $(RM) $(STAMP_PKG_CONF)
- $(MAKE) way="" $(STAMP_PKG_CONF)
- $(MAKE) -f Makefile.ghcbin $(MFLAGS) HS_PROG=$(GHC_PROG) $@
-endif
-endif
-
-
-#-----------------------------------------------------------------------------
-# binary-dist
-
-binary-dist:
- $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler
- $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler/stage$(stage)
- echo "stage=$(stage)" > $(BIN_DIST_DIR)/compiler/Makefile
- cat Makefile >> $(BIN_DIST_DIR)/compiler/Makefile
- $(INSTALL_DATA) package.conf.in $(BIN_DIST_DIR)/compiler/
- set -e; for d in stage$(stage)/*/; do $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler/$$d; done
- set -e; for f in $(HS_IFACES); do $(INSTALL_DATA) $$f $(BIN_DIST_DIR)/compiler/$$f; done
-ifneq "$(INSTALL_LIBS)" ""
- set -e; for f in $(INSTALL_LIBS); do $(INSTALL_DATA) $$f $(BIN_DIST_DIR)/compiler/$$f; done
-endif
-ifneq "$(INSTALL_PROGS)" ""
- set -e; for f in $(INSTALL_PROGS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done
-endif
-ifneq "$(INSTALL_LIBEXECS)" ""
- set -e; for f in $(INSTALL_LIBEXECS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done
-endif
-
-# -----------------------------------------------------------------------------
-# Explicit dependencies
-
-# Some .hs files #include other source files, but since ghc -M doesn't spit out
-# these dependencies we have to include them manually.
-
-# We don't add dependencies on HsVersions.h, ghcautoconf.h, or ghc_boot_platform.h,
-# because then modifying one of these files would force recompilation of everything,
-# which is probably not what you want. However, it does mean you have to be
-# careful to recompile stuff you need if you reconfigure or change HsVersions.h.
-
-# Aargh, these don't work properly anyway, because GHC's recompilation checker
-# just reports "compilation NOT required". Do we have to add -no-recomp for each
-# of these .hs files? I haven't done anything about this yet.
-
-$(odir)/codeGen/Bitmap.$(way_)o : ../includes/MachDeps.h
-$(odir)/codeGen/CgCallConv.$(way_)o : ../includes/StgFun.h
-$(odir)/codeGen/CgProf.$(way_)o : ../includes/MachDeps.h
-$(odir)/codeGen/CgProf.$(way_)o : ../includes/Constants.h
-$(odir)/codeGen/CgProf.$(way_)o : ../includes/DerivedConstants.h
-$(odir)/codeGen/CgTicky.$(way_)o : ../includes/DerivedConstants.h
-$(odir)/codeGen/ClosureInfo.$(way_)o : ../includes/MachDeps.h
-$(odir)/codeGen/SMRep.$(way_)o : ../includes/MachDeps.h
-$(odir)/codeGen/SMRep.$(way_)o : ../includes/ClosureTypes.h
-$(odir)/ghci/ByteCodeAsm.$(way_)o : ../includes/Bytecodes.h
-$(odir)/ghci/ByteCodeFFI.$(way_)o : nativeGen/NCG.h
-$(odir)/ghci/ByteCodeInstr.$(way_)o : ../includes/MachDeps.h
-$(odir)/ghci/ByteCodeItbls.$(way_)o : ../includes/ClosureTypes.h
-$(odir)/ghci/ByteCodeItbls.$(way_)o : nativeGen/NCG.h
-$(odir)/main/Constants.$(way_)o : ../includes/MachRegs.h
-$(odir)/main/Constants.$(way_)o : ../includes/Constants.h
-$(odir)/main/Constants.$(way_)o : ../includes/MachDeps.h
-$(odir)/main/Constants.$(way_)o : ../includes/DerivedConstants.h
-$(odir)/main/Constants.$(way_)o : ../includes/GHCConstants.h
-$(odir)/nativeGen/AsmCodeGen.$(way_)o : nativeGen/NCG.h
-$(odir)/nativeGen/MachCodeGen.$(way_)o : nativeGen/NCG.h
-$(odir)/nativeGen/MachCodeGen.$(way_)o : ../includes/MachDeps.h
-$(odir)/nativeGen/MachInstrs.$(way_)o : nativeGen/NCG.h
-$(odir)/nativeGen/MachRegs.$(way_)o : nativeGen/NCG.h
-$(odir)/nativeGen/MachRegs.$(way_)o : ../includes/MachRegs.h
-$(odir)/nativeGen/PositionIndependentCode.$(way_)o : nativeGen/NCG.h
-$(odir)/nativeGen/PprMach.$(way_)o : nativeGen/NCG.h
-$(odir)/nativeGen/RegAllocInfo.$(way_)o : nativeGen/NCG.h
-$(odir)/typecheck/TcForeign.$(way_)o : nativeGen/NCG.h
-$(odir)/utils/Binary.$(way_)o : ../includes/MachDeps.h
-$(odir)/utils/FastMutInt.$(way_)o : ../includes/MachDeps.h
-
-# -----------------------------------------------------------------------------
-# Dependencies
-
-MKDEPENDHS_HC_OPTS = $(patsubst -i$(odir)/%, -i%, $(HC_OPTS))
-
-MKDEPENDHS=$(HC)
-
-# Must do this *after* including target.mk, because $(HS_SRCS) isn't set yet.
-depend :: $(STAGE_PLATFORM_H) $(HS_SRCS) $(C_SRCS)
- touch .depend-BASE
-ifneq "$(BootingFromHc)" "YES"
- $(MKDEPENDHS) -M -optdep-f -optdep.depend-BASE $(foreach way,$(WAYS),-optdep-s -optdep$(way)) $(foreach obj,$(MKDEPENDHS_OBJ_SUFFICES),-osuf $(obj)) $(MKDEPENDHS_OPTS) $(filter-out -split-objs, $(MKDEPENDHS_HC_OPTS)) $(HS_SRCS)
-endif
- $(MKDEPENDC) -f .depend-BASE $(MKDEPENDC_OPTS) $(foreach way,$(WAYS),-s $(way)) -- $(CC_OPTS) -- $(C_SRCS)
- $(PERL) -pe 'binmode(stdin); binmode(stdout); s@(\S*[._]o)@stage$(stage)/$$1@g; s@(\S*[._]hi)@stage$(stage)/$$1@g; s@^.*/compat.*$$@@g;' <.depend-BASE >.depend-$(stage)
-# The binmode stuff tells perl not to add stupid ^M's to the output
-#
-# The /lib/compat replacement is to workaround a bug in the
-# -optdep--exclude-module flag in GHC 6.4. It is not required for any
-# other version of GHC, but doesn't do any harm.
-
-ifeq "$(MakefileDeps)" "YES"
-$(CONFIG_HS) : Makefile
-stage1/$(PLATFORM_H) : Makefile
-stage2/$(PLATFORM_H) : Makefile