Chapter 5: Writing Recipes in Rules 57
make will not echo the first line, the echo command. But it will echo the following two
recipe lines.
On the other hand, prefix characters on the recipe line that refers to a canned sequence
apply to every line in the sequence. So the rule:
frob.out: frob.in
@$(frobnicate)
does not echo any recipe lines. (See Section 5.2 [Recipe Echoing], page 43, for a full
explanation of ‘@’.)
5.9 Using Empty Recipes
It is sometimes useful to define recipes which do nothing. This is done simply by giving a
recipe that consists of nothing but whitespace. For example:
target: ;
defines an empty recipe for target. You could also use a line beginning with a recipe prefix
character to define an empty recipe, but this would be confusing because such a line looks
empty.
You may be wondering why you would want to define a recipe that does nothing. The
only reason this is useful is to prevent a target from getting implicit recipes (from implicit
rules or the .DEFAULT special target; see Chapter 10 [Implicit Rules], page 111 and see
Section 10.6 [Defining Last-Resort Default Rules], page 125).
You may be inclined to define empty recipes for targets that are not actual files, but
only exist so that their prerequisites can be remade. However, this is not the best way to
do that, because the prerequisites may not be remade properly if the target file actually
does exist. See Section 4.5 [Phony Targets], page 29, for a better way to do this.
Comentários a estes Manuais