[project @ 1998-02-04 18:48:18 by sof]
[ghc-hetmet.git] / distrib / Makefile-bin.in
index c741518..dd96114 100644 (file)
@@ -7,7 +7,7 @@
 # by using the unpacked distribution tree in-situ or by installing the
 # package.
 #
-# Using the package directly is easy, just do `make config'. (The
+# Using the package directly is easy, just do `make in-place'. (The
 # distribution will *not* work straight out of the box, you'll have to do
 # this first)
 #
@@ -22,7 +22,7 @@
 #     Note, if you specify /usr/foo/lib for libdir,
 #     the library files for your fptools package will be
 #     installed in  /usr/foo/lib/<package>-<version>, e.g.,
-#     /usr/foo/lib/ghc-2.02. If you don't want the package/version
+#     /usr/foo/lib/ghc-2.07. If you don't want the package/version
 #     directory appended, you'll have to modify $(real_libdir)
 #     below.
 #
@@ -77,32 +77,28 @@ dvidir    = $(datadir)
 real_libdir      = $(libdir)/$(package)-$(version)
 real_datadir     = $(datadir)/$(package)-$(version)
 
-package     = ghc
-version     = 2.02
 PERL        = @PerlCmd@
+SH         = /bin/sh
 RM          = rm -f
 MV          = mv
+CP          = cp
 LN_S        = @LN_S@
 CHMOD       = chmod
 INSTALL            = @INSTALL@
+RAWCPP      = @RAWCPP@
+SED        = @SedCmd@
 # sigh
 INSTALL_DIR  = ./mkdirhier
 
 #
 # Set of package scripts for which you'd like a name-<version> symlink
-# to be created, i.e., create a symlink, ghc-2.02, pointing to ghc to
+# to be created, i.e., create a symlink, ghc-$(version), pointing to ghc to
 # avoid version vertigo.
 #
-VERSION_SYMLINKS_FOR=ghc
-
-#
-# List of files in bin directory that need to have
-# local setup/install information prepended.
-#
-PACKAGE_SCRIPTS=ghc stat2resid hstags mkdependHS
+VERSION_SYMLINKS_FOR=$(package)
 
 # Binaries to install
-PACKAGE_BINS=$(PACKAGE_SCRIPTS) hp2ps
+PACKAGE_BIN_INSTALL=$(PACKAGE_PRL_SCRIPTS) $(PACKAGE_SH_SCRIPTS) $(PACKAGE_BINS)
 
 #----------end of user-serviceable parts------------
 #
@@ -127,29 +123,58 @@ INSTALL_DATA_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_DATA_OPTS)
 
 config-pkgs ::
        @echo "Configuring $(package), version $(version), on $(platform) ..."
-       $(RM) bin/$(platform)/$(package)-$(version)/$(package)-$(version)
-       @for i in $(PACKAGE_SCRIPTS); do \
+       @for i in $(PACKAGE_PRL_SCRIPTS) ""; do \
+         if test "$$i"; then \
+          echo "Creating a configured version of $$i .."; \
+          $(RM) bin/$(platform)/$(package)-$(version)/$$i.bak; \
+          if [ -f bin/$(platform)/$(package)-$(version)/$$i ]; then $(MV) bin/$(platform)/$(package)-$(version)/$$i bin/$(platform)/$(package)-$(version)/$$i.bak; fi; \
+          echo "#! $(PERL)"                                    > bin/$(platform)/$(package)-$(version)/$$i ; \
+          echo '$$'"bindir='$(bindir)';"                        >> bin/$(platform)/$(package)-$(version)/$$i ; \
+          echo '$$'"libdir='$(real_libdir)';"                   >> bin/$(platform)/$(package)-$(version)/$$i ; \
+          echo '$$'"libexecdir='$(real_libdir)';"               >> bin/$(platform)/$(package)-$(version)/$$i ; \
+          echo '$$'"datadir='$(real_datadir)';"                 >> bin/$(platform)/$(package)-$(version)/$$i ; \
+          echo '$$'"SED='$(SED)';"             >> bin/$(platform)/$(package)-$(version)/$$i ; \
+          echo '$$'"RAWCPP='$(RAWCPP)';"               >> bin/$(platform)/$(package)-$(version)/$$i ; \
+          cat bin/$(platform)/$(package)-$(version)/$$i.prl   >> bin/$(platform)/$(package)-$(version)/$$i ; \
+          $(CHMOD) $(BIN_PERMS) bin/$(platform)/$(package)-$(version)/$$i; \
+          echo "Done."; \
+         fi; \
+       done
+       @for i in $(PACKAGE_LIB_PRL_SCRIPTS) ""; do \
+         if test "$$i"; then \
+          echo "Creating a configured version of $$i .."; \
+          $(RM) lib/$(platform)/$(package)-$(version)/$$i.bak; \
+          if [ -f lib/$(platform)/$(package)-$(version)/$$i ]; then $(MV) lib/$(platform)/$(package)-$(version)/$$i lib/$(platform)/$(package)-$(version)/$$i.bak; fi; \
+          echo "#! $(PERL)"                      > lib/$(platform)/$(package)-$(version)/$$i ; \
+          echo '$$'"bindir='$(bindir)';"          >> lib/$(platform)/$(package)-$(version)/$$i ; \
+          echo '$$'"libdir='$(real_libdir)';"     >> lib/$(platform)/$(package)-$(version)/$$i ; \
+          echo '$$'"libexecdir='$(real_libdir)';" >> lib/$(platform)/$(package)-$(version)/$$i ; \
+          echo '$$'"datadir='$(real_datadir)';"   >> lib/$(platform)/$(package)-$(version)/$$i ; \
+          echo '$$'"SED='$(SED)';"              >> lib/$(platform)/$(package)-$(version)/$$i ; \
+          echo '$$'"RAWCPP='$(RAWCPP)';"                >> lib/$(platform)/$(package)-$(version)/$$i ; \
+          cat lib/$(platform)/$(package)-$(version)/$$i.prl >> lib/$(platform)/$(package)-$(version)/$$i; \
+          $(CHMOD) $(BIN_PERMS) lib/$(platform)/$(package)-$(version)/$$i; \
+          echo "Done."; \
+         fi; \
+       done
+       @for i in $(PACKAGE_SH_SCRIPTS) ""; do \
+         if test "$$i"; then \
           echo "Creating a configured version of $$i .."; \
           $(RM) bin/$(platform)/$(package)-$(version)/$$i.bak; \
-          test -f bin/$(platform)/$(package)-$(version)/$$i && $(MV) bin/$(platform)/$(package)-$(version)/$$i bin/$(platform)/$(package)-$(version)/$$i.bak; \
-          echo "eval 'exec $(PERL) -S $$$""0 $$""{1+\"$$$""@\"}'"         > bin/$(platform)/$(package)-$(version)/$$i; \
-          echo "      if $$""running_under_some_shell;"                  >> bin/$(platform)/$(package)-$(version)/$$i; \
-          echo $$"bindir='$(bindir)';"                                   >> bin/$(platform)/$(package)-$(version)/$$i; \
-          echo $$"libdir='$(real_libdir)';"                              >> bin/$(platform)/$(package)-$(version)/$$i; \
-          echo $$"datadir='$(real_datadir)';"                            >> bin/$(platform)/$(package)-$(version)/$$i; \
-          cat bin/$(platform)/$(package)-$(version)/$(package).prl       >> bin/$(platform)/$(package)-$(version)/$$i; \
+          if [ -f bin/$(platform)/$(package)-$(version)/$$i ]; then $(MV) bin/$(platform)/$(package)-$(version)/$$i bin/$(platform)/$(package)-$(version)/$$i.bak; fi; \
+          echo "#! $(SH)"                      > bin/$(platform)/$(package)-$(version)/$$i ; \
+          echo "bindir='$(bindir)'"          >> bin/$(platform)/$(package)-$(version)/$$i ; \
+          echo "libdir='$(real_libdir)'"     >> bin/$(platform)/$(package)-$(version)/$$i ; \
+          echo "libexecdir='$(real_libdir)'" >> bin/$(platform)/$(package)-$(version)/$$i ; \
+          echo "datadir='$(real_datadir)'"   >> bin/$(platform)/$(package)-$(version)/$$i ; \
+          echo "SED='$(SED)'"                   >> bin/$(platform)/$(package)-$(version)/$$i ; \
+          echo "RAWCPP='$(RAWCPP)'"             >> bin/$(platform)/$(package)-$(version)/$$i ; \
+          cat bin/$(platform)/$(package)-$(version)/$$i.sh >> bin/$(platform)/$(package)-$(version)/$$i; \
           $(CHMOD) $(BIN_PERMS) bin/$(platform)/$(package)-$(version)/$$i; \
           echo "Done."; \
+         fi; \
        done
 
-#
-# The vaguely funky eval 'exec ...' echo line above *might* be
-# a tad too much for some `make's - here's what it should return
-# if all is well:
-#
-#   eval 'exec /installed/path/for/perl -S $0 ${1+"$@"}'
-#         if $running_under_some_shell;
-#
 
 mk-version-symlinks ::
        @for i in $(VERSION_SYMLINKS_FOR) ""; do \
@@ -166,29 +191,33 @@ in-place ::
 
 install-dirs ::
        $(INSTALL_DIR) $(bindir)
-       (cd lib/$(platform)/$(package)-$(version); find . -type d -exec sh -c '$(INSTALL_DIR) $0 $(real_libdir)/$0' {} \; )
-       (cd share/$(package)-$(version); find . -type d -exec sh -c '$(INSTALL_DIR) $0 $(real_datadir)/$0' {} \; )
+       (cd lib/$(platform)/$(package)-$(version); find . -type d -exec sh -c '../../../$(INSTALL_DIR) $$0 $(real_libdir)/$$0' {} \; )
+       (cd share/$(package)-$(version); find . -type d -exec sh -c '../../$(INSTALL_DIR) $(real_datadir)/$$0' {} \; )
 
-install :: config-pkgs mk-version-symlinks install-dirs install-bin install-libs install-data
+install :: config-pkgs mk-version-symlinks install-dirs install-bin install-libs install-datas
 
 .PHONY: install-bin install-libs install-datas
 
 install-bin:
-       for i in $(PACKAGE_BINS); do \
+       for i in $(PACKAGE_BIN_INSTALL); do \
           $(INSTALL_BIN) bin/$(platform)/$(package)-$(version)/$$i $(bindir); \
        done;
-       for in in $(VERSION_SYMLINKS_FOR) ""; do \
-          if [ "x$$i" != "x"]; then \
-               $(INSTALL_BIN) bin/$(platform)/$(package)-$(version)/$$i $(bindir); \
-          fi; \
+       for i in $(VERSION_SYMLINKS_FOR) ""; do \
+          if [ "x$$i" != "x" ]; then           \
+               ( cd $(bindir);                 \
+                 $(RM) $$i-$(version);         \
+                 $(MV) $$i $$i-$(version);     \
+                 $(LN_S) $$i-$(version) $$i    \
+               );                              \
+          fi;                                  \
        done
 
 
 install-libs:
-       (cd lib/$(platform)/$(package)-$(version); find . -type f -exec sh -c '$(INSTALL_LIB) $0 $(real_libdir)/$0' {} \; )
+       (cd lib/$(platform)/$(package)-$(version); find . -type f -exec sh -c '$(CP) $$0 $(real_libdir)/$$0' {} \; )
 
 install-datas:
-       (cd share/$(package)-$(version); find . -type f -exec sh -c '$(INSTALL_DATA) $0 $(real_datadir)/$0' {} \; )
+       (cd share/$(package)-$(version); find . -type f -exec sh -c '$(INSTALL_DATA) $$0 $(real_datadir)/$$0' {} \; )
 
 show-install-setup:
        @echo "Install setup..."