* doc/make.texi: [SV 35455] Add more uses for Empty Recipes.

This commit is contained in:
Paul Smith 2016-02-28 12:35:15 -05:00
parent 168f12375d
commit b754a35df7

View file

@ -4970,27 +4970,24 @@ beginning with a recipe prefix character to define an empty recipe,
but this would be confusing because such a line looks empty. but this would be confusing because such a line looks empty.
@findex .DEFAULT@r{, and empty recipes} @findex .DEFAULT@r{, and empty recipes}
You may be wondering why you would want to define a recipe that You may be wondering why you would want to define a recipe that does
does nothing. The only reason this is useful is to prevent a target nothing. One reason this is useful is to prevent a target from
from getting implicit recipes (from implicit rules or the getting implicit recipes (from implicit rules or the @code{.DEFAULT}
@code{.DEFAULT} special target; @pxref{Implicit Rules} and special target; @pxref{Implicit Rules} and @pxref{Last Resort,
@pxref{Last Resort, ,Defining Last-Resort Default Rules}).@refill ,Defining Last-Resort Default Rules}).@refill
@c !!! another reason is for canonical stamp files: Empty recipes can also be used to avoid errors for targets that will
@ignore be created as a side-effect of another recipe: if the target does not
@example exist the empty recipe ensures that @code{make} won't complain that it
foo: stamp-foo ; doesn't know how to build the target, and @code{make} will assume the
stamp-foo: foo.in target is out of date.
create foo frm foo.in
touch $@
@end example
@end ignore
You may be inclined to define empty recipes for targets that are You may be inclined to define empty recipes for targets that are not
not actual files, but only exist so that their prerequisites can be actual files, but only exist so that their prerequisites can be
remade. However, this is not the best way to do that, because the 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. prerequisites may not be remade properly if the target file actually
@xref{Phony Targets, ,Phony Targets}, for a better way to do this. does exist. @xref{Phony Targets, ,Phony Targets}, for a better way to
do this.
@node Using Variables, Conditionals, Recipes, Top @node Using Variables, Conditionals, Recipes, Top
@chapter How to Use Variables @chapter How to Use Variables