Lines Matching refs:rules
100 * Implicit Rules:: Use implicit rules to treat many files alike,
164 * Multiple Rules:: How to use several rules with the same target.
165 * Static Pattern:: Static pattern rules apply to multiple targets
169 several independent rules for one target.
170 * Automatic Prerequisites:: How to automatically generate rules giving
189 * Implicit/Search:: How search paths affect implicit rules.
194 * Static Usage:: The syntax of static pattern rules.
195 * Static versus Implicit:: When are they better than implicit rules?
293 * Catalogue of Rules:: A list of built-in implicit rules.
294 * Implicit Variables:: How to change what predefined rules do.
295 * Chained Rules:: How to use a chain of implicit rules.
296 * Pattern Rules:: How to define new implicit rules.
297 * Last Resort:: How to define commands for rules which
301 implicit rules.
305 * Pattern Intro:: An introduction to pattern rules.
306 * Pattern Examples:: Examples of pattern rules.
308 commands of implicit rules.
311 defining rules that can match any
313 * Canceling Rules:: How to override or cancel built-in rules.
504 A simple makefile consists of ``rules'' with the following shape:
526 @cindex tabs in rules
544 A makefile may contain other text besides rules, but a simple makefile
545 need only contain rules. Rules may look somewhat more complicated
682 must process the rules for the files that @file{edit} depends on,
684 processed according to its own rule. These rules say to update each
690 The other rules are processed because their targets appear as
699 are not the targets of any rules---so @code{make} does nothing for these
701 such as those made by Bison or Yacc, by their own rules at this time.
796 @cindex deducing commands (implicit rules)
805 @file{main.o}. We can therefore omit the commands from the rules for the
843 Because implicit rules are so convenient, they are important. You
848 @cindex combining rules by prerequisite
850 When the objects of a makefile are created only by implicit rules, an
883 Compiling a program is not the only thing you might want to write rules
951 Makefiles contain five kinds of things: @dfn{explicit rules},
952 @dfn{implicit rules}, @dfn{variable definitions}, @dfn{directives},
1053 implicit rules. @xref{Implicit Rules, ,Using Implicit Rules}.
1124 (@pxref{Setting, ,Setting Variables}) or pattern rules
1202 rules work better, such as defining search paths (@pxref{Directory Search}).
1435 @code{make} rules, you probably want the rules to be run so that the
1486 @xref{Pattern Rules}, for more information on pattern rules.
1526 rules, and constructs a dependency graph of all the targets and their
1529 invoke the rules necessary to do so.
1602 general rule is true for explicit rules, pattern rules, suffix rules,
1603 static pattern rules, and simple prerequisite definitions.
1677 expansion occurs for both explicit and implicit (pattern) rules.
1720 @cindex secondary expansion and explicit rules
1721 @cindex explicit rules, secondary expansion of
1723 During the secondary expansion of explicit rules, @code{$$@@} and
1728 of all prerequisites of rules @emph{that have already appeared} for
1756 @cindex secondary expansion and static pattern rules
1757 @cindex static pattern rules, secondary expansion of
1759 Rules for secondary expansion of static pattern rules are identical to
1760 those for explicit rules, above, with one exception: for static
1761 pattern rules the @code{$$*} variable is set to the pattern stem. As
1762 with explicit rules, @code{$$?} is not available and expands to the
1766 @cindex secondary expansion and implicit rules
1767 @cindex implicit rules, secondary expansion of
1772 the same fashion as for static pattern rules. As an example:
1809 @cindex writing rules
1821 The order of rules is not significant, except for determining the
1850 * Multiple Rules:: How to use several rules with the same target.
1851 * Static Pattern:: Static pattern rules apply to multiple targets
1855 several independent rules for one target.
1856 * Automatic Prerequisites:: How to automatically generate rules giving
1895 @cindex syntax of rules
1932 @cindex dollar sign (@code{$}), in rules
1933 @cindex @code{$}, in rules
1934 @cindex rules, and @code{$}
1990 specific ordering on the rules to be invoked @emph{without} forcing
1991 the target to be updated if one of those rules is executed. In that
2170 Wildcard expansion happens automatically in rules. But wildcard expansion
2185 behave in rules, where they are used verbatim rather than ignored
2218 there is no need to write explicit rules for compiling the files.
2234 among directories, you do not need to change the individual rules,
2245 * Implicit/Search:: How search paths affect implicit rules.
2257 list for both prerequisites and targets of rules.
2334 characters (as in pattern rules; @pxref{Pattern Rules, ,Defining and
2491 compilation by implicit rules; we use it here for consistency so it will
2507 @cindex @code{VPATH}, and implicit rules
2508 @cindex directory search (@code{VPATH}), and implicit rules
2509 @cindex search path for prerequisites (@code{VPATH}), and implicit rules
2516 @code{vpath} also happens during consideration of implicit rules
2520 considers implicit rules, such as the built-in rule to compile
2526 The commands of implicit rules normally use automatic variables as a
2847 of suffixes to be used in checking for suffix rules.
2854 which no rules are found (either explicit rules or implicit rules).
2876 to preserve intermediate files created by rules whose target patterns
2909 of suffixes to be used in checking for suffix rules.
3007 as @samp{.c.o}. These targets are suffix rules, an obsolete way of
3008 defining implicit rules (but a way still widely used). In principle, any
3021 A rule with multiple targets is equivalent to writing many rules, each with
3081 @cindex multiple rules for one target
3082 @cindex several rules for one target
3084 @cindex target, multiple rules for one
3086 One file can be the target of several rules. All the prerequisites
3087 mentioned in all the rules are merged into one list of prerequisites for
3099 @dfn{double-colon rules} (@pxref{Double-Colon}) for this.
3115 This could be inserted or taken out without changing the rules that really
3135 If none of the explicit rules for a target has commands, then @code{make}
3143 @cindex pattern rules, static (not implicit)
3147 @dfn{Static pattern rules} are rules which specify multiple targets and
3149 They are more general than ordinary rules with multiple targets because the
3154 * Static Usage:: The syntax of static pattern rules.
3155 * Static versus Implicit:: When are they better than implicit rules?
3161 @cindex pattern rules, static, syntax of
3174 ordinary rules (@pxref{Wildcards, ,Using Wildcard Characters in File
3205 @samp{%} characters in pattern rules can be quoted with preceding
3256 Another example shows how to use @code{$*} in static pattern rules:
3285 the order of rules.
3290 rules apply, and both have commands, that's an error.
3306 With static pattern rules, there is no uncertainty: each rule applies
3312 @cindex double-colon rules
3314 @cindex multiple rules for one target (@code{::})
3315 @cindex @code{::} rules (double-colon)
3317 @dfn{Double-colon} rules are rules written with @samp{::} instead of
3319 ordinary rules when the same target appears in more than one rule.
3321 When a target appears in multiple rules, all the rules must be the same
3327 executing none, any, or all of the double-colon rules.
3329 Double-colon rules with the same target are in fact completely separate
3331 as rules with different targets are processed.
3333 The double-colon rules for a target are executed in the order they appear
3334 in the makefile. However, the cases where double-colon rules really make
3337 Double-colon rules are somewhat obscure and not often very useful; they
3352 In the makefile for a program, many of the rules you need to write often
3364 large program you would have to write dozens of such rules in your
3370 To avoid this hassle, most modern C compilers can write these rules for
3387 Thus you no longer have to write all those rules yourself.
3428 @xref{Pattern Rules}, for information on defining pattern rules. The
3535 Some consequences of these rules include:
3644 which, according to shell quoting rules, will yield the following output:
3668 situation the newline quoting rules for makefiles will be used, and
3708 same quoting rules: if you want a dollar sign to appear in your
4038 the current rule, and perhaps on all rules.
4067 flag, errors are ignored in all commands of all rules. A rule in the
4645 refer to the canned sequence from the rules for those targets. The canned
4751 from getting implicit commands (from implicit rules or the
4786 read, except for the shell commands in rules, the right-hand sides of
4808 control implicit rules or for parameters that the user should override with
5539 variable, @code{includes}. (@code{CFLAGS} is used by the rules for C
5930 units of the makefile, such as rules, may cross the beginning or the
6117 if any, is effective. The rules for expansion and testing of
6138 units of the makefile, such as rules, may safely be split across the
6978 expansion rules, like @code{foreach} or @code{if}, may not work as you
7090 @code{make} variables, targets, implicit or explicit rules, etc.
7107 just writing out the rules, consider two things: first, the template
7495 implicit rules that say how to make them.
7504 during @code{clean} rules (@pxref{Automatic Prerequisites}), so
7672 With the @samp{-t} flag, @code{make} ignores the commands in the rules
7734 commands in the rules, but rather to mark the target up to date by
7911 which files actually need to be remade, which implicit rules are
8057 @var{file}. Essentially the file is treated as very old and its rules
8065 @cindex data base of @code{make} rules
8066 @cindex predefined rules and variables, printing
8067 Print the data base (rules and variable values) that results from
8071 use @w{@samp{make -qp}}. To print the data base of predefined rules and
8088 @itemx --no-builtin-rules
8089 @cindex @code{--no-builtin-rules}
8090 Eliminate use of the built-in implicit rules (@pxref{Implicit Rules,
8092 pattern rules (@pxref{Pattern Rules, ,Defining and Redefining Pattern
8094 suffixes for suffix rules (@pxref{Suffix Rules, ,Old-Fashioned Suffix
8096 @code{.SUFFIXES}, and then define your own suffix rules. Note that only
8097 @emph{rules} are affected by the @code{-r} option; default variables
8109 implicit rules without any definitions for the variables that they use.
8206 @dfn{Implicit rules} tell @code{make} how to use customary techniques so
8209 names determine which implicit rules are run. For example, C
8214 A chain of implicit rules can apply in sequence; for example, @code{make}
8220 The built-in implicit rules use several variables in their commands so
8228 You can define your own implicit rules by writing @dfn{pattern rules}.
8233 @dfn{Suffix rules} are a more limited way to define implicit rules.
8234 Pattern rules are more general and clearer, but suffix rules are
8243 * Catalogue of Rules:: A list of built-in implicit rules.
8244 * Implicit Variables:: How to change what predefined rules do.
8245 * Chained Rules:: How to use a chain of implicit rules.
8246 * Pattern Rules:: How to define new implicit rules.
8247 * Last Resort:: How to define commands for rules which
8251 implicit rules.
8284 be many implicit rules with the same target pattern. For example, numerous
8285 rules make @samp{.o} files: one, from a @samp{.c} file with the C compiler;
8296 for a catalogue of all the predefined implicit rules.
8325 implicit rules (@pxref{Catalogue of Rules, , Catalogue of Implicit
8337 Here is a catalogue of predefined implicit rules which are always
8341 @samp{--no-builtin-rules} option cancels all predefined rules.
8343 This manual only documents the default rules available on POSIX-based
8345 OS/2, etc. may have different sets of default rules. To see the full
8346 list of default rules and variables available in your version of GNU
8349 Not all of these rules will always be defined, even when the @samp{-r}
8350 option is not given. Many of the predefined implicit rules are
8351 implemented in @code{make} as suffix rules, so which ones will be
8359 @code{.sh}, @code{.elc}, @code{.el}. All of the implicit rules
8361 actually suffix rules. If you modify the suffix list, the only
8362 predefined suffix rules in effect will be those named by one or two of
8363 the suffixes that are on the list you specify; rules whose suffixes fail
8365 Suffix Rules}, for full details on suffix rules.
8587 newer. The rules for RCS are terminal
8598 command used is @w{@samp{$(GET) $(GFLAGS)}}. The rules for SCCS are
8619 However, the commands in built-in implicit rules actually use
8646 The commands in built-in implicit rules make liberal use of certain
8649 alter how the implicit rules work without redefining the rules
8650 themselves. You can cancel all variables used by implicit rules with
8659 each compilation. @emph{All} implicit rules that do C compilation use
8663 The variables used in implicit rules fall into two classes: those that are
8677 programs in built-in rules:
8864 @cindex chains of rules
8866 Sometimes a file can be made by a sequence of implicit rules. For example,
8887 Intermediate files are remade using their rules just like all other
8924 intermediate files made by implicit rules whose target patterns match
8929 A chain can involve more than two implicit rules. For example, it is
8940 There are some special implicit rules to optimize certain cases that would
8943 chained rules, using @file{foo.o} as an intermediate file. But what
8947 ordering of rules.
8962 Note that expansion using @samp{%} in pattern rules occurs
8968 * Pattern Intro:: An introduction to pattern rules.
8969 * Pattern Examples:: Examples of pattern rules.
8971 commands of implicit rules.
8974 defining rules that can match any
8976 * Canceling Rules:: How to override or cancel built-in rules.
8989 @cindex @code{%}, in pattern rules
9026 Pattern rules may have more than one target. Unlike normal rules, this
9027 does not act as many different rules with the same prerequisites and
9039 The order in which pattern rules appear in the makefile is important
9042 rules, only the first one found is used. The rules you write take precedence
9045 rule with prerequisites that must be made by chaining other implicit rules.
9046 @cindex pattern rules, order of
9047 @cindex order of pattern rules
9052 Here are some examples of pattern rules actually predefined in
9219 using @samp{$*} except in implicit rules or static pattern rules.@refill
9225 @samp{$?} is useful even in explicit rules when you wish to operate on only
9367 whatever. We call these rules @dfn{match-anything} rules. They are very
9386 considers match-anything rules. There are two different constraints that
9393 other implicit rules are not good enough. In other words, no further
9396 For example, the built-in implicit rules for extracting sources from RCS
9413 consideration of any nonterminal match-anything rules for the file
9419 rules are used for making files containing specific types of data (such as
9423 Special built-in dummy pattern rules are provided solely to recognize
9424 certain file names so that nonterminal match-anything rules will not be
9425 considered. These dummy rules have no prerequisites and no commands, and
9438 Dummy pattern rules such as the one for @samp{%.p} are made for every
9439 suffix listed as valid for use in suffix rules (@pxref{Suffix Rules, ,Old-Fashioned Suffix Rules}).
9448 implicit rules is determined by where you write the new rule.
9460 @cindex last-resort default rules
9461 @cindex default rules, last-resort
9484 are no rules at all, even ones which don't specify commands. You do
9510 @cindex old-fashioned suffix rules
9513 @dfn{Suffix rules} are the old-fashioned way of defining implicit rules for
9514 @code{make}. Suffix rules are obsolete because pattern rules are more
9549 Suffix rules cannot have any prerequisites of their own. If they have any,
9550 they are treated as normal files with funny names, not as suffix rules.
9571 Suffix rules with no commands are also meaningless. They do not remove
9572 previous rules as do pattern rules with no commands (@pxref{Canceling
9601 The @samp{-r} or @samp{--no-builtin-rules} flag causes the default
9617 rule with no commands, for each target of ordinary rules none of which have
9620 rules, in the search for a chain of rules.
9622 Suffix rules are not mentioned in this algorithm because suffix rules are
9623 converted to equivalent pattern rules once the makefiles have been read in.
9638 Make a list of all the pattern rules one of whose targets matches
9644 remove all nonterminal match-anything rules from the list.
9647 Remove from the list all rules with no commands.
9692 made by implicit rules, then this rule applies.
9788 feature it considers implicit rules that match @file{(@var{m})}, as well as
9813 Implicit rules such as this one are written using the automatic variable
9864 running @code{ranlib}. The rules for updating the members are not shown
9896 files. @xref{Suffix Rules}, for a full explanation of suffix rules.
9897 Archive suffix rules are obsolete in GNU @code{make}, because pattern
9898 rules for archives are a more general mechanism (@pxref{Archive
9934 of file, @code{make} also converts archive suffix rules to pattern rules
9936 @w{@samp{.@var{x}.a}} produces two pattern rules: @samp{@w{(%.o):}
9999 Support for suffix @samp{.a} in suffix rules. @xref{Archive Suffix
10018 Pattern rules using @samp{%}.
10150 Allow suffixes for suffix rules
10164 Specify static pattern rules. @xref{Static Pattern, ,Static Pattern Rules}.
10180 Various new built-in implicit rules.
10212 Suffixes (used in suffix rules) that end with the character @samp{~}
10218 series of such suffix rules is required.
10222 pattern rules for extraction from SCCS, in combination with the
10262 GNU @code{make} does not include any built-in implicit rules for
10721 either explicit or implicit (including in the default rules database).
10746 (except for double-colon rules). If you give commands for a target
10775 @itemx mixed implicit and static pattern rules. Stop.
10776 These are generated for malformed static pattern rules. The first means