# -----------------------------------------------------------------------------
-# $Id: package.mk,v 1.28 2003/05/29 13:36:39 simonmar Exp $
+# $Id: package.mk,v 1.30 2003/06/04 12:37:09 reid Exp $
ifneq "$(PACKAGE)" ""
package.conf.inplace : package.conf.in
$(CPP) $(RAWCPP_FLAGS) $(PKGCONF_CPP_EXTRA_OPTS) -x c $(PACKAGE_CPP_OPTS) $< \
| sed 's/^#.*$$//g' >$@
-endif
package.conf.installed : package.conf.in
$(CPP) $(RAWCPP_FLAGS) $(PKGCONF_CPP_EXTRA_OPTS) -DINSTALLING -x c $(PACKAGE_CPP_OPTS) $< \
| sed 's/^#.*$$//g' >$@
+endif
+
# we could be more accurate here and add a dependency on
# ghc/driver/package.conf, but that doesn't work too well because of
# make's limited accuracy with modification times: when doing 'make
else # $(STANDALONE_PACKAGE) == "YES"
+PACKAGE_CPP_OPTS += -DPACKAGE=\"${PACKAGE}\"
+PACKAGE_CPP_OPTS += -DPACKAGE_DEPS='$(patsubst %,"%"$(comma),$(PACKAGE_DEPS))'
+PACKAGE_CPP_OPTS += -DLIBRARY=\"HS$(PACKAGE)\"
+PACKAGE_CPP_OPTS += -DLIBDIR=\"$(libdir)\"
+
# Let the package configuration file refer to $(libdir) as
# ${pkglibdir}. Note we can't use ${libdir} because ghc-pkg already
# redefines it to point to GHC's libdir (bug or feature?).
#
-install :: package.conf.installed
- pkglibdir=$(libdir) $(GHC_PKG) --update-package <package.conf.installed
+install :: package.conf.in
+ $(CPP) $(RAWCPP_FLAGS) $(PKGCONF_CPP_EXTRA_OPTS) -DINSTALLING -x c $(PACKAGE_CPP_OPTS) $< \
+ | sed -e 's/^#.*$$//g' -e 's/""//g' -e 's/, ]/ ]/g' \
+ | $(GHC_PKG) --force --update-package
endif # $(STANDALONE_PACKAGE)