[comp.sources.misc] v15i069: dmake version 3.6

dvadura@watdragon.waterloo.edu (Dennis Vadura) (10/15/90)

Posting-number: Volume 15, Issue 69
Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu>
Archive-name: dmake-3.6/part17

#!/bin/sh
# this is part 17 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file man/dmake.nc continued
#
CurArch=17
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file man/dmake.nc"
sed 's/^X//' << 'SHAR_EOF' >> man/dmake.nc
X     it is redundant as a shell is already being used to run the
X     recipe.  See the MAKING TARGETS section for a description of
X     how dmake invokes recipes.  Here is an example of a group
X     recipe:
X
X          target :
X          [
X               first recipe line
X               second recipe line
X               all of these recipe lines are fed to a
X               single copy of a shell for execution.
X          ]
X
X
X
X
XVersion 3.50                    UW                             18
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
XTEXT DIVERSIONS
X     dmake supports the notion of text diversions.  If a recipe
X     line contains the macro expression
X
X          $(mktmp[,name_modifier] data)
X
X     then all text contained in the data expression is expanded
X     and is written to a new temporary file.  The name of that
X     file is then returned as the value of the macro expansion
X     and is substituted for the text of the macro expression if
X     no name_modifier is present.
X
X     data can be any text and must be separated from the 'mktmp'
X     portion of the macro name by white-space.  The only restric-
X     tion on the data text is that it must contain an balanced
X     number of parentheses of the same kind as are used to ini-
X     tiate the $(mktmp ...) expression.  For example:
X
X          $(mktmp $(XXX))
X
X     is legal and works as expected, but:
X
X          $(mktmp text (to dump to file)
X
X     is not legal.  You can achieve what you wish by either
X     defining a macro that expands to '(' or by using {} in the
X     macro expression; like this:
X
X          ${mktmp text (to dump to file}
X
X     which works as expected.  Since the temporary file is opened
X     when the macro containg the text diversion expression is
X     expanded, diversions may now be nested and any diversions
X     that are created as part of ':=' macro expansions persist
X     for the duration of the dmake run.  The diversion text may
X     contain the same escape codes as those described in the MAC-
X     ROS section.  Thus if the data text is to contain new lines
X     they must be inserted using the \n escape sequence.  For
X     example the expression:
X
X          all:
X               cat $(mktmp this is a\n\
X               test of the text diversion\n)
X
X     is replaced by:
X
X          cat /tmp/mk12294AA
X
X     where the temporary file contains two lines both of which
X     are terminated by a new-line.  If the data text spans multi-
X     ple lines in the makefile then each line must be continued
X     via the use of a \.  A second more illustrative example
X
X
X
XVersion 3.50                    UW                             19
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
X     generates a response file to an MSDOS link command:
X
X          OBJ = fred.obj mary.obj joe.obj
X          all : $(OBJ)
X               link @$(mktmp $(^:t"+\n")\n)
X
X     The result of making `all' in the second example is the com-
X     mand:
X
X          link @/tmp/mk02394AA
X
X     where the temporary file contains:
X
X          fred.obj+
X          mary.obj+
X          joe.obj
X
X     The last line of the file is terminated by a new-line which
X     is inserted due to the \n found at the end of the data
X     string.
X
X     If the optional name_modifier is supplied in the diversion
X     expression then the returned value of the expression is the
X     expanded value of name_modifier.  Together with the special
X     macros TMPFILE and USESHELL this can be used to alter the
X     name of the temporary file returned as the result of the
X     $(mktmp ...) expansion.
X
X     Under MS-DOS text diversions may be a problem.  Many DOS
X     tools require that path names which contain directories use
X     the \ character to delimit the directories.  Some users how-
X     ever wish to use the '/' to delimit pathnames on their sys-
X     tem and use environments that allow them to do so.  These
X     environments usually accept the \ delimited path names as
X     well.  In order to allow the user the most flexibility dmake
X     defines three macros that can be used when text diversion
X     file names are being placed into the recipe text to be exe-
X     cuted.  The macro TMPFILE contains the name of the most
X     recently opened temporary file, and the macro, USESHELL, is
X     set to "yes" if the current recipe is forced to use a shell
X     via the .USESHELL or '+' directives, otherwise its value is
X     "no".  In the absence of a name_modifier in the diversion
X     expression the result of expanding the diversion expression
X     is the value of TMPFILE.  The dmake startup files define the
X     macro DIVFILE whose value is either the value of TMPFILE or
X     the value of TMPFILE editted to replace any '/' characters
X     to the appropriate value based on the current shell and
X     whether it will be used to execute the recipe.
X
X     Previous versions of dmake defined text diversions using <+,
X     +> strings, where <+ started a text diversion and +> ter-
X     minated one.  dmake is backward compatible with this
X
X
X
XVersion 3.50                    UW                             20
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
X     construct if the <+ and +> appear literally on the same
X     recipe line or in the same macro value string.  In such
X     instances the expression:
X
X          <+data text+>
X
X     is mapped to:
X
X          $(mktmp data text)
X
X     which is fully output compatible with the earlier construct.
X     <+, +> constructs whose text spans multiple lines must be
X     converted by hand to use $(mktmp ...).
X
X     If the environment variable TMPDIR is defined then the tem-
X     porary file is placed into the directory specified by that
X     variable.  A makefile can modify the location of temporary
X     files by defining a macro named TMPDIR and exporting it
X     using the .EXPORT special target.
X
XSPECIAL TARGETS
X     This section describes the special targets that are recog-
X     nized by dmake.  Some are affected by attributes and others
X     are not.
X
X     .ERROR        If defined then the recipe associated with
X                   this target is executed whenever an error con-
X                   dition is detected by dmake.  All attributes
X                   that can be used with any other target may be
X                   used with this target.  Any prerequisites of
X                   this target will be brought up to date during
X                   it's processing.  NOTE:  errors will be
X                   ignored while making this target, in extreme
X                   cases this may cause some problems.
X
X     .EXPORT       All prerequisites associated with this target
X                   are assumed to correspond to macro names and
X                   they and their values are exported to the
X                   environment as environment strings at the
X                   point in the makefile at which this target
X                   appears.  Any attributes specified with this
X                   target are ignored.  Only macros which have
X                   been assigned a value in the makefile prior to
X                   the export directive are exported, macros as
X                   yet undefined are not exported.
X
X     .IMPORT       Prerequisite names specified for this target
X                   are searched for in the environment and
X                   defined as macros with their value taken from
X                   the environment.  If the name cannot be found
X                   in the environment an error message is issued.
X                   .IMPORT accepts the .IGNORE attribute.  When
X
X
X
XVersion 3.50                    UW                             21
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
X                   given, it causes dmake to ignore the above
X                   error.  See the MACROS section for a descrip-
X                   tion of the processing of imported macro
X                   values.
X
X     .INCLUDE      Parse another makefile just as if it had been
X                   located at the point of the .INCLUDE in the
X                   current makefile.  The list of prerequisites
X                   gives the list of makefiles to try to read.
X                   If the list contains multiple makefiles then
X                   they are read in order from left to right.
X                   The following search rules are used when try-
X                   ing to locate the file.  If the filename is
X                   surrounded by " or just by itself then it is
X                   searched for in the current directory.  If it
X                   is not found it is then searched for in each
X                   of the directories specified for the .INCLU-
X                   DEDIRS special target.  If the file name is
X                   surrounded by < and >, (ie.
X                   <my_spiffy_new_makefile>) then it is searched
X                   for only in the directories given by the
X                   .INCLUDEDIRS special target.  In both cases if
X                   the file name is a fully qualified name start-
X                   ing at the root of the file system then it is
X                   only searched for once, and the .INCLUDEDIRS
X                   list is ignored.  .INCLUDE accepts the .IGNORE
X                   and .SETDIR attributes.  If .IGNORE attribute
X                   is given and the file cannot be found then
X                   dmake continues processing, otherwise an error
X                   message is generated.  The .SETDIR attribute
X                   causes dmake to change directories to the
X                   specified directory prior to attempting the
X                   include operation.
X
X     .INCLUDEDIRS  The list of prerequisites specified for this
X                   target defines the set of directories to
X                   search when trying to include a makefile.
X
X     .MAKEFILES    The list of prerequisites is the set of files
X                   to try to read as the default makefile.  By
X                   default this target is defined as:
X
X                        .MAKEFILES : makefile.mk Makefile
X                   makefile
X
X
X     .SOURCE       The prerequisite list of this target defines a
X                   set of directories to check when trying to
X                   locate a target file name.  See the section on
X                   BINDING of targets for more information.
X
X
X
X
X
XVersion 3.50                    UW                             22
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
X     .SOURCE.suff  The same as .SOURCE, except that the
X                   .SOURCE.suff list is searched first when try-
X                   ing to locate a file matching the a target
X                   whose name ends in the suffix .suff.
X
X     .REMOVE       The recipe of this target is used whenever
X                   dmake needs to remove intermediate targets
X                   that were made but do not need to be kept
X                   around.  Such targets result from the applica-
X                   tion of transitive closure on the dependency
X                   graph.
X
X     In addition to the special targets above, several other
X     forms of targets are recognized and are considered special,
X     their exact form and use is defined in the sections that
X     follow.
X
XSPECIAL MACROS
X     dmake defines a number of special macros.  They are divided
X     into three classes: control macros, run-time macros, and
X     function macros.  The control macros are used by dmake to
X     configure it's actions, and are the preferred method of
X     doing so.  In the case when a control macro has the same
X     function as a special target or attribute they share the
X     same name as the special target or attribute.  The run-time
X     macros are defined when dmake makes targets and may be used
X     by the user inside recipes.  The function macros provide
X     higher level functions dealing with macro expansion and
X     diversion file processing.
X
XCONTROL MACROS
X     To use the control macros simply assign them a value just
X     like any other macro.  The control macros are divided into
X     three groups: string valued macros, character valued macros,
X     and boolean valued macros.
X
X     The following are all of the string valued macros.  This
X     list is divided into two groups.  The first group gives the
X     string valued macros that are defined internally and cannot
X     be directly set by the user.
X
X     DIRBRKSTR     Contains the string of chars used to terminate
X                   the name of a directory in a pathname.  Under
X                   UNIX it's value is "/", under MSDOS it's value
X                   is "/\:".
X
X     INCDEPTH      This macro's value is a string of digits
X                   representing the current depth of makefile
X                   inclusion.  In the first makefile level this
X                   value is zero.
X
X
X
X
X
XVersion 3.50                    UW                             23
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
X     MFLAGS        Is the list of flags that were given on the
X                   command line including a leading switch char-
X                   acter.  The -f flag is not included in this
X                   list.
X
X     MAKECMD       Is the name with which dmake was invoked.
X
X     MAKEDIR       Is the full path to the initial directory in
X                   which dmake was invoked.
X
X     MAKEFILE      Contains the string "-f makefile" where,
X                   makefile is the name of initial user makefile
X                   that was first read.
X
X     MAKEFLAGS     Is the same as $(MFLAGS) but has no leading
X                   switch character. (ie. MFLAGS = -$(MAKEFLAGS))
X
X     MAKEMACROS    Contains the complete list of macro expres-
X                   sions that were specified on the command line.
X
X     MAKETARGETS   Contains the name(s) of the target(s), if any,
X                   that were specified on the command line.
X
X     MAXPROCESSLIMIT
X                   Is a numeric string representing the maximum
X                   number of processes that dmake can use when
X                   making targets using parallel mode.
X
X     NULL          Is permanently defined to be the NULL string.
X                   This is useful when comparing a conditional
X                   expression to an NULL value.
X
X     PWD           Is the full path to the current directory in
X                   which make is executing.
X
X     TMPFILE       Is set to the name of the most recent tem-
X                   porary file opened by dmake.  Temporary files
X                   are used for text diversions and for group
X                   recipe processing.
X
X     TMD           Stands for "To Make Dir", and is the path from
X                   the present directory (value of $(PWD)) to the
X                   directory that dmake was started up in (value
X                   of $(MAKEDIR)).  This macro is modified when
X                   .SETDIR attributes are processed.
X
X     USESHELL      The value of this macro is set to "yes" if the
X                   current recipe is forced to use a shell for
X                   its execution via the .USESHELL or '+' direc-
X                   tives, its value is "no" otherwise.
X
X
X
X
X
XVersion 3.50                    UW                             24
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
X     The second group of string valued macros control dmake
X     behavior and may be set by the user.
X
X     .SETDIR         If this macro is assigned a value then dmake
X                     will change to the directory given by that
X                     value before making any targets.  This macro
X                     is equivalent to the .SETDIR attribute.
X                     Thus the two lines:
X
X                     .SETDIR=fred/hello :
X
X                     .SETDIR := fred/hello
X
X                     are completely equivalent.  The difference
X                     being that the first is processed as a rule
X                     definition and the other as a macro.
X
X     AUGMAKE         If set to a non NULL value will enable the
X                     transformation of special meta targets to
X                     support special AUGMAKE inferences.
X
X     DIRSEPSTR       Contains the string that is used to separate
X                     directory components when path names are
X                     constructed.  It is defined with a default
X                     value at startup.
X
X     DIVFILE         Is defined in the startup file and gives the
X                     name that should be used for the diversion
X                     file name when specified as the name modif-
X                     ier in $(mktmp ...) expansions, see the TEXT
X                     DIVERSION section for details.
X
X     GROUPFLAGS      This macro gives the set of flags to pass to
X                     the shell when invoking it to execute a
X                     group recipe.  The value of the macro is the
X                     list of flags with a leading switch indica-
X                     tor.  (ie. `-' under UNIX)
X
X     GROUPSHELL      This macro defines the full path to the exe-
X                     cutable image to be used as the shell when
X                     processing group recipes.  This macro must
X                     be defined if group recipes are used.  It is
X                     assigned a default value in the startup
X                     makefile.  Under UNIX this value is /bin/sh.
X
X     GROUPSUFFIX     If defined, this macro gives the string to
X                     use as a suffix when creating group recipe
X                     files to be handed to the command inter-
X                     preter.  For example, if it is defined as
X                     .sh, then all temporary files created by
X                     dmake will end in the suffix .sh.  Under
X                     MSDOS if you are using command.com as your
X
X
X
XVersion 3.50                    UW                             25
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
X                     GROUPSHELL, then this suffix must be set to
X                     .bat in order for group recipes to function
X                     correctly.
X
X     MAKE            Is defined in the startup file by default.
X                     The string $(MAKE) is recognized when using
X                     the -n option for single line recipes.  Ini-
X                     tially this macro is defined to have the
X                     value "$(MAKECMD) $(MFLAGS)".
X
X     MAKESTARTUP     This macro defines the full path to the ini-
X                     tial startup makefile.  Use the -V command
X                     line option to discover it's initial value.
X
X     MAXLINELENGTH   This macro defines the maximum size of a
X                     single line of makefile input text.  The
X                     size is specified as a number, the default
X                     value is defined internally and is shown via
X                     the -V option.  A buffer of this size plus 2
X                     is allocated for reading makefile text.  The
X                     buffer is freed before any targets are made,
X                     thereby allowing files containing long input
X                     lines to be processed without consuming
X                     memory during the actual make.
X
X     MAXPROCESS      Specify the maximum number of child
X                     processes to use when making targets.  The
X                     default value of this macro is "1" and it's
X                     value cannot exceed the value of the macro
X                     MAXPROCESSLIMIT.  Setting the value of MAX-
X                     PROCESS on the command line or in the
X                     makefile is equivalent to supplying a
X                     corresponding value to the -P flag on the
X                     command line.
X
X     PREP            This macro defines the number of iterations
X                     to be expanded automatically when processing
X                     % rule definitions of the form:
X
X                     % : %.suff
X
X                     See the sections on PERCENT(%) RULES for
X                     details on how PREP is used.
X
X     SHELL           This macro defines the full path to the exe-
X                     cutable image to be used as the shell when
X                     processing single line recipes.  This macro
X                     must be defined if recipes requiring the
X                     shell for execution are to be used.  It is
X                     assigned a default value in the startup
X                     makefile.  Under UNIX this value is /bin/sh.
X
X
X
X
XVersion 3.50                    UW                             26
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
X     SHELLFLAGS      This macro gives the set of flags to pass to
X                     the shell when invoking it to execute a sin-
X                     gle line recipe.  The value of the macro is
X                     the list of flags with a leading switch
X                     indicator.  (ie. `-' under UNIX)
X
X     SHELLMETAS      Each time dmake executes a single recipe
X                     line (not a group recipe) the line is
X                     searched for any occurrence of a character
X                     defined in the value of SHELLMETAS.  If such
X                     a character is found the recipe line is
X                     defined to require a shell to ensure it's
X                     correct execution.  In such instances a
X                     shell is used to invoke the recipe line.  If
X                     no match is found the recipe line is exe-
X                     cuted without the use of a shell.
X
X
X     There is only one character valued macro defined by dmake:
X     SWITCHAR contains the switch character used to introduce
X     options on command lines.  On UNIX it's value is '-', on
X     MSDOS it's value may be '/' or '-'.  The macro is internally
X     defined and is not user setable.  The MSDOS version of dmake
X     attempts to first extract SWITCHAR from an environment vari-
X     able of the same name.  If that fails it then attempts to
X     use the undocumented getswitchar interrupt call, and returns
X     the result of that.  Thus under MSDOS version 4.0 you must
X     set the value of the environment macro SWITCHAR to '/' to
X     obtain predictable behaviour.
X
X     All boolean macros currently understood by dmake correspond
X     directly to the previously defined attributes.  These macros
X     provide a second way to apply global attributes, and
X     represent the preferred method of doing so.  They are used
X     by assigning them a value.  If the value is not a NULL
X     string then the boolean condition is set to on.  If the
X     value is a NULL string then the condition is set to off.
X     There are five conditions defined and they correspond
X     directly to the attributes of the same name.  Their meanings
X     are defined in the ATTRIBUTES section above.  The macros
X     are: .EPILOG, .IGNORE, .MKSARGS, .PRECIOUS, .PROLOG,
X     .SEQUENTIAL, .SILENT, .SWAP, and .USESHELL.  Assigning any
X     of these a non NULL value will globally set the correspond-
X     ing attribute to on.
X
XRUN_TIME MACROS
X     These macros are defined when dmake is making targets, and
X     may take on different values for each target.  $@ is defined
X     to be the full target name, $? is the list of all out of
X     date prerequisites, $& is the list of all prerequisites, $>
X     is the name of the library if the current target is a
X     library member, and $< is the list of prerequisites
X
X
X
XVersion 3.50                    UW                             27
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
X     specified in the current rule.  If the current target had a
X     recipe inferred then $< is the name of the inferred prere-
X     quisite even if the target had a list of prerequisites sup-
X     plied using an explicit rule that did not provide a recipe.
X     In such situations $& gives the full list of prerequisites.
X
X     $* is defined as $(@:db) when making targets with explicit
X     recipes and is defined as the value of % when making targets
X     whose recipe is the result of an inference.  In the first
X     case $* is the target name with no suffix, and in the second
X     case, is the value of the matched % pattern from the associ-
X     ated %-rule.  $^ expands to the set of out of date prere-
X     quisites taken from the current value of $<.  In addition to
X     these, $$ expands to $, {{ expands to {, }} expands to },
X     and the strings <+ and +> are recognized as respectively
X     starting and terminating a text diversion when they appear
X     literally together in the same input line.
X
X     The difference between $? and $^ can best be illustrated by
X     an example, consider:
X
X          fred.out : joe amy hello
X               rules for making fred
X
X          fred.out : my.c your.h his.h her.h   # more prerequisites
X
X     Assume joe, amy, and my.c are newer then fred.out.  When
X     dmake executes the recipe for making fred.out the values of
X     the following macros will be:
X
X          $@ --> fred.out
X          $* --> fred
X          $? --> joe amy my.c  # note the difference between $? and $^
X          $^ --> joe amy
X          $< --> joe amy hello
X          $& --> joe amy hello my.c your.h his.h her.h
X
X
XFUNCTION MACROS
X     Only one function macro is defined at this time.  The
X     $(mktmp ...) construct can be used to create a temporary
X     file containing data and returns the name of that file as
X     it's result.  See the TEXT DIVERSION section for details on
X     its use.  Temporary files created using this macro persist
X     for the duration of the dmake run if processed as part of a
X     macro assignment operation, or until an associated target's
X     recipe is fully completed at which time the temporary file
X     is removed.  NOTE:  Specifying '-v' on the command line
X     causes all temporary files to be retained when dmake exits.
X
X
X
X
X
X
XVersion 3.50                    UW                             28
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
XDYNAMIC PREREQUISITES
X     dmake looks for prerequisites whose names contain macro
X     expansions during target processing.  Any such prerequisites
X     are expanded and the result of the expansion is used as the
X     prerequisite name.  As an example the line:
X
X          fred : $$@.c
X
X     causes the $$@ to be expanded when dmake is making fred, and
X     it resolves to the target fred.  This enables dynamic prere-
X     quisites to be generated.  The value of @ may be modified by
X     any of the valid macro modifiers.  So you can say for exam-
X     ple:
X
X          fred.out : $$(@:b).c
X
X     where the $$(@:b) expands to fred.  Note the use of $$
X     instead of $ to indicate the dynamic expansion, this is due
X     to the fact that the rule line is expanded when it is ini-
X     tially parsed, and $$ then returns $ which later triggers
X     the dynamic prerequisite expansion.  If you really want a $
X     to be part of a prerequisite name you must use $$$$.
X     Dynamic macro expansion is performed in all user defined
X     rules, and the special targets .SOURCE*, and .INCLUDEDIRS.
X
XBINDING TARGETS
X     This operation takes a target name and binds it to an exist-
X     ing file, if possible.  dmake makes a distinction between
X     the internal target name of a target and it's associated
X     external file name.  Thus it is possible for a target's
X     internal name and its external file name to differ.  To per-
X     form the binding, the following set of rules is used.
X     Assume that we are trying to bind a target whose name is of
X     the form X.suff, where .suff is the suffix and X is the stem
X     portion (ie. that part which contains the directory and the
X     basename).  dmake takes this target name and performs a
X     series of search operations that try to find a suitably
X     named file in the external file system.  The search opera-
X     tion is user controlled via the settings of the various
X     .SOURCE targets.
X
X          1.   If target has the .SYMBOL attribute set then look
X               for it in the library.  If found, replace the tar-
X               get name with the library member name and continue
X               with step 2.  If the name is not found then
X               return.
X
X          2.   Extract the suffix portion (that following the
X               `.') of the target name.  If the suffix is not
X               null, look up the special target .SOURCE.<suff>
X               (<suff> is the suffix). If the special target
X               exists then search each directory given in the
X
X
X
XVersion 3.50                    UW                             29
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
X               .SOURCE.<suff> prerequisite list for the target.
X               If the target's suffix was null (ie. .suff was
X               empty) then perform the above search but use the
X               special target .SOURCE.NULL instead.  If at any
X               point a match is found then terminate the search.
X               If a directory in the prerequisite list is the
X               special name `.NULL ' perform a search for the
X               full target name without prepending any directory
X               portion (ie. prepend the NULL directory).  (a
X               default target of '.SOURCE : .NULL' is defined by
X               dmake at startup, and is user redefinable)
X
X          3.   The search in step 2. failed.  Repeat the same
X               search but this time use the special target
X               .SOURCE.
X
X          4.   The search in step 3. failed.  If the target has
X               the library member attribute (.LIBMEMBER) set then
X               try to find the target in the library which was
X               passed along with the .LIBMEMBER attribute (see
X               the MAKING LIBRARIES section).  The bound file
X               name assigned to a target which is successfully
X               located in a library is the same name that would
X               be assigned had the search failed (see 5.).
X
X          5.   The search failed.  Either the target was not
X               found in any of the search directories or no
X               applicable .SOURCE special targets exist.  If
X               applicable .SOURCE special targets exist, but the
X               target was not found, then dmake assigns the first
X               name searched as the bound file name.  If no
X               applicable .SOURCE special targets exist, then the
X               full original target name becomes the bound file
X               name.
X
X     There is potential here for a lot of search operations.  The
X     trick is to define .SOURCE.x special targets with short
X     search lists and leave .SOURCE as short as possible.  The
X     search algorithm has the following useful side effect.  When
X     a target having the .LIBMEMBER (library member) attribute is
X     searched for, it is first searched for as an ordinary file.
X     When a number of library members require updating it is
X     desirable to compile all of them first and to update the
X     library at the end in a single operation.  If one of the
X     members does not compile and dmake stops, then the user may
X     fix the error and make again.  dmake will not remake any of
X     the targets whose object files have already been generated
X     as long as none of their prerequisite files have been modi-
X     fied as a result of the fix.
X
X     When defining .SOURCE and .SOURCE.x targets the construct
X
X
X
X
XVersion 3.50                    UW                             30
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
X          .SOURCE :
X          .SOURCE : fred gery
X
X     is equivalent to
X
X          .SOURCE :- fred gery
X
X     dmake correctly handles the UNIX Make variable VPATH.  By
X     definition VPATH contains a list of ':' separated direc-
X     tories to search when looking for a target.  dmake maps
X     VPATH to the following special rule:
X
X          .SOURCE :^ $(VPATH:s/:/ /)
X
X     Which takes the value of VPATH and sets .SOURCE to the same
X     set of directories as specified in VPATH.
X
XPERCENT(%) RULES AND MAKING INFERENCES
X     When dmake makes a target it's set of prerequisites (if any)
X     must exist and the target must have a recipe which dmake can
X     use to make it.  If the makefile does not specify an expli-
X     cit recipe for the target then dmake uses special rules to
X     try to infer a recipe which it can use to make the target.
X     Previous versions of Make perform this task by using rules
X     that are defined by targets of the form .<suffix>.<suffix>
X     and by using the .SUFFIXES list of suffixes.  The exact
X     workings of this mechanism were sometimes difficult to
X     understand and often limiting in their usefulness.  Instead,
X     dmake supports the concept of %-meta rules. The syntax and
X     semantics of these rules differ from standard rule lines as
X     follows:
X
X          <%-target> [<attributes>] <ruleop> [<%-prerequisites>] [;<recipe>]
X
X     where %-target is a target containing exactly a single `%'
X     sign, attributes is a list (possibly empty) of attributes,
X     ruleop is the standard set of rule operators, %-prere-
X     quisites , if present, is a list of prerequisites containing
X     zero or more `%' signs, and recipe, if present, is the first
X     line of the recipe.
X
X     The %-target defines a pattern against which a target whose
X     recipe is being inferred gets matched.  The pattern match
X     goes as follows:  all chars are matched exactly from left to
X     right up to but not including the % sign in the pattern, %
X     then matches the longest string from the actual target name
X     not ending in the suffix given after the % sign in the pat-
X     tern.  Consider the following examples:
X
X          %.c       matches fred.c but not joe.c.Z
X          dir/%.c   matches dir/fred.c but not dd/fred.c
X          fred/%    matches fred/joe.c but not f/joe.c
X
X
X
XVersion 3.50                    UW                             31
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
X          %         matches anything
X
X     In each case the part of the target name that matched the %
X     sign is retained and is substituted for any % signs in the
X     prerequisite list of the %-meta rule when the rule is
X     selected during inference and dmake constructs the depen-
X     dency specified by the %-meta rule for the actual target.
X     As an example the following %-meta rules describe the fol-
X     lowing:
X
X          %.c : %.y ; recipe...
X
X     describes how to make any file ending in .c if a correspond-
X     ing file ending in .y can be found.
X
X          foo%.o : fee%.k ; recipe...
X
X     is used to describe how to make fooxxxx.o from feexxxx.k.
X
X          %.a :; recipe...
X
X     describes how to make a file whose suffix is .a without
X     inferring any prerequisites.
X
X          %.c : %.y yaccsrc/%.y ; recipe...
X
X     is a short form for the construct:
X
X          %.c : %.y ; recipe...
X          %.c : yaccsrc/%.y ; recipe...
X
X     ie. It is possible to specify the same recipe for two
X     %-rules by giving more than one prerequisite in the prere-
X     quisite list.  A more interesting example is:
X
X          % : RCS/%,v ; co $@
X
X     which describes how to take any target and check it out of
X     the RCS directory if the corresponding file exists in the
X     RCS directory.  The equivalent SCCS rule would be:
X
X          % : s.% ; get $@
X
X
X     The previous RCS example defines an infinite rule, because
X     it says how to make anything from RCS/%,v, and anything also
X     includes RCS/fred.c,v.  To limit the size of the graph that
X     results from such rules dmake uses the macro variable PREP
X     (stands for % repetition).  By default the value of this
X     variable is 0, which says that no repetitions of a %-rule
X     are to be generated.  If it is set to something greater than
X     0, then that many repetitions of any infinite %-rule are
X
X
X
XVersion 3.50                    UW                             32
X
X
X
X
XDMAKE(p)               Unsupported Software               DMAKE(p)
X
X
X
X     allowed.  If in the above example PREP was set to 1, then
X     dmake would generate the dependency graph:
X
X          % --> RCS/%,v --> RCS/RCS/%,v,v
X
X     Where each link is assigned the same recipe as the first
X     link.  PREP should be used only in special cases, since it
X     may result in a large increase in the number of possible
X     prerequisites tested.
X
X     dmake supports dynamic prerequisite generation for prere-
X     quisites of %-meta rules.  This is best illustrated by an
X     example.  The RCS rule shown above can infer how to check
X     out a file from a corresponding RCS file only if the target
X     is a simple file name with no directory information.  That
X     is, the above rule can infer how to find RCS/fred.c,v from
X     the target fred.c, but cannot infer how to find
X     srcdir/RCS/fred.c,v from srcdir/fred.c because the above
X     rule will cause dmake to look for RCS/srcdir/fred.c,v; which
X     does not exist (assume that srcdir has it's own RCS direc-
X     tory as is the common case).
X
X     A more versatile formulation of the above RCS check out rule
X     is the following:
X
X          % :  $$(@:d)RCS/$$(@:f),v : co $@
X
X     This rule uses the dynamic macro $@ to specify the prere-
X     quisite to try to infer.  During inference of this rule the
X     macro $@ is set to the value of the target of the %-meta
X     rule and the appropriate prerequisite is generated by
X     extracting the directory portion of the target name (if
X     any), appending the string RCS/ to it, and appending the
SHAR_EOF
echo "End of part 17"
echo "File man/dmake.nc is continued in part 18"
echo "18" > s2_seq_.tmp
exit 0