-#----------------------------------------
-# 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)
-
-$(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
-ifneq "$(SCRIPT_SUBST)" ""
- @eval $(SCRIPT_SUBST)
-endif
- @cat $(SCRIPT_OBJS) >> $@
- @chmod a+x $@
- @echo Done.
-endif
-