dvadura@watdragon.waterloo.edu (Dennis Vadura) (07/27/90)
Posting-number: Volume 14, Issue 23 Submitted-by: dvadura@watdragon.waterloo.edu (Dennis Vadura) Archive-name: dmake/part13 #!/bin/sh # this is part 13 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file man/dmake.nc continued # CurArch=13 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 the current prerequisite list for the target. The `:' X operator with no recipe always modifies the current list of X prerequisites. Thus assuming each of the following defini- X tions has a recipe attached, then: X X joe : fred ... (1) X joe :: more ... (2) X X and X X joe :: fred ... (3) X joe :: more ... (4) X X are legal and mean: add the recipe associated with (2), or X (4) to the set of recipes for joe, placing them after exist- X ing recipes for making joe. The construct: X X joe :: fred ... (5) X joe : more ... (6) X X and X X joe : fred ... (7) X joe : more ... (8) X X are errors since we have two sets of perfectly good recipes X for making the target. X X prerequisites is a possibly empty list of targets that must X be brought up to date before making the current target. X X recipe is a short form and allows the user to specify short X rule definitions on a single line. It is taken to be the X first recipe line in a larger recipe if additional lines X follow the rule definition. If the semi-colon is present X but the recipe line is empty (ie. null string) then it is X X X XVersion 3.50 UW 16 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X X X taken to be an empty rule. Any target so defined causes the X Don't know how to make ... error message to be suppressed X when dmake tries to make the target and fails. This silence X is maintained for rules that are terminated by a semicolon X and have no following recipe lines, for targets listed on X the command line, and for the first target found in the X makefile. X XRECIPES X The traditional format used by most versions of Make defines X the recipe lines as arbitrary strings that may contain macro X expansions. They follow a rule definition line and may be X spaced apart by comment or blank lines. The list of recipe X lines defining the recipe is terminated by a new target X definition, a macro definition, or end-of-file. Each recipe X line MUST begin with a <TAB> character which may optionally X be followed with one or both of the characters '-@'. The X '-' indicates that non-zero exit values (ie. errors) are to X be ignored when this recipe line is executed, and the '@' X indicates that the recipe line should NOT be echoed to the X terminal prior to being executed. Both switches are off by X default (ie. by default, errors are significant and commands X are echoed). Global settings activated via command line X options or special attribute or target names may also affect X these settings. An example recipe: X X target : X first recipe line X second recipe line, executed independently of the first. X @a recipe line that is not echoed X -and one that has errors ignored. X X The second and new format of the recipe block begins the X block with the character '[' (the open group character) in X the last non-white space position of a line, and terminates X the block with the character ']' (the close group character) X in the first non-white space position of a line. In this X form each recipe line need not have a leading TAB. This is X called a recipe group. Groups so defined are fed intact as X a single unit to a shell for execution whenever the X corresponding target needs to be updated. If the open group X character '[' is preceded by one or both of - or @ then they X apply to the entire group in the same way that the - and @ X apply to single recipe lines. See the MAKING TARGETS sec- X tion for a description of how dmake invokes recipes. Here X is an example of a group recipe: X X target : X [ X first recipe line X second recipe line X all of these recipe lines are fed to a X X X XVersion 3.50 UW 17 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X X X single copy of a shell for execution. X ] X X XTEXT DIVERSIONS X dmake supports the notion of text diversions in recipes. If X a recipe line contains the character sequence <+ it is X recognized and a text diversion is started. This causes X dmake to open a temporary file and to copy into that file X all text that is found up to but not including the text X diversion termination sequence +>. Any diversions started X with a <+ must be terminated with a corresponding +>; the X terminating +> may appear on the same or on a subsequent X recipe line. Nesting of diversions is not supported. X New-lines provided in the recipe that forms the text of a X diversion are inserted into the resulting temporary file at X the appropriate locations. The diversion text may contain X the same escape codes as those described in the MACROS sec- X tion. X X The primary use of diversions is on systems (like MSDOS) X that do not support long command lines. The diversion makes X it possible to produce a temporary file containing the argu- X ments which can then be supplied to a utility via the tem- X porary file. X X Here are some examples: X X all: X cat <+this is a X test of the text diversion+> X X The above will cause dmake to execute the command: X X cat /tmp/mk12294AA X X and the contents of the temporary file will be the text X found between the <+ and +> strings of the above recipe. X X OBJ = fred.obj mary.obj joe.obj X all : $(OBJ) X link @<+$(^: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 X X XVersion 3.50 UW 18 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X X 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 placed immediately before the +> X text diversion terminator. X X If the environment variable TMPDIR is defined then the tem- X porary file is created in the directory specified by that X variable. A makefile can change where temporary files are X created 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 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 X X XVersion 3.50 UW 19 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X X 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 .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 X X X XVersion 3.50 UW 20 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X X X application of transitive closure on the X dependency 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 two classes: control macros and run-time macros. The X control macros are used by dmake to configure it's actions, X and are the preferred method of doing so. In the case when X a control macro has the same function as a special target or X attribute they share the same name as the special target or X attribute. The run-time macros are defined when dmake makes X targets and may be used by the user inside recipes. We X first give the control macros and their meanings. X 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 also divided into three groups. The first group X gives the string valued macros that are defined internally X and cannot 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 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 X XVersion 3.50 UW 21 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X 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 MAXPROCESSLIMIT X Is a numeric string representing the maximum X number of processes that dmake can use when X making targets in the 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 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 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 X X X XVersion 3.50 UW 22 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X 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 GROUPSHELL, then this suffix must be set to X .bat in order for group recipes to work X correctly. X X MAKE It is defined in the startup file by X default. The string $(MAKE) is recognized X when using the -n option for single line X recipes. Initially this macro is defined to X have the 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 X X XVersion 3.50 UW 23 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X X 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 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. 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 X X XVersion 3.50 UW 24 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X X 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, .PRECIOUS, .PROLOG, and .SILENT. X Assigning any of these a non NULL value will turn on the X corresponding attribute on a global scale. X X The second class of macros is the run-time macros. These X macros are defined when dmake is making targets, and may X take on different values for each target. $@ is defined to X be the full target name, $? is the list of all out of date X prerequisites, $& is the list of all prerequisites, $> is X the name of the library if the current target is a library X member, $< is the list of prerequisites specified in the X current rule (this includes any inferred prerequisites), $* 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 latter X is the value of the matched % pattern from the associated X %-rule. $^ expands to the set of out of date prerequisites X taken from the current value of $<. In addition to these, X $$ expands to $, {{ expands to {, }} expands to }, and the X strings <+ and +> are reserved for use in recipe scripts for X starting and terminating a text diversion respectively. 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 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 X XVersion 3.50 UW 25 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X 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 .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 stat for the full X target name without prepending any directory X X X XVersion 3.50 UW 26 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X X 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 .SOURCE : X .SOURCE : fred gery X X is equivalent to X X .SOURCE :- fred gery X X X X X XVersion 3.50 UW 27 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X 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 % 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 X X XVersion 3.50 UW 28 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X X 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 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 X X XVersion 3.50 UW 29 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X X 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 X target file name with a trailing ,v attached to the previous X result. X X dmake can also infer indirect prerequisites. An inferred X target can have a list of prerequisites added that will not X show up in the value of $< but will show up in the value of X $? and $&. Indirect prerequisites are specified in an X inference rule by quoting the prerequisite with single X quotes. For example, if you had the explicit dependency: X X fred.o : fred.c ; rule to make fred.o X fred.o : local.h X X then this can be infered for fred.o from the following X inference rule: X X %.o : %.c 'local.h' ; rule to make a .o from a .c X X You may infer indirect prerequisites that are a function of X the value of '%' in the current rule. The meta-rule: X X %.o : %.c '$(INC)/%.h' ; rule to make a .o from a .c X X infers an indirect prerequisite found in the INC directory X whose name is the same as the expansion of $(INC), and the X prerequisite name depends on the base name of the current X X X XVersion 3.50 UW 30 X X X X XDMAKE(p) Unsupported Software DMAKE(p) X X X X target. The set of indirect prerequisites is attached to X the meta rule in which they are specified and are inferred X only if the rule is used to infer a recipe for a target. X They do not play an active role in driving the inference X algorithm. The construct: X X %.o : %.c %.f 'local.h'; recipe X X is equivalent to: X X %.o : %.c 'local.h' : recipe X %.o : %.f 'local.h' : recipe X X X If any of the attributes .SETDIR, .EPILOG, .PROLOG, .SILENT, X .PRECIOUS, .LIBRARY, and .IGNORE are given for a %-rule then SHAR_EOF echo "End of part 13" echo "File man/dmake.nc is continued in part 14" echo "14" > s2_seq_.tmp exit 0