+compiler_stage2_TAGS_HC_OPTS = -package ghc
+$(eval $(call tags-package,compiler,stage2))
+
+$(compiler_stage1_depfile_haskell) : compiler/stage1/$(PLATFORM_H)
+$(compiler_stage2_depfile_haskell) : compiler/stage2/$(PLATFORM_H)
+$(compiler_stage3_depfile_haskell) : compiler/stage3/$(PLATFORM_H)
+
+$(compiler_stage1_depfile_haskell) : $(includes_H_CONFIG) $(includes_H_PLATFORM) $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS) $(PRIMOP_BITS)
+$(compiler_stage2_depfile_haskell) : $(includes_H_CONFIG) $(includes_H_PLATFORM) $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS) $(PRIMOP_BITS)
+$(compiler_stage3_depfile_haskell) : $(includes_H_CONFIG) $(includes_H_PLATFORM) $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS) $(PRIMOP_BITS)
+
+# Every Constants.o object file depends on includes/GHCConstants.h:
+$(eval $(call compiler-hs-dependency,Constants,$(includes_GHCCONSTANTS) includes/HaskellConstants.hs))
+
+# Every PrimOp.o object file depends on $(PRIMOP_BITS):
+$(eval $(call compiler-hs-dependency,PrimOp,$(PRIMOP_BITS)))
+
+# GHC itself doesn't know about the above dependencies, so we have to
+# switch off the recompilation checker for those modules:
+compiler/prelude/PrimOps_HC_OPTS += -fforce-recomp
+compiler/main/Constants_HC_OPTS += -fforce-recomp
+
+# Note [munge-stage1-package-config]
+# Strip the date/patchlevel from the version of stage1. See Note
+# [fiddle-stage1-version] above.
+ifeq "$(compiler_stage1_VERSION_MUNGED)" "YES"
+compiler/stage1/inplace-pkg-config-munged: compiler/stage1/inplace-pkg-config
+ sed -e 's/^\(version: .*\)\.$(ProjectPatchLevel)$$/\1/' \
+ -e 's/^\(id: .*\)\.$(ProjectPatchLevel)$$/\1/' \
+ -e 's/^\(hs-libraries: HSghc-.*\)\.$(ProjectPatchLevel)$$/\1/' \
+ < $< > $@
+ "$(compiler_stage1_GHC_PKG)" update --force $(compiler_stage1_GHC_PKG_OPTS) $@
+
+$(compiler_stage1_v_LIB) : compiler/stage1/inplace-pkg-config-munged
+endif