+PACKAGE_CPP_OPTS += -I$(GHC_INCLUDE_DIR) -Iinclude
+
+PACKAGE_CPP_OPTS += -DPACKAGE=${PACKAGE}
+PACKAGE_CPP_OPTS += -DVERSION=${VERSION}
+
+PACKAGE_CPP_OPTS += -DPKG_LIBDIR='"$(PKG_LIBDIR)"'
+PACKAGE_CPP_OPTS += -DPKG_DATADIR='"$(PKG_DATADIR)"'
+
+package.conf.inplace : package.conf.in
+ $(CPP) $(RAWCPP_FLAGS) -P \
+ -DIMPORT_DIR='"$(IMPORT_DIR_INPLACE)"' \
+ -DLIB_DIR='"$(LIB_DIR_INPLACE)"' \
+ -DINCLUDE_DIR='"$(INCLUDE_DIR_INPLACE)"' \
+ -DDATA_DIR='"$(DATA_DIR_INPLACE)"' \
+ -DHTML_DIR='"$(HTML_DIR_INPLACE)"' \
+ -DHADDOCK_IFACE='"$(HADDOCK_IFACE_INPLACE)"' \
+ -DFPTOOLS_TOP_ABS='"${FPTOOLS_TOP_ABS}"' \
+ -x c $(PACKAGE_CPP_OPTS) $< | \
+ grep -v '^#pragma GCC' | \
+ sed -e 's/""//g' -e 's/:[ ]*,/: /g' >$@
+
+install::
+ $(CPP) $(RAWCPP_FLAGS) -P -DINSTALLING \
+ -DIMPORT_DIR='"$(IMPORT_DIR_INSTALLED)"' \
+ -DLIB_DIR='"$(LIB_DIR_INSTALLED)"' \
+ -DINCLUDE_DIR='"$(INCLUDE_DIR_INSTALLED)"' \
+ -DDATA_DIR='"$(DATA_DIR_INSTALLED)"' \
+ -DHTML_DIR='"$(HTML_DIR_INSTALLED)"' \
+ -DHADDOCK_IFACE='"$(HADDOCK_IFACE_INSTALLED)"' \
+ -I../includes \
+ -x c $(PACKAGE_CPP_OPTS) package.conf.in \
+ | grep -v '^#pragma GCC' \
+ | sed -e 's/""//g' -e 's/:[ ]*,/: /g' \
+ | $(GHC_PKG_PROG) --global-conf $(DESTDIR)$(libdir)/package.conf update - --force
+
+# we could be more accurate here and add a dependency on
+# driver/package.conf, but that doesn't work too well because of
+# make's limited accuracy with modification times: when doing 'make
+# boot' in multiple packages, make won't detect that the package
+# configuration needs updating if it was updated already in the last
+# second.
+#
+# The stamp file goes in $(GHC_DRIVER_DIR), so that if someone happens
+# to 'make clean' in ghc without cleaning in libraries too, the packages
+# will be correctly re-installed.
+#