X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=distrib%2FMakefile-bin.in;h=f5baeddce24b54fead5faece09e91a73279317f0;hp=404f4d126b15d4cdb9b37053131f91b65d6b9411;hb=16ee51f473e1986c8fc5025a03e895addd99169c;hpb=1fb1ab5d53a09607e7f6d2450806760688396387 diff --git a/distrib/Makefile-bin.in b/distrib/Makefile-bin.in index 404f4d1..f5baedd 100644 --- a/distrib/Makefile-bin.in +++ b/distrib/Makefile-bin.in @@ -1,12 +1,15 @@ +# +# @configure_input@ +# # Instructions for configuring an fptools package. # # There are two ways you can get started with an fptools package, either # by using the unpacked distribution tree in-situ or by installing the # package. # -# Using the package directly is easy, just do `make config', i.e., -# the distribution will *not* work out-of-the-box, you'll have to do -# this first. +# 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) # # To install the package, you'll have to set one or more of the # following variables: @@ -18,8 +21,8 @@ # where you want the library archives to go. # Note, if you specify /usr/foo/lib for libdir, # the library files for your fptools package will be -# installed in /usr/foo/lib/-, i.e., -# /usr/foo/lib/ghc-2.02. If you don't want the package/version +# installed in /usr/foo/lib/-, e.g., +# /usr/foo/lib/ghc-3.00. If you don't want the package/version # directory appended, you'll have to modify $(real_libdir) # below. # @@ -27,111 +30,226 @@ # path to where the platform-independent files will go. # As for libdir, the effective path for the platform-indep # stuff is $(datadir)/-. If you want -# complete control, see $(real_libdir) +# complete control, see $(real_datadir) # # * platform -# the platform you're installing for. The configure -# makes an educated guess what it, so you will only -# have to set this if it clashes with your reality. +# the platform you're installing for. The configure script +# makes an educated guess, so you'll only have to set this +# if it clashes with your reality, I guess. # -# * infodir -# where to install the Emacs info files # * 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 via the `install' rule, but -# via the rules: `install-docs', `install-html', `install-dvi' -# and `install-info'. +# 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'). # # For more complete instructions, consult the INSTALL file # that came with the bundle, and/or consult the installation # documentation in one of the document directories. # -bindir = @bindir@ -libdir = @libdir@ -datadir = @datadir@ -platform = @platform@ - -infodir = @infodir@ -htmldir = @htmldir@ -dvidir = @dvidir@ +# Please report any bugs, problems etc. with installing and using this bundle +# Makefile setup to glasgow-haskell-bugs@dcs.gla.ac.uk +# + +# Where the different pieces of the bundle should go: +bindir = @bindir@ +libdir = @libdir@/$(package)-$(version) +datadir = @datadir@/$(package)-$(version) + +platform = @TargetPlatform@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +# default +infodir = $(datadir) +htmldir = $(datadir) +dvidir = $(datadir) + + +PERL = @PerlCmd@ +SH = /bin/sh +RM = rm -f +MV = mv +CP = cp +LN_S = @LN_S@ +CHMOD = chmod +INSTALL = @INSTALL@ +exeext = @exeext@ +SED = @SedCmd@ +DEFAULT_TMPDIR = /tmp + +# sigh +INSTALL_DIR = ./mkdirhier # -# Putting the package stuff in package-specific -# directories: +# Set of package scripts for which you'd like a name- symlink +# to be created, i.e., create a symlink, ghc-$(version), pointing to ghc to +# avoid version vertigo. # -real_libdir = $(libdir)/$(package)-$(version) -real_datadir = $(datadir)/$(package)-$(version) +VERSION_SYMLINKS_FOR=$(package) +# Binaries to install +PACKAGE_BIN_INSTALL=$(PACKAGE_PRL_SCRIPTS) $(PACKAGE_SH_SCRIPTS) +#----------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) ..." + @for i in $(PACKAGE_PRL_SCRIPTS) ""; do \ + if test "$$i"; then \ + echo "Creating a configured version of $$i .."; \ + $(RM) bin/$(platform)/$$i.bak; \ + if [ -f bin/$(platform)/$$i ]; then $(MV) bin/$(platform)/$$i bin/$(platform)/$$i.bak; fi; \ + echo "#! $(PERL)" > bin/$(platform)/$$i ; \ + echo '$$'"bindir='$(bindir)';" >> bin/$(platform)/$$i ; \ + echo '$$'"libdir='$(libdir)';" >> bin/$(platform)/$$i ; \ + echo '$$'"libexecdir='$(libdir)';" >> bin/$(platform)/$$i ; \ + echo '$$'"datadir='$(datadir)';" >> bin/$(platform)/$$i ; \ + echo '$$'"SED='$(SED)';" >> bin/$(platform)/$$i ; \ + echo '$$'"DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)';" >> bin/$(platform)/$$i ; \ + cat bin/$(platform)/$$i.prl >> bin/$(platform)/$$i ; \ + $(CHMOD) $(BIN_PERMS) bin/$(platform)/$$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)/$$i.bak; \ + if [ -f lib/$(platform)/$$i ]; then $(MV) lib/$(platform)/$$i lib/$(platform)/$$i.bak; fi; \ + echo "#! $(PERL)" > lib/$(platform)/$$i ; \ + echo '$$'"bindir='$(bindir)';" >> lib/$(platform)/$$i ; \ + echo '$$'"libdir='$(libdir)';" >> lib/$(platform)/$$i ; \ + echo '$$'"libexecdir='$(libdir)';" >> lib/$(platform)/$$i ; \ + echo '$$'"datadir='$(datadir)';" >> lib/$(platform)/$$i ; \ + echo '$$'"SED='$(SED)';" >> lib/$(platform)/$$i ; \ + echo '$$'"DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)';" >> lib/$(platform)/$$i ; \ + cat lib/$(platform)/$$i.prl >> lib/$(platform)/$$i; \ + $(CHMOD) $(BIN_PERMS) lib/$(platform)/$$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)/$$i.bak; \ + if [ -f bin/$(platform)/$$i ]; then $(MV) bin/$(platform)/$$i bin/$(platform)/$$i.bak; fi; \ + echo "#! $(SH)" > bin/$(platform)/$$i ; \ + echo "bindir='$(bindir)'" >> bin/$(platform)/$$i ; \ + echo "libdir='$(libdir)'" >> bin/$(platform)/$$i ; \ + echo "libexecdir='$(libdir)'" >> bin/$(platform)/$$i ; \ + echo "datadir='$(datadir)'" >> bin/$(platform)/$$i ; \ + echo "SED='$(SED)'" >> bin/$(platform)/$$i ; \ + echo "DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)'" >> bin/$(platform)/$$i ; \ + cat bin/$(platform)/$$i.sh >> bin/$(platform)/$$i; \ + $(CHMOD) $(BIN_PERMS) bin/$(platform)/$$i; \ + echo "Done."; \ + fi; \ + done + +# Convert pwd's UNC reported path into DOS style +# (cygwin32 only.) +CURRENT_DIR = $(shell pwd | sed 's|^//\(.\)|\1:|' ) + +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." + +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 + +.PHONY: install-bin install-libs install-datas + +install-bin: + for i in $(PACKAGE_BIN_INSTALL) ""; do \ + if test -n "$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i $(bindir); fi; \ + done; + for i in $(PACKAGE_BINS) ""; do \ + if test -n "$$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); \ + if ( $(PERL) -e '$$fn="'$$i'"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \ + echo "Creating a symbol link from $$i-$(version) to $$i"; \ + $(RM) $$i; \ + $(LN_S) $$i-$(version) $$i; \ + else \ + echo "Creating a symbol link from $$i-$(version) to $$i failed: \`$$i' already exists"; \ + echo "Perhaps remove \`$$i' manually?"; \ + exit 1; \ + fi;\ + ); \ + fi; \ + done + + +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' {} \; ) + +show-install-setup: + @echo "Install setup..." + @echo "bindir = $(bindir)" + @echo "libdir = $(libdir) (libdir = $(libdir))" + @echo "datadir = $(datadir) (datadir = $(datadir))" +# +# Documentation targets, install-docs for the whole lot, or +# install-{dvi,html,info} +# -package = ghc -version = 2.02 -PERL = @PerlCmd@ - -.PHONY: config install install-dirs - -config: - @echo Configuring $(package), version $(version), on $(platform) - @RM `pwd`/bin/$(platform)/$(package)-$(version)/$(package)-$(version) - @RM `pwd`/bin/$(platform)/$(package)-$(version)/$(package) - @echo $(PerlCmd) > `pwd`/bin/$(platform)/$(package) - @echo "$""bindir='"`pwd`"/bin/$(platform)/$(package)-$(version)';" >> `pwd`/bin/$(platform)/$(package)-$(version)/$(package) - @echo "$""libdir='"`pwd`"/lib/$(platform)/$(package)-$(version)';" >> `pwd`/bin/$(platform)/$(package)-$(version)/$(package) - @echo "$""datadir='"`pwd`"/share/$(platform)/$(package)-$(version)';" >> `pwd`/bin/$(platform)/$(package)-$(version)/$(package) - @cat `pwd`/bin/$(platform)/$(package)-$(version)/$(package).prl';" >> `pwd`/bin/$(platform)/$(package)-$(version)/$(package) - @(cd `pwd`/bin/$(platform)/$(package)-$(version); $(LN_S) $(package) $(package)-$(version) ) - @echo Finished..to use, add `pwd`/bin/$(platform)/$(package)-$(version) to your PATH. - -libdirs = . imports include -datadirs = . include +.PHONY: show-install-setup install-docs install-html install-info install-dirs-dvi install-dirs-html install-dirs-info -install-dirs: - $(MKDIRHIER) $(bindir) - @for i in $(libdirs) ; do \ - echo (MKDIRHIER) $(real_libdir)/$$i; \ - (MKDIRHIER) $(real_libdir)/$$i; \ - done; - @for i in $(datadirs) ; do \ - echo (MKDIRHIER) $(real_datadir)/$$i; \ - (MKDIRHIER) $(real_datadir)/$$i; \ - done; +install-docs : install-html install-dvi install-info -install : install-dirs +install-dvi: install-dirs-dvi + $(INSTALL_DATA) dvi/* $(dvidir) -install : - $(INSTALL_PROGRAM) `pwd`/bin/$(platform)/$(package)-$(version)/* $(bindir) - @for i in $(libdirs); do \ - echo $(INSTALL) `pwd`/lib/$(platform)/$(package)-$(version)/$$i/* $(real_libdir)/$$i; \ - $(INSTALL) `pwd`/lib/$(platform)/$(package)-$(version)/$$i/* $(real_libdir)/$$i; \ - done; - @for i in $(datadirs); do \ - echo $(INSTALL) `pwd`/share/$(package)-$(version)/$$i/* $(real_datadir)/$$i; \ - $(INSTALL) `pwd`/share/$(package)-$(version)/$$i/* $(real_datadir)/$$i; \ - done; +install-info: install-dirs-info + $(INSTALL_DATA) info/* $(infodir) -install-docs : install-info install-html install-dvi +install-html: install-dirs-html + $(CP) -r html/* $(htmldir) + $(CHMOD) -R $(LIB_PERMS) $(htmldir) +# $(INSTALL_DATA) html/* $(htmldir) install-dirs-html: - $(MKDIRHIER) $(htmldir) + $(INSTALL_DIR) $(htmldir) install-dirs-info: - $(MKDIRHIER) $(infodir) + $(INSTALL_DIR) $(infodir) install-dirs-dvi: - $(MKDIRHIER) $(dvidir) - -install-docs : install-html install-info install-dvi - -install-dvi: install-dirs-dvi - $(INSTALL) `pwd`/dvi/$(package)-$(version)/* $(dvidir) - -install-info: install-dirs-info - $(INSTALL) `pwd`/info/$(package)-$(version)/* $(infodir) - -install-html: install-dirs-html - $(INSTALL) `pwd`/html/$(package)-$(version)/* $(htmldir) + $(INSTALL_DIR) $(dvidir)