+#
+# 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
+# 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
+PACKAGE_LIB_SCRIPTS=hscpp
+
+# Binaries to install
+PACKAGE_BINS=$(PACKAGE_SCRIPTS) hp2ps
+
+#----------end of user-serviceable parts------------
+#
+#
+# How to install the different pieces
+#
+INSTALL_BIN = $(INSTALL) $(INSTALL_BIN_OPTS)
+INSTALL_LIB = $(INSTALL) $(INSTALL_LIB_OPTS)
+INSTALL_DATA = $(INSTALL) $(INSTALL_DATA_OPTS)
+
+# What's common to all installs
+INSTALL_OPTS= $(EXTRA_INSTALL_OPTS)
+
+BIN_PERMS = 755
+LIB_PERMS = 644
+
+INSTALL_BIN_OPTS = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_BIN_OPTS)
+INSTALL_LIB_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_LIB_OPTS)
+INSTALL_DATA_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_DATA_OPTS)
+
+.PHONY: in-place config-pkgs mk-version-symlinks install-dirs install
+
+config-pkgs ::
+ @echo "Configuring $(package), version $(version), on $(platform) ..."
+ $(RM) bin/$(platform)/$(package)-$(version)/$(package)-$(version)
+ @for i in $(PACKAGE_SCRIPTS); do \
+ 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 $$"libexecdir='$(real_libdir)';" >> bin/$(platform)/$(package)-$(version)/$$i; \
+ echo $$"datadir='$(real_datadir)';" >> 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."; \
+ done
+ @for i in $(PACKAGE_LIB_SCRIPTS); do \
+ echo "Creating a configured version of $$i .."; \
+ $(RM) lib/$(platform)/$(package)-$(version)/$$i.bak; \
+ test -f lib/$(platform)/$(package)-$(version)/$$i && $(MV) lib/$(platform)/$(package)-$(version)/$$i lib/$(platform)/$(package)-$(version)/$$i.bak; \
+ echo "eval 'exec $(PERL) -S $$$""0 $$""{1+\"$$$""@\"}'" > lib/$(platform)/$(package)-$(version)/$$i; \
+ echo " if $$""running_under_some_shell;" >> 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; \
+ cat lib/$(platform)/$(package)-$(version)/$$i.prl >> lib/$(platform)/$(package)-$(version)/$$i; \
+ $(CHMOD) $(BIN_PERMS) lib/$(platform)/$(package)-$(version)/$$i; \
+ echo "Done."; \
+ done