Section 19.7. Other Target Attributes


19.7. Other Target Attributes

There are also other attributes that you can assign to certain targets in a makefile by making those targets prerequisites of other built-in targets like .PHONY. The most important of these built-in targets are listed here. Other special built-in targets that can be used in makefiles to alter make's runtime behavior in general are listed at the end of this chapter.


.PHONY

Any targets that are prerequisites of .PHONY are always treated as out of date.


.PRECIOUS

Normally, if you interrupt make while running a command scriptif make receives any fatal signal, to be more precisemake deletes the target it was building before it exits. Any target you declare as a prerequisite of .PRECIOUS is not deleted in such cases, however.

Furthermore, when make builds a target by concatenating implicit rules, it normally deletes any intermediate files that it creates by one such rule as prerequisites for the next. However, if any such file is a prerequisite of .PRECIOUS (or matches a pattern that is a prerequisite of .PRECIOUS), make does not delete it.


.INTERMEDIATE

Ordinarily, when make needs to build a target whose prerequisites do not exist, it searches for an appropriate rule to build them first. If the absent prerequisites are not named anywhere in the makefile, and make has to resort to implicit rules to build them, then they are called intermediate files. make deletes any intermediate files after building its intended target (see the section "Implicit Rule Chains," earlier in this chapter). If you want certain files to be treated in this way even though they are mentioned in your makefile, declare them as prerequisites of .INTERMEDIATE.


.SECONDARY

Like .INTERMEDIATE, except that make does not automatically delete files that are prerequisites of .SECONDARY.

You can also put .SECONDARY in a makefile with no prerequisites at all. In this case, make treats all targets as prerequisites of .SECONDARY.


.IGNORE

For any target that is a prerequisite of .IGNORE, make ignores any errors that occur in executing the commands to build that target. .IGNORE itself does not take a command script.

You can also put .IGNORE in a makefile with no prerequisites at all, although it is probably not a good idea. If you do, make ignores all errors in running any command script.


.LOW_RESOLUTION_TIME

On some systems, the timestamps on files have resolution of less than a second, yet certain programs create timestamps that reflect only full seconds. If this behavior causes make to misjudge the relative ages of files on your system, you can declare any file with low-resolution timestamps as a prerequisite of .LOW_RESOLUTION_TIME. Then make considers the file up to date if its timestamp indicates the same whole second in which its prerequisite was stamped. Members of library archives are automatically treated as having low-resolution timestamps.

A few other built-in targets act like general runtime options, affecting make's overall behavior just by appearing in a makefile. These are listed in the section "Running make," later in this chapter.



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net