-
-#----------------------------------------
-# Script programs
-
-ifneq "$(SCRIPT_PROG)" ""
-
-# To produce a fully functional script, you may
-# have to add some configuration variables at the top of
-# the script, i.e., the compiler driver needs to know
-# the path to various utils in the build tree for instance.
-#
-# To have the build rule for the script automatically do this
-# for you, set the variable SCRIPT_SUBST_VARS to the list of
-# variables you need to put in.
-
-#
-# SCRIPT_SUBST creates a string of echo commands that
-# will when evaluated append the (perl)variable name and its value
-# to the target it is used for, i.e.,
-#
-# A=foo
-# B=bar
-# SCRIPT_SUBST_VARS = A B
-# SCRIPT_SUBST=echo "$""A=\"foo\";" >> $@; echo "$""B=\"bar\";" >> $@
-#
-# so if you have a rule like the following
-#
-# foo:
-# @(RM) $@
-# @(TOUCH) $@
-# @eval $(SCRIPT_SUBST)
-#
-# `make foo' would create a file `foo' containing the following
-#
-# % cat foo
-# $A=foo;
-# $B=bar;
-# %
-#
-# ToDo: make this work for shell scripts (drop the initial $).
-#
-ifeq "$(INTERP)" "$(SHELL)"
-SCRIPT_SUBST=$(foreach val,$(SCRIPT_SUBST_VARS),"echo \"$(val)=\\\"$($(val))\\\";\" >> $@;")
-else
-SCRIPT_SUBST=$(foreach val,$(SCRIPT_SUBST_VARS),"echo \"$$\"\"$(val)=\\\"$($(val))\\\";\" >> $@;")
-endif
-
-all :: $(SCRIPT_PROG)
-
-#
-# #! support under cygwin32 is not quite there yet,
-# so we rely on the eval `trick' instead. On all other
-# platforms, we prepend #!$(INTERP) -- SOF 6/97
-#
-
-$(SCRIPT_PROG) : $(SCRIPT_OBJS)
- $(RM) $@
- @echo Creating $@...
-ifeq "$(INTERP)" "perl"
- echo "#! "$(PERL) > $@
-else
-ifneq "$(INTERP)" ""
- @echo "#!"$(INTERP) > $@
-else
- @touch $@
-endif
-endif
-ifneq "$(SCRIPT_PREFIX_FILES)" ""
- @cat $(SCRIPT_PREFIX_FILES) >> $@
-endif
- @eval $(SCRIPT_SUBST)
- @cat $(SCRIPT_OBJS) >> $@
- @chmod a+x $@
- @echo Done.
-endif
-
-# links to script programs: we sometimes install a script as
-# <name>-<version> with a link from <name> to the real script.
-
-ifneq "$(SCRIPT_LINK)" ""
-all :: $(SCRIPT_LINK)
-
-#
-# Don't want to overwrite $(SCRIPT_LINK)s that aren't symbolic
-# links. Testing for symbolic links is problematic to do in
-# a portable fashion using a /bin/sh test, so we simply rely
-# on perl.
-#
-$(SCRIPT_LINK) : $(SCRIPT_PROG)
- @if ( $(PERL) -e '$$fn="$(SCRIPT_LINK)"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
- echo "Creating a symbolic link from $(SCRIPT_PROG) to $(SCRIPT_LINK)"; \
- $(RM) $(SCRIPT_LINK); \
- $(LN_S) $(SCRIPT_PROG) $(SCRIPT_LINK); \
- else \
- echo "Creating a symbolic link from $(SCRIPT_PROG) to $(SCRIPT_LINK) failed: \`$(SCRIPT_LINK)' already exists"; \
- echo "Perhaps remove \`$(SCRIPT_LINK)' manually?"; \
- exit 1; \
- fi;
-endif
-
-
-
-###########################################
-#
-# Targets: install install-strip uninstall
-#
-###########################################
-
-# For each of these variables that is defined, you
-# get one install rule
-#
-# INSTALL_PROGS executable programs in $(bindir)
-# INSTALL_SCRIPTS executable scripts in $(bindir)
-# INSTALL_LIBS platform-dependent libraries in $(libdir) (ranlib'ed)
-# INSTALL_LIB_SCRIPTS platform-dependent scripts in $(libdir)
-# INSTALL_LIBEXECS platform-dependent execs in $(libdir)
-# INSTALL_DATAS platform-independent files in $(datadir)
-#
-# If the installation directory variable is undefined, the install rule simply
-# emits a suitable error message.
-#
-# Remember, too, that the installation directory variables ($(bindir) and
-# friends can be overridden from their original settings in mk/config.mk.in
-# || mk/build.mk
-#
-.PHONY: install installdirs install-strip install-dirs uninstall install-docs show-install
-
-show-install :
- @echo "bindir = $(bindir)"
- @echo "libdir = $(libdir)"
- @echo "libexecdir = $(libexecdir) # by default, same as libdir"
- @echo "datadir = $(datadir) # unused for ghc project"
-
-#
-# Sometimes useful to separate out the creation of install directories
-# from the installation itself.
-#
-install-dirs ::
- @$(INSTALL_DIR) $(bindir)
- @$(INSTALL_DIR) $(libdir)
- @$(INSTALL_DIR) $(libexecdir)
- @$(INSTALL_DIR) $(datadir)
-
-# Better do this first...
-# but we won't for the moment, do it on-demand from
-# within the various install targets instead.
-#install:: install-dirs
-
-# Install libraries automatically
-ifneq "$(LIBRARY)" ""
-INSTALL_LIBS += $(LIBRARY)
-ifeq "$(DLLized)" "YES"
-INSTALL_PROGS += $(DLL_NAME)