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 target file.
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.
Use the following as an example.
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 (see Automatic
variables).