additions from Reilly Hayes
[ghc-hetmet.git] / distrib / Makefile-bin.in
index 0fd7727..6df1e05 100644 (file)
 #     if it clashes with your reality, I guess.
 #
 #  * htmldir
-#     where to install the documentation HTML files.
-#  * dvidir
-#     where to install the DVI files.
-#  * infodir
-#     where to install the Emacs info files
-#
-# Installing the documentation is not done as part of the `install' rule, but
-# via `install-docs' (or if you want to be selective: `install-html', `install-dvi'
-# and `install-info').
+#     where to install the HTML documentation files.
+#  * pdfdir
+#     where to install the PDF documentation files.
+#  * psdir
+#     where to install the Postscript documentation files.
 #
 # For more complete instructions, consult the INSTALL file
 # that came with the bundle, and/or consult the installation
@@ -66,9 +62,9 @@ prefix      = @prefix@
 exec_prefix = @exec_prefix@
 
 # default
-infodir   = $(datadir)
-htmldir   = $(datadir)
-dvidir    = $(datadir)
+htmldir     = $(datadir)/html
+psdir       = $(datadir)
+pdfdir      = $(datadir)
 
 
 PERL        = @PerlCmd@
@@ -170,29 +166,59 @@ config-pkgs ::
           echo "Done."; \
          fi; \
        done
-
-# Convert pwd's UNC reported path into DOS style
-# (cygwin32 only.)
-CURRENT_DIR = $(shell pwd | sed 's|^//\(.\)|\1:|' )
+       @for i in $(PACKAGE_LIB_SPLICED_FILES) ""; do \
+         if test "$$i"; then \
+           echo "Creating a configured version of $$i .."; \
+            $(PERL) -i.bak -lpe 's|\$$libdir|$(libdir)|g;s|\$$datadir|$(datadir)|g' lib/$(platform)/$$i; \
+          fi; \
+       done
+       @if test "$(platform)" = "powerpc-apple-darwin"; then \
+         echo "Configuring install names..."; \
+         for i in lib/$(platform)/*; do \
+           sh fix_install_names.sh "$(libdir)" "$$i"; \
+         done; \
+         echo "Done."; \
+       fi
 
 in-place ::
-       $(MAKE) $(MFLAGS) config-pkgs bindir=$(CURRENT_DIR)/bin/$(platform) libdir=$(CURRENT_DIR)/lib/$(platform) datadir=$(CURRENT_DIR)/share
-       @echo "Finished configuring..to use, add $(CURRENT_DIR)/bin/$(platform) to your PATH."
+       $(MAKE) $(MFLAGS) config-pkgs bindir=`pwd`/bin/$(platform) libdir=`pwd`/lib/$(platform) datadir=`pwd`/share
+       @if test -x "./post-inplace-script" ; then \
+               echo "Running project-specific post-inplace script ..." ; \
+               ./post-inplace-script $(platform) `pwd` \
+                       $(package)-$(version); \
+               echo "Done" ; \
+       fi
+       @echo "Finished configuring..to use, add `pwd`/bin/$(platform) to your PATH."
 
 install-dirs ::
        $(INSTALL_DIR) $(bindir)
        (cd lib/$(platform); find . -type d -exec sh -c '../../$(INSTALL_DIR) $$0 $(libdir)/$$0' {} \; )
        (cd share; find . -type d -exec sh -c '../$(INSTALL_DIR) $(datadir)/$$0' {} \; )
 
-install :: config-pkgs install-dirs install-bin install-libs install-datas postinstall
-
-.PHONY: install-bin install-libs install-datas postinstall
+install :: config-pkgs install-dirs install-bin install-libs install-datas install-docs postinstall denounce
+
+.PHONY: install-bin install-libs install-datas postinstall denounce
+
+denounce:
+       @echo
+       @echo =======================================================================
+       @echo Installation of $(package)-$(version) was successful.
+       @echo
+       @echo To use, add $(bindir) to your PATH.
+       @echo
+       @if test -f share/html/index.html; then \
+          echo For documentation, see $(htmldir)/index.html ; \
+       elif test -d share/html ; then \
+          echo Docs can be found in $(htmldir). ; \
+       else \
+          echo "Warning: this binary distribution does NOT contain documentation!" ; \
+       fi
+       @echo =======================================================================
 
 postinstall:
-       if test -x "./post-install-script" ; then \
+       @if test -x "./post-install-script" ; then \
                echo "Running project-specific post-install script ..." ; \
-               ./post-install-script $(platform) $(prefix) \
-                       $(package)-$(version); \
+               ./post-install-script $(platform) $(libdir) ; \
                echo "Done" ; \
        fi
 
@@ -203,6 +229,9 @@ install-bin:
        for i in $(PACKAGE_BINS) ""; do \
           if test -n "$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i$(exeext) $(bindir); fi; \
        done;
+       for i in $(PACKAGE_OPT_BINS) ""; do \
+          if test -n "$$i" -a ! -f "$(bindir)/$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i$(exeext) $(bindir); fi; \
+       done;
        @for i in $(VERSION_SYMLINKS_FOR) ""; do \
           if [ "x$$i" != "x" ]; then           \
                ( cd $(bindir);                 \
@@ -224,7 +253,9 @@ install-libs:
        (cd lib/$(platform); find . -type f -exec sh -c '$(CP) $$0 $(libdir)/$$0' {} \; )
 
 install-datas:
-       (cd share; find . -type f -exec sh -c '$(INSTALL_DATA) $$0 $(datadir)/$$0' {} \; )
+       for i in `(cd share; find . -type f )`; do \
+          $(INSTALL_DATA) share/$$i $(datadir)/$$i; \
+       done
 
 show-install-setup:
        @echo "Install setup..."
@@ -233,31 +264,19 @@ show-install-setup:
        @echo "datadir = $(datadir) (datadir = $(datadir))"
 
 #
-# Documentation targets, install-docs for the whole lot, or
-# install-{dvi,html,info}
+# Documentation targets: install-docs.
 #
 
-.PHONY: show-install-setup install-docs install-html install-info install-dirs-dvi install-dirs-html install-dirs-info
-
-install-docs : install-html install-dvi install-info
-
-install-dvi: install-dirs-dvi
-       $(INSTALL_DATA) dvi/* $(dvidir)
+.PHONY: show-install-setup install-docs install-dirs-docs
 
-install-info: install-dirs-info
-       $(INSTALL_DATA) info/* $(infodir)
-
-install-html: install-dirs-html
-       $(CP) -r html/* $(htmldir)
-       $(CHMOD) -R $(LIB_PERMS) $(htmldir)
-#      $(INSTALL_DATA) html/* $(htmldir)
+install-docs : install-dirs-docs
+       if test -d share/html ; then $(CP) -r share/html/* $(htmldir) ; fi
+       for i in share/*.ps; do \
+               if test -f "$$i"; then \
+                     $(CP) $$i $(psdir) ; \
+               fi \
+       done
 
-install-dirs-html:
+install-dirs-docs:
        $(INSTALL_DIR) $(htmldir) 
 
-install-dirs-info:
-       $(INSTALL_DIR) $(infodir) 
-
-install-dirs-dvi:
-       $(INSTALL_DIR) $(dvidir) 
-