+# 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)
+
+ifeq "$(GhcBuildDylibs)" "YES"
+ifeq "$(darwin_TARGET_OS)" "1"
+GhcLibraryName=libHS$(PACKAGE)$(_way)_dyn.dylib
+else
+GhcLibraryName=libHS$(PACKAGE)$(_way)_dyn.so
+endif
+else
+GhcLibraryName=libHS$(PACKAGE)$(_way).a
+endif
+
+$(GHC_PROG) : $(GhcLibraryName) main/Main.hs
+ $(RM) package.conf.inplace
+ $(RM) $(STAMP_PKG_CONF)
+ $(MAKE) $(STAMP_PKG_CONF)