From b754a35df7a5bd8bffd08fde0a7dfb599cbdc235 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sun, 28 Feb 2016 12:35:15 -0500 Subject: [PATCH] * doc/make.texi: [SV 35455] Add more uses for Empty Recipes. --- doc/make.texi | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/doc/make.texi b/doc/make.texi index 86a1aebc..e8921713 100644 --- a/doc/make.texi +++ b/doc/make.texi @@ -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. @findex .DEFAULT@r{, and empty recipes} -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 -@code{.DEFAULT} special target; @pxref{Implicit Rules} and -@pxref{Last Resort, ,Defining Last-Resort Default Rules}).@refill +You may be wondering why you would want to define a recipe that does +nothing. One reason this is useful is to prevent a target from +getting implicit recipes (from implicit rules or the @code{.DEFAULT} +special target; @pxref{Implicit Rules} and @pxref{Last Resort, +,Defining Last-Resort Default Rules}).@refill -@c !!! another reason is for canonical stamp files: -@ignore -@example -foo: stamp-foo ; -stamp-foo: foo.in - create foo frm foo.in - touch $@ -@end example -@end ignore +Empty recipes can also be used to avoid errors for targets that will +be created as a side-effect of another recipe: if the target does not +exist the empty recipe ensures that @code{make} won't complain that it +doesn't know how to build the target, and @code{make} will assume the +target is out of date. -You may be inclined to define empty recipes for targets that are -not actual files, but only exist so that their prerequisites can be +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. -@xref{Phony Targets, ,Phony Targets}, for a better way to do this. +prerequisites may not be remade properly if the target file actually +does exist. @xref{Phony Targets, ,Phony Targets}, for a better way to +do this. @node Using Variables, Conditionals, Recipes, Top @chapter How to Use Variables