make: Empty Targets

1 
1 4.8 Empty Target Files to Record Events
1 =======================================
1 
1 The "empty target" is a variant of the phony target; it is used to hold
1 recipes for an action that you request explicitly from time to time.
1 Unlike a phony target, this target file can really exist; but the file's
1 contents do not matter, and usually are empty.
1 
1    The purpose of the empty target file is to record, with its
1 last-modification time, when the rule's recipe was last executed.  It
1 does so because one of the commands in the recipe is a 'touch' command
1 to update the target file.
1 
1    The empty target file should have some prerequisites (otherwise it
1 doesn't make sense).  When you ask to remake the empty target, the
1 recipe is executed if any prerequisite is more recent than the target;
1 in other words, if a prerequisite has changed since the last time you
1 remade the target.  Here is an example:
1 
1      print: foo.c bar.c
1              lpr -p $?
1              touch print
1 
1 With this rule, 'make print' will execute the 'lpr' command if either
1 source file has changed since the last 'make print'.  The automatic
11 variable '$?' is used to print only those files that have changed (⇒
 Automatic Variables).
1