-package.conf.installed : package.conf.in
- $(CPP) $(RAWCPP_FLAGS) -P $(PKGCONF_CPP_EXTRA_OPTS) -DINSTALLING -x c $(PACKAGE_CPP_OPTS) $< | \
- sed -e 's/""//g' -e 's/\[ *,/[ /g' >$@
+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