Lines Matching refs:rule
101 * Rule Introduction:: What a rule looks like.
137 * Multiple Targets:: When to make use of several targets in a rule.
142 * Double-Colon:: How to use a special kind of rule to allow
265 * Using Implicit:: How to use an existing implicit rule
273 * Suffix Rules:: The old-fashioned style of implicit rule.
292 * Archive Update:: The implicit rule for archive member targets.
294 * Archive Suffix Rules:: You can write a special kind of suffix rule
443 * Rule Introduction:: What a rule looks like.
472 A "command" is an action that `make' carries out. A rule may have
477 Usually a command is in a rule with prerequisites and serves to
479 rule that specifies commands for the target need not have
480 prerequisites. For example, the rule containing the delete command
483 A "rule", then, explains how and when to remake certain files which
484 are the targets of the particular rule. `make' carries out the
485 commands on the prerequisites to create or update the target. A rule
565 properly. All `make' does is execute the commands in the rule you have
569 Since you normally do not want to carry out the actions in this rule,
570 `clean' is not a prerequisite of any other rule. Consequently, `make'
572 this rule not only is not a prerequisite, it also does not have any
573 prerequisites, so the only purpose of the rule is to run the specified
593 update the executable program `edit'; therefore, we put that rule first.
600 processing the first rule. In the example, this rule is for relinking
601 `edit'; but before `make' can fully process this rule, it must process
604 own rule. These rules say to update each `.o' file by compiling its
610 prerequisites of the goal. If some other rule is not depended on by the
611 goal (or anything it depends on, etc.), that rule is not processed,
639 In our example, we had to list all the object files twice in the rule
700 "implicit rule" for updating a `.o' file from a correspondingly named
779 Here is how we could write a `make' rule for cleaning our example
785 In practice, we might want to write the rule in a somewhat more
797 A rule such as this should not be placed at the beginning of the
799 example makefile, we want the rule for `edit', which recompiles the
802 Since `clean' is not a prerequisite of `edit', this rule will not
804 to make the rule run, we have to type `make clean'. *Note How to Run
840 * An "explicit rule" says when and how to remake one or more files,
841 called the rule's "targets". It lists the other files that the
846 * An "implicit rule" says when and how to remake a class of files
1191 rule which says how to update it (found either in that very makefile or
1192 in another one) or if an implicit rule applies to it (*note Using
1201 you want to keep `make' from performing an implicit rule search on
1203 preventing implicit rule lookup to do so. For example, you can write an
1204 explicit rule with the makefile as the target, and an empty command
1207 If the makefiles specify a double-colon rule to remake a file with
1210 double-colon rule with commands but no prerequisites will be remade
1215 which are specified as targets of a double-colon rule with commands but
1270 you can use a match-anything pattern rule to say that to remake any
1289 `GNUmakefile', so it will use the commands from the pattern rule: `make
1290 -f Makefile bar'. If `Makefile' provides a rule for updating `bar',
1291 `make' will apply the rule. And likewise for any other target that
1294 The way this works is that the pattern rule has a pattern of just
1295 `%', so it matches any target whatever. The rule specifies a
1298 commands to prevent `make' from searching for an implicit rule to build
1299 it--otherwise it would apply the same match-anything rule to `force'
1357 command script for that rule is invoked. If you need to use automatic
1364 A rule is always expanded the same way, regardless of the form:
1371 deferred. This general rule is true for explicit rules, pattern rules,
1474 types of rule definitions that `make' understands. The subtleties of
1483 variable evaluates to the first prerequisite in the first rule for this
1504 rule with the command script is always evaluated last.
1520 As `make' searches for an implicit rule, it substitutes the stem and
1521 then performs secondary expansion for every rule with a matching target
1533 When the implicit rule is tried for target `foo', `$$<' expands to
1559 A "rule" appears in the makefile and says when and how to remake
1560 certain files, called the rule's "targets" (most often only one per
1561 rule). It lists the other files that are the "prerequisites" of the
1567 rule in the first makefile. If the first rule has multiple targets,
1571 a pattern rule has no effect on the default goal. (*Note Defining and
1574 Therefore, we usually write the makefile so that the first rule is
1593 * Multiple Targets:: When to make use of several targets in a rule.
1598 * Double-Colon:: How to use a special kind of rule to allow
1609 Here is an example of a rule:
1618 This rule says two things:
1635 In general, a rule looks like this:
1651 Usually there is only one target per rule, but occasionally there is a
1672 A rule tells `make' two things: when the targets are out of date,
1767 Wildcards can be used in the commands of a rule, where they are expanded
1768 by the shell. For example, here is a rule to delete all the object
1774 Wildcards are also useful in the prerequisites of a rule. With the
1775 following rule in the makefile, `make print' will print all the `.c'
1782 This rule uses `print' as an empty target file; see *note Empty Target
1818 happens in the rule for `foo', so that each _existing_ `.o' file
1887 (This takes advantage of the implicit rule for compiling C programs, so
1949 With this value of `VPATH', the following rule,
2104 search, this cannot change the commands of the rule; they will execute
2111 all the prerequisites of the rule, including the names of the
2141 For example, when a file `foo.o' has no explicit rule, `make'
2142 considers implicit rules, such as the built-in rule to compile `foo.c'
2146 implicit rule for C compilation is applied.
2211 If you write a rule whose commands will not create the target file,
2236 could be remade from other files, `make' skips the implicit rule search
2242 target, then you write the rule, like this:
2252 built. One way to handle this is with one rule whose command is a
2263 detected in a submake is not noted by this rule, so it will continue to
2269 Parallel Execution: Parallel.), since there is only one rule.
2343 If a rule has no prerequisites or commands, and the target of the rule
2345 updated whenever its rule is run. This implies that all targets
2378 last-modification time, when the rule's commands were last executed. It
2392 With this rule, `make print' will execute the `lpr' command if either
2421 file mentioned as a prerequisite, but not as a target in a rule,
2435 You can also list the target pattern of an implicit rule (such as
2466 makefile, then `make' will delete the target of a rule if it has
2538 Any defined implicit rule suffix also counts as a special target if
2553 A rule with multiple targets is equivalent to writing many rules, each
2557 rule contributes the same prerequisites to all the targets also.
2590 cannot do this with multiple targets in an ordinary rule, but you can
2591 do it with a "static pattern rule". *Note Static Pattern Rules: Static
2602 the target. If the target is older than any prerequisite from any rule,
2606 more than one rule gives commands for the same file, `make' uses the
2615 An extra rule with just prerequisites can be used to give a few extra
2642 searches for an applicable implicit rule to find some commands *note
2668 Here is the syntax of a static pattern rule:
2674 The TARGETS list specifies the targets that the rule applies to. The
2738 lose.o', and the first static pattern rule causes each of these object
2757 A static pattern rule has much in common with an implicit rule defined
2758 as a pattern rule (*note Defining and Redefining Pattern Rules: Pattern
2761 `make' decides _when_ the rule applies.
2763 An implicit rule _can_ apply to any target that matches its pattern,
2766 one implicit rule appears applicable, only one applies; the choice
2769 By contrast, a static pattern rule applies to the precise list of
2770 targets that you specify in the rule. It cannot apply to any other
2774 The static pattern rule can be better than an implicit rule for these
2777 * You may wish to override the usual implicit rule for a few files
2783 might lead `make' to use the wrong implicit rule. The choice
2784 might depend on the order in which the implicit rule search is
2786 rule applies to precisely the targets specified.
2796 when the same target appears in more than one rule.
2801 double-colon rule's commands are executed if the target is older than
2802 any prerequisites of that rule. If there are no prerequisites for that
2803 rule, its commands are always executed (even if the target already
2808 separate from one another. Each double-colon rule is processed
2821 Each double-colon rule should specify commands; if it does not, an
2822 implicit rule will be used if one applies. *Note Using Implicit Rules:
2837 You need this rule so that `make' knows that it must remake `main.o'
2859 rule search. This means that `make' won't ever remove the file after
2880 Here is the pattern rule to generate a file of prerequisites (i.e.,
2911 Once you've defined the rule to remake the `.d' files, you then use
2937 The commands of a rule consist of one or more shell command lines to be
2939 result of executing these commands is that the target of the rule is
2975 tab and appears in a "rule context" (that is, after a rule has been
2976 started until another rule or variable definition) will be considered a
2977 command line for that rule. Blank lines and lines of just comments may
2989 * A variable definition in a "rule context" which is indented by a
2995 Conditionals: Conditional Syntax.) in a "rule context" which is
3157 all commands started with `@'. A rule in the makefile for the special
3369 in a new shell; after the last command line is finished, the rule is
3373 the current rule, and perhaps on all rules.
3392 are ignored in all commands of all rules. A rule in the makefile for
3534 rule alters the effects of the `-t' (`--touch'), `-n' (`--just-print'),
3552 line of a rule contains the variable `MAKE', the flags `-t', `-n' and
3662 `make', you can write a rule for the special target
3854 prerequisite of whichever rule uses the canned sequence. The output
3856 output to the rule's target file name.
3859 commands of a rule. You can substitute it like any other variable
3872 practice because `make' has an implicit rule to figure out these
3877 as if the line appeared on its own in the rule, preceded by a tab. In
3893 to a canned sequence apply to every line in the sequence. So the rule:
4016 rule
4395 * Several "automatic" variables are given new values for each rule.
4439 rule; these are called the "automatic" variables (*note Automatic
4835 lines will be used as the command for a rule. The result is that
5032 begins with a tab, it will be considered a command for a rule.) Aside
5892 the commands for each rule (*note Automatic Variables::).
6123 program or programs they describe. If the first rule in the makefile
6124 has several targets, only the first target in the rule becomes the
6169 which has a rule in the makefile but is not a prerequisite of the
6289 Other lines in the same rule are not run unless they too begin with `+'
6499 Prints messages describing the implicit rule searches for
6618 rule for `.SUFFIXES', and then define your own suffix rules. Note
6625 Eliminate use of the built-in rule-specific variables (*note
6704 For example, there is an implicit rule for C compilation. File names
6707 the implicit rule for C compilation when it sees this combination of
6715 way the implicit rule works. For example, the variable `CFLAGS'
6716 controls the flags given to the C compiler by the implicit rule for C
6727 * Using Implicit:: How to use an existing implicit rule
6735 * Suffix Rules:: The old-fashioned style of implicit rule.
6747 write a rule with no command lines, or don't write a rule at all. Then
6748 `make' will figure out which implicit rule to use based on which kind
6756 Because you mention `foo.o' but do not give a rule for it, `make' will
6757 automatically look for an implicit rule that tells how to update it.
6760 If an implicit rule is found, it can supply both commands and one or
6761 more prerequisites (the source files). You would want to write a rule
6763 prerequisites, such as header files, that the implicit rule cannot
6766 Each implicit rule has a target pattern and prerequisite patterns.
6770 on. The rule that actually applies is the one whose prerequisites
6775 Of course, when you write the makefile, you know which implicit rule
6781 Above, we said an implicit rule applies if the required
6784 if an implicit rule can be recursively found for how to make it. When
6785 an implicit prerequisite is the result of another implicit rule, we say
6789 In general, `make' searches for an implicit rule for each target, and
6790 for each double-colon rule, that has no commands. A file that is
6791 mentioned only as a prerequisite is considered a target whose rule
6792 specifies nothing, so implicit rule search happens for it. *Note
6796 Note that explicit prerequisites do not influence implicit rule
6797 search. For example, consider this explicit rule:
6802 remake `foo.o' according to the implicit rule to make an object file, a
6804 `foo.c' also exists, the implicit rule to make an object file from a C
6805 source file is used instead, because it appears before the Pascal rule
6809 If you do not want an implicit rule to be used for a target that has
6822 canceling or overriding an implicit rule. The `-r' or
6875 `N.f' is made automatically from `N.r' or `N.F'. This rule runs
6903 This rule does the right thing for a simple program with only one
6953 list of implicit rule suffixes with:
7010 `make' follows the convention that the rule to compile a `.X' source
7011 file uses the variable `COMPILE.X'. Similarly, the rule to produce an
7012 executable from a `.X' file uses `LINK.X'; and the rule to preprocess a
7015 Every rule that produces an object file uses the variable
7043 compilations performed by the implicit rule. By redefining `CFLAGS' to
7200 make `N.c', the rule for running Yacc is used. Ultimately both `N.c'
7207 if it had been mentioned in the makefile, along with the implicit rule
7240 You can list the target pattern of an implicit rule (such as `%.o')
7250 No single implicit rule can appear more than once in a chain. This
7254 search for an implicit rule chain.
7257 would otherwise be handled by rule chains. For example, making `foo'
7260 actually happens is that a special rule for this case does the
7261 compilation and linking with a single `cc' command. The optimized rule