Next: Special Targets Prev: Force Targets Up: Rules
Empty Target Files to Record Events
The "empty target" is a variant of the phony target; it is used to
hold commands for an action that you request explicitly from time to
time. Unlike a phony target, this target file can really exist; but
the file's contents do not matter, and usually are empty.
The purpose of the empty target file is to record, with its
last-modification time, when the rule's commands were last executed. It
does so because one of the commands is a `touch' command to update the
The empty target file must have some dependencies. When you ask to
remake the empty target, the commands are executed if any dependency is
more recent than the target; in other words, if a dependency has
changed since the last time you remade the target. Here is an example:
print: foo.c bar.c
lpr -p $?
With this rule, `make print' will execute the `lpr' command if either
source file has changed since the last `make print'. The automatic
variable `$?' is used to print only those files that have changed
(Note: Automatic Variables.).
automatically generated by info2www