make: Empty Recipes

1 
1 5.9 Using Empty Recipes
1 =======================
1 
1 It is sometimes useful to define recipes which do nothing.  This is done
1 simply by giving a recipe that consists of nothing but whitespace.  For
1 example:
1 
1      target: ;
1 
1 defines an empty recipe for 'target'.  You could also use a line
1 beginning with a recipe prefix character to define an empty recipe, but
1 this would be confusing because such a line looks empty.
1 
1    You may be wondering why you would want to define a recipe that does
1 nothing.  One reason this is useful is to prevent a target from getting
1 implicit recipes (from implicit rules or the '.DEFAULT' special target;
DONTPRINTYET 1 ⇒Implicit Rules and *noteDefining Last-Resort Default Rules:
1DONTPRINTYET 1 ⇒Implicit Rules and ⇒Defining Last-Resort Default Rules

 Last Resort.).
1 
1    Empty recipes can also be used to avoid errors for targets that will
1 be created as a side-effect of another recipe: if the target does not
1 exist the empty recipe ensures that 'make' won't complain that it
1 doesn't know how to build the target, and 'make' will assume the target
1 is out of date.
1 
1    You may be inclined to define empty recipes for targets that are not
1 actual files, but only exist so that their prerequisites can be remade.
1 However, this is not the best way to do that, because the prerequisites
1 may not be remade properly if the target file actually does exist.
1 ⇒Phony Targets Phony Targets, for a better way to do this.
1