Lines Matching refs:rule
40 You define an implicit rule by writing a "pattern rule". A pattern
41 rule looks like an ordinary rule, except that its target contains the
48 Thus, a pattern rule `%.o : %.c' says how to make any file `STEM.o'
74 A pattern rule contains the character `%' (exactly one of them) in the
75 target; otherwise, it looks exactly like an ordinary rule. The target
85 `%' in a prerequisite of a pattern rule stands for the same stem
87 rule to apply, its target pattern must match the file name under
92 Thus, a rule of the form
100 prerequisite attaches to every file made by this pattern rule. These
103 A pattern rule need not have any prerequisites that contain `%', or
104 in fact any prerequisites at all. Such a rule is effectively a general
110 and commands. If a pattern rule has multiple targets, `make' knows that
111 the rule's commands are responsible for making all of the targets. The
113 for a pattern rule to match a target, the target patterns of a rule
114 other than the one that matches the target in need of a rule are
123 a rule whose prerequisites actually exist or are mentioned always takes
124 priority over a rule with prerequisites that must be made by chaining
134 First, the rule that compiles `.c' files into `.o' files:
139 defines a rule that can make any file `X.o' from `X.c'. The command
141 the target file and the source file in each case where the rule applies
144 Here is a second built-in rule:
149 defines a rule that can make any file `X' whatsoever from a
151 is `%', this rule will apply to any file whatever, provided the
152 appropriate prerequisite file exists. The double colon makes the rule
156 This pattern rule has two targets:
177 Suppose you are writing a pattern rule to compile a `.c' file into a
180 because the name is different each time the implicit rule is applied.
183 variables". These variables have values computed afresh for each rule
184 that is executed, based on the target and prerequisites of the rule.
191 the target list of a rule; they have no value there and will expand to
193 prerequisite list of a rule. A common mistake is attempting to use
202 The file name of the target of the rule. If the target is an
204 pattern rule that has multiple targets (*note Introduction to
206 target caused the rule's commands to be run.
216 commands from an implicit rule, this will be the first
217 prerequisite added by the implicit rule (*note Implicit Rules::).
245 The stem with which an implicit rule matches (*note How Patterns
250 In a static pattern rule, the stem is part of the file name that
253 In an explicit rule, there is no stem; so `$*' cannot be determined
262 If the target name in an explicit rule does not end with a
263 recognized suffix, `$*' is set to the empty string for that rule.
268 files. This rule copies just the changed object files into the archive:
349 `test.o', the stem is `test'. The pattern rule prerequisites are
359 file names generated from the pattern rule's prerequisite patterns and
361 finding an implicit rule to use, not in the application of that rule.
374 When a pattern rule's target is just `%', it matches any file name
377 because it must consider every such rule for each file name listed
394 that can be applied, and each time you define a match-anything rule you
395 must choose one or the other for that rule.
397 One choice is to mark the match-anything rule as "terminal" by
398 defining it with a double colon. When a rule is terminal, it does not
401 words, no further chaining is allowed beyond a terminal rule.
411 If you do not mark the match-anything rule as terminal, then it is
412 nonterminal. A nonterminal match-anything rule cannot apply to a file
414 specific type of data if some non-match-anything implicit rule target
418 rule `%.c : %.y' (the rule to run Yacc). Regardless of whether this
419 rule is actually applicable (which happens only if there is a file
434 implicit rule
452 You can override a built-in implicit rule (or one you have defined
453 yourself) by defining a new pattern rule with the same target and
454 prerequisites, but different commands. When the new rule is defined,
455 the built-in one is replaced. The new rule's position in the sequence
456 of implicit rules is determined by where you write the new rule.
458 You can cancel a built-in implicit rule by defining a pattern rule
460 the following would cancel the rule that runs the assembler:
470 You can define a last-resort implicit rule by writing a terminal
471 match-anything pattern rule with no prerequisites (*note Match-Anything
472 Rules::). This is just like any other pattern rule; the only thing
473 special about it is that it will match any target. So such a rule's
475 commands of their own and for which no other implicit rule applies.
489 do this by writing a rule for the target `.DEFAULT'. Such a rule's
491 in any explicit rule, and for which no implicit rule applies.
492 Naturally, there is no `.DEFAULT' rule unless you write one.
502 pattern rule or `.DEFAULT', but you also do not want any commands to be
506 You can use a last-resort rule to override part of another makefile.
521 A double-suffix rule is defined by a pair of suffixes: the target
525 two-suffix rule whose target and source suffixes are `.o' and `.c' is
526 equivalent to the pattern rule `%.o : %.c'.
528 A single-suffix rule is defined by a single suffix, which is the
531 single-suffix rule whose source suffix is `.c' is equivalent to the
532 pattern rule `% : %.c'.
534 Suffix rule definitions are recognized by comparing each rule's
536 rule whose target is a known suffix, this rule is considered a
537 single-suffix rule. When `make' sees a rule whose target is two known
538 suffixes concatenated, this rule is taken as a double-suffix rule.
541 suffixes. Therefore, if you define a rule whose target is `.c.o',
542 `make' takes it to be a double-suffix rule with source suffix `.c' and
543 target suffix `.o'. Here is the old-fashioned way to define the rule
551 suffix rules. Thus, the rule:
557 and is not at all like the pattern rule:
563 files using this pattern rule also depend on `foo.h'.
572 rule for `.SUFFIXES' that adds more prerequisites, as in:
579 adding to them, write a rule for `.SUFFIXES' with no prerequisites. By
581 `.SUFFIXES'. You can then write another rule to add the suffixes you
592 with a rule for the special target `.SUFFIXES', but that does not alter
601 Here is the procedure `make' uses for searching for an implicit rule
602 for a target T. This procedure is followed for each double-colon rule
604 commands, and for each prerequisite that is not the target of any rule.
615 rule.
625 3. If any rule in that list is _not_ a match-anything rule, then
630 5. For each pattern rule in the list:
644 prerequisites, then this rule applies.
646 6. If no pattern rule has been found so far, try harder. For each
647 pattern rule in the list:
649 a. If the rule is terminal, ignore it and go on to the next rule.
657 by an implicit rule.
660 implicit rules, then this rule applies.
662 7. If no implicit rule applies, the rule for `.DEFAULT', if any,
666 Once a rule that applies has been found, for each target pattern of
667 the rule other than the one that matched T or N, the `%' in the pattern
674 When the commands of a pattern rule are executed for T, the automatic
691 * Archive Update:: The implicit rule for archive member targets.
693 * Archive Suffix Rules:: You can write a special kind of suffix rule
713 must use `ar'. For example, this rule says to create a member `hack.o'
720 way and there is an implicit rule to do it for you. *Please note:* The
747 When `make' looks for an implicit rule for such a target, as a
751 This causes one special rule whose target is `(%)' to match. This
752 rule updates the target `A(M)' by copying the file M into the archive.
757 When this rule is chained with others, the result is very powerful.
803 Normally you would put this command in the rule for the archive file,
804 and make all the members of the archive file prerequisites of that rule.
813 likely you can omit them and use the implicit rule which copies files
841 You can write a special kind of suffix rule for dealing with archive
847 To write a suffix rule for archives, you simply write a suffix rule
849 example, here is the old-fashioned suffix rule to update a library
857 This works just as if you had written the pattern rule:
864 In fact, this is just what `make' does when it sees a suffix rule
865 with `.a' as the target suffix. Any double-suffix rule `.X.a' is
866 converted to a pattern rule with the target pattern `(%.o)' and a
871 the normal way (*note Suffix Rules::). Thus a double-suffix rule
924 general feature of rule chaining (*note Chains of Implicit Rules:
925 Chained Rules.) allows one pattern rule for installing members in
1096 For example, the suffix rule `.c~.o' would make the file `N.o' from
1103 general feature of rule chaining. *Note Chains of Implicit Rules:
1113 prerequisites of a rule has the amazingly strange "feature" of
1119 * In some Unix `make's, implicit rule search (*note Using Implicit
1136 * It appears that in SVR4 `make', a suffix rule can be specified with
1142 will override the built-in `.c.a' suffix rule.
1144 We feel that it is cleaner for a rule without commands to always
1176 rule: normal, pre-install and post-install.
1213 `configure'. A rule of the form:
1237 to make the rule work well. For example, the target above for `foo.1'
1274 The compression program `gzip' can be used in the `dist' rule.
1335 `YFLAGS' for yacc, and `LFLAGS' for lex, are exceptions to this rule,
1346 by defining an implicit rule, like this:
1699 should write the `install' rule to create these subdirectories.
1735 If possible, write the `install' target rule so that it does not
1757 Here is a sample rule to install an Info file:
1804 This rule should not modify the directories where compilation is
1868 `configure' can be remade using a rule in the Makefile. More
1908 the Make rule for an info file should update it in the source
1917 Here's an example rule for generating DVI files from Texinfo:
1979 can use a rule like this:
1998 This rule should not modify the directories where compilation is
2038 To classify the commands in the `install' rule into these three
2057 rule, all the commands are classified as normal until the first category
2357 The stem with which an implicit rule matches (*note How Patterns
2476 but the rule in the makefile was prefixed with the `-' special
2496 `missing rule before commands. Stop.'
2504 left out the "target: prerequisite" section of a rule. *Note Rule
2507 `No rule to make target `XXX'.'
2508 `No rule to make target `XXX', needed by `YYY'.'
2514 If you want that file to be built, you will need to add a rule to
2569 means there's no pattern in the target section of the rule; the
2573 pattern rule contain pattern characters (`%')-only the first two
2588 `warning: jobserver unavailable: using -j1. Add `+' to parent make rule.'
3516 * archive, suffix rule for: Archive Suffix Rules.
3522 * assembly, rule to compile: Catalogue of Rules. (line 79)
3542 * C++, rule to compile: Catalogue of Rules. (line 39)
3543 * C, rule to compile: Catalogue of Rules. (line 35)
3655 * explicit rule, definition of: Makefile Contents. (line 10)
3656 * explicit rule, expansion: Reading Makefiles. (line 62)
3694 * Fortran, rule to compile: Catalogue of Rules. (line 49)
3721 * implicit rule: Implicit Rules. (line 6)
3722 * implicit rule, and directory search: Implicit/Search. (line 6)
3723 * implicit rule, and VPATH: Implicit/Search. (line 6)
3724 * implicit rule, definition of: Makefile Contents. (line 16)
3725 * implicit rule, expansion: Reading Makefiles. (line 62)
3726 * implicit rule, how to use: Using Implicit. (line 6)
3727 * implicit rule, introduction to: make Deduces. (line 6)
3728 * implicit rule, predefined: Catalogue of Rules. (line 6)
3729 * implicit rule, search algorithm: Implicit Rule Search.
3739 * Info, rule to format: Catalogue of Rules. (line 158)
3754 * Lex, rule to run: Catalogue of Rules. (line 124)
3756 * library archive, suffix rule for: Archive Suffix Rules.
3761 * linking, predefined rule for: Catalogue of Rules. (line 86)
3764 * lint, rule to run: Catalogue of Rules. (line 146)
3779 * makefile rule parts: Rule Introduction. (line 6)
3797 * match-anything rule: Match-Anything Rules.
3799 * match-anything rule, used to override: Overriding Makefiles.
3804 * Modula-2, rule to compile: Catalogue of Rules. (line 74)
3809 * multiple targets, in pattern rule: Pattern Intro. (line 49)
3838 * parts of makefile rule: Rule Introduction. (line 6)
3839 * Pascal, rule to compile: Catalogue of Rules. (line 45)
3840 * pattern rule: Pattern Intro. (line 6)
3841 * pattern rule, expansion: Reading Makefiles. (line 62)
3900 * Ratfor, rule to compile: Catalogue of Rules. (line 49)
3901 * RCS, rule to extract from: Catalogue of Rules. (line 164)
3945 * rule commands: Commands. (line 6)
3946 * rule prerequisites: Rule Syntax. (line 46)
3947 * rule syntax: Rule Syntax. (line 6)
3948 * rule targets: Rule Syntax. (line 18)
3949 * rule, double-colon (::): Double-Colon. (line 6)
3950 * rule, explicit, definition of: Makefile Contents. (line 10)
3951 * rule, how to write: Rules. (line 6)
3952 * rule, implicit: Implicit Rules. (line 6)
3953 * rule, implicit, and directory search: Implicit/Search. (line 6)
3954 * rule, implicit, and VPATH: Implicit/Search. (line 6)
3955 * rule, implicit, chains of: Chained Rules. (line 6)
3956 * rule, implicit, definition of: Makefile Contents. (line 16)
3957 * rule, implicit, how to use: Using Implicit. (line 6)
3958 * rule, implicit, introduction to: make Deduces. (line 6)
3959 * rule, implicit, predefined: Catalogue of Rules. (line 6)
3960 * rule, introduction to: Rule Introduction. (line 6)
3961 * rule, multiple for one target: Multiple Rules. (line 6)
3962 * rule, no commands or prerequisites: Force Targets. (line 6)
3963 * rule, pattern: Pattern Intro. (line 6)
3964 * rule, static pattern: Static Pattern. (line 6)
3965 * rule, static pattern versus implicit: Static versus Implicit.
3967 * rule, with multiple targets: Multiple Targets. (line 6)
3970 * SCCS, rule to extract from: Catalogue of Rules. (line 173)
3971 * search algorithm, implicit rule: Implicit Rule Search.
3997 * several targets in a rule: Multiple Targets. (line 6)
4029 * static pattern rule: Static Pattern. (line 6)
4030 * static pattern rule, syntax of: Static Usage. (line 6)
4031 * static pattern rule, versus implicit: Static versus Implicit.
4045 * suffix rule: Suffix Rules. (line 6)
4046 * suffix rule, for archive: Archive Suffix Rules.
4067 * target, multiple in pattern rule: Pattern Intro. (line 49)
4080 * terminal rule: Match-Anything Rules.
4086 * TeX, rule to run: Catalogue of Rules. (line 151)
4089 * Texinfo, rule to format: Catalogue of Rules. (line 158)
4109 * variables, and implicit rule: Automatic Variables. (line 6)
4149 * Web, rule to run: Catalogue of Rules. (line 151)
4172 * writing rule commands: Commands. (line 6)
4177 * Yacc, rule to run: Catalogue of Rules. (line 120)