+ $(RM) $*/GNUmakefile $*/Makefile.local
+endif
+
+# -----------------------------------------------------------------------------
+
+.PHONY: install install-docs install.library.%
+
+install: $(foreach SUBDIR,$(SUBDIRS),install.library.$(SUBDIR))
+ifeq "$(HADDOCK_DOCS)" "YES"
+ $(INSTALL_DIR) $(DOC_ROOT)
+ $(INSTALL_DATA) index.html doc-index.html $(DOC_ROOT)
+ $(INSTALL_SCRIPT) gen_contents_index $(DOC_ROOT)
+ # Hacks:
+ $(INSTALL_DATA) $(DOC_ROOT)/base/*.css $(DOC_ROOT)
+ $(INSTALL_DATA) $(DOC_ROOT)/base/*.js $(DOC_ROOT)
+ $(INSTALL_DATA) $(DOC_ROOT)/base/*.gif $(DOC_ROOT)
+endif
+
+# Cabal doesn't let us ask to install docs only, so do nothing here
+install-docs:
+ @:
+
+# Ideally this would depend on a stamp/build.library.%, but if it does
+# then we can't change the libraries and then just rerun make.
+# Thus if you install without building then it will just break.
+$(foreach SUBDIR,$(SUBDIRS),install.library.$(SUBDIR)): \
+install.library.%: installPackage/installPackage ifBuildable/ifBuildable
+ ifBuildable/ifBuildable $* ../installPackage/installPackage $(prefix) $(bindir)/ghc-pkg
+
+.PHONY: binary-dist binary-dist.library.%
+
+BIN_DIST_LIBDIR=$(BIN_DIST_DIR)/libraries
+
+binary-dist: $(foreach SUBDIR,$(SUBDIRS),binary-dist.library.$(SUBDIR))
+ mkdir $(BIN_DIST_LIBDIR)/installPackage
+ cp installPackage/installPackage $(BIN_DIST_LIBDIR)/installPackage
+ mkdir $(BIN_DIST_LIBDIR)/ifBuildable
+ cp ifBuildable/ifBuildable $(BIN_DIST_LIBDIR)/ifBuildable
+ cp Makefile $(BIN_DIST_LIBDIR)
+ cp gen_contents_index $(BIN_DIST_LIBDIR)
+ cp index.html $(BIN_DIST_LIBDIR)
+ cp doc-index.html $(BIN_DIST_LIBDIR)
+ cp -a stamp $(BIN_DIST_LIBDIR)
+
+$(foreach SUBDIR,$(SUBDIRS),binary-dist.library.$(SUBDIR)): \
+binary-dist.library.%:
+ $(MKDIRHIER) $(BIN_DIST_LIBDIR)/$*
+ ifBuildable/ifBuildable $* cp $*.cabal $(BIN_DIST_LIBDIR)/$*
+ ifBuildable/ifBuildable $* cp -a dist $(BIN_DIST_LIBDIR)/$*
+ # Euch
+ ifBuildable/ifBuildable $* cp -aL include $(BIN_DIST_LIBDIR)/$* || :
+ ifBuildable/ifBuildable $* $(FIND) $(BIN_DIST_LIBDIR)/$*/dist \
+ \( -name "*_split" -o -name "autogen" \) | xargs rm -rf
+ ifBuildable/ifBuildable $* $(FIND) $(BIN_DIST_LIBDIR)/$*/dist \
+ \( \( -name "*.o" -o -name "*.p_o" \) -a ! -name "HS*" \) \
+ -exec rm {} \;