when you are using suffix rules (discussed
later in this article).
.DEFAULT — if you have a bunch of
targets that use the same set of commands, you may consider using the
.DEFAULT target. It is used to specify the
commands to be executed when no rule
is found for a target.
.PRECIOUS — all dependencies of the
.PRECIOUS target are preserved should
make be killed or interrupted.
.INTERMEDIATE — specifies which
targets are intermediate, or temporary,
files. Upon completion, make will delete
all intermediate files before terminating.
.SECONDARY — this target is similar
to .INTERMEDIATE, except that these
files will not be deleted automatically
upon completion. If no dependencies
are specified, all files are considered
.SECONDEXPANSION — after the
initial read-in phase, anything listed
after this target will be expanded for
a second time. So, for example:
.SECONDEXPANSION: ONEVAR = onefile TWOVAR = twofile myfile: $(ONEVAR) $$(TWOVAR)
will expand to:
.SECONDEXPANSION: ONEVAR = onefile TWOVAR = twofile myfile: onefile $(TWOVAR)
after the initial read-in phase, but
because I specified .SECONDEXPANSION,
it will expand everything following a
.SECONDEXPANSION: ONEVAR = onefile TWOVAR = twofile myfile: onefile twofile
I’m not going to elaborate on this
here, because this is a rather complex
subject and outside the scope of this
article, but you can find all sorts of
.SECONDEXPANSION goodness out there
on the Internet and in the GNU manual.
.DELETE_ON_ERROR — this target
will cause make to delete a target if it
has changed and any of the associated
commands exit with a nonzero status.
.IGNORE — if an error is encountered
while building a target list as a dependency of .IGNORE, it is ignored. If there
are no dependencies to .IGNORE, make
will ignore errors for all targets.
.LOW_RESOLUTION_TIME — for
some reason or another, if you have
files that will have a low-resolution
timestamp (missing the subsecond
portion), this target allows you to designate those files. If a file is listed as a
dependency of .LOW_RESOLUTION_TIME,
make will compare times only to the
nearest second between the target and
.SILENT — this is a legacy target
that causes the command’s output to
WWW.LINUXJOURNAL.COM SEPTEMBER 2011 | 79