diff options
author | Roland McGrath <roland@redhat.com> | 1988-05-20 17:00:49 +0000 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 1988-05-20 17:00:49 +0000 |
commit | b718e918d129d16c75b1fcfc19b6be75ad6832d2 (patch) | |
tree | aad238cd122acf59ebfa48f8c6ed8aa7a437af69 | |
parent | 7962f88558231a2e32f741a0d6a1c1736ff37230 (diff) | |
download | gunmake-b718e918d129d16c75b1fcfc19b6be75ad6832d2.tar.gz |
Documented extended static rules.
-rw-r--r-- | make.texinfo | 78 |
1 files changed, 76 insertions, 2 deletions
diff --git a/make.texinfo b/make.texinfo index 0df16fb..78a0942 100644 --- a/make.texinfo +++ b/make.texinfo @@ -6,7 +6,10 @@ $Header$ $Log$ -Revision 1.17 1988/05/18 16:26:55 mcgrath +Revision 1.22 1988/05/20 17:00:49 mcgrath +Documented extended static rules. + +Revision 1.17 88/05/18 16:26:55 mcgrath Fixed a couple Texinfo bugs. Revision 1.16 88/05/15 18:58:00 mcgrath @@ -181,6 +184,8 @@ be recompiled, or how. @xref{Running}. * Implicit:: Implicit rules take over if the makefile doesn't say how a file is to be remade. +* Static:: Extended static rules provide a compromise between explicit + rules and implicit rule assumptions. * Archives:: How to use @code{make} to update archive files. * Missing:: Features of other @code{make}s not supported by GNU @code{make}. @@ -3994,7 +3999,76 @@ The name of the first dependency that came via the implicit rule. For @code{.DEFAULT} commands, as for non-implicit commands, @samp{$*} and @samp{$<} are empty. @samp{$@@} is @var{t}, as always. -@node Archives, Missing, Implicit, Top +@node Static, Archives, Implicit, Top +@chapter Extended Static Rules +@cindex extended static rules +@cindex static rules +@cindex explicit rules + +@dfn{Static rules}, or @dfn{explicit rules} are simple rules where you give +the dependencies and commands for the targets. @dfn{Implicit rules} +(@pxref{Implicit}) are rules generated by @code{make} for which you specify +only the target (and perhaps some implicit rules in addition to the +standard set), and the dependencies and commands are figured out for you. +@dfn{Extended static rules} provide a compromise between these two types of +rules. They have the flexibility of implicit rules, but do not depend on +the contents of any directory to determine what is made from what. + +Extended static rules are basically implicit rules that are applied to a +limited set of targets, rather than just any target that has no commands of +its own. The syntax of this type of rule follows directly from this +explanation: + +@example +@var{targets}: @var{target-pattern}: @var{dep} @dots{}; @var{command} + @var{command} + @dots{} +@end example + +The first part of this rule, ``@var{targets}:'' gives the list of targets +that the rule applies to. These targets are filenames, possibly containing +wildcard characters, just like the targets of ordinary explicit rules. +The rest of the rule resembles an implicit pattern rule. It has a target +pattern containing a @samp{%} character and dependency filenames, each of +which may contain a @samp{%} which is replaced by what matched the @samp{%} +in the target pattern. + +In extended static rules, each target must match the target pattern; a +warning is issued for each that does not. If you have a list of files, +only some of which will match the pattern, you can use the @samp{filter} +function to remove nonmatching filenames: + +@example +files := foo.elc bar.o + +$(filter %.o,$(files)): %.o: %.c; cc $< -o $@@ +$(filter %.elc,$(files)): %.elc: %.el; el-compile $< -o $@@ +@end example + +This type of rule is better than implicit rules in some situations +for a few reasons: + +@itemize @bullet +@item +You may wish to have a different pattern rule apply to one set of files +than applies to all others. + +@item +If you cannot be sure of the contents of the directories in which your +targets reside (or those listed in @code{vpath} search paths or the +@code{VPATH} variable; @pxref{Directory Search}), you may want to +circumvent possible unintended actions by @code{make} resulting from the +wrong implicit rule matching. + +@item +You may simply be of the opinion that implicit rules are inherently not +particularly wonderful and would rather tell @code{make} exactly what to do +with what, but without all the trouble of ordinary explicit rules. +(This is included because that appears to be the opinion of the person who +originally suggested the concept of extended static rules.) +@end itemize + +@node Archives, Missing, Static, Top @chapter Using @code{make} to Update Archive Files @cindex archive |