Target attributes are properties given to targets. Attributes can be either positive or negative, for example, .ATTRIBUTE and .NOATTRIBUTE.
Attributes are given to targets on dependency lines, but there are two forms:
target [ ... ] [ attribute ... ] : [ dependencies ... ]
attribute [ ... ] : [ target ... ]
Each form assigns the attributes to the indicated targets. The first form places the attributes after the targets and before the colon, and each target is given all attributes.
The second form has attributes only to the left of the colon and targets to the right. Each target is given all attributes. If no targets are listed, the attributes are given to all targets defined in the makefile after this line. This is very useful. To give all targets in a makefile an attribute, put a line of this form before any other dependency lines. This example that gives all targets defined after this line the .PRECIOUS attribute:
.PRECIOUS : |
(near the top of the makefile) |
Inference rules can have attributes, and the target being made with the inference rule inherits the additional attributes of the rule.
A target's attributes have a higher precedence than a rule's attributes. If a target and a rule specify an inconsistent attribute, the target's attribute is accepted.
Table 16 lists attributes and their definitions.
Attribute | Definition |
---|---|
.ALWAYS | Always rebuilds this target, regardless of the results of configuration lookup or the time stamps of its dependencies. The -a command-line option is equivalent to an .ALWAYS attribute for each target in the makefile. |
.CHAIN | Enables chaining of inference rules. (See Multiple-Step Inference Rules.) .NOCHAIN disables chaining, which may increase processing speed slightly. |
.DEFAULT | When omake is run without specifying any targets on the command line, the first target (the default target) is built. The lack of user control of the default target makes it difficult to write generalized makefiles that can be included by other makefiles. The .NODEFAULT attribute indicates that this target is not the default target. Use .NODEFAULT for all non-rule targets in included, generalized makefiles. That way a makefile can include the generalized makefile without having the first target of the generalized makefile be the default target. In the generalized makefile you can put .NODEFAULT as the attribute of each target, or put .NODEFAULT : at the top of the generalized makefile and .DEFAULT : at the bottom. Note that targets defined in make.ini or in makefiles included from make.ini are never the default target. |
.IGNORE | When making a target, a build script that returns a nonzero status causes omake to terminate unless the target has the .IGNORE attribute. The -i command-line option is equivalent to a .IGNORE attribute for all targets. The status of individual build scripts can be ignored with the dash (-) shell-line prefix. |
.INFER | omake uses inference rules to look for the inferred dependency for targets that have no build scripts. To omit, the inference rule check for targets without build scripts, give them the .NOINFER attribute. To force the inference rule check for targets with build scripts, give them the .INFER attribute. |
.MAKE | Overrides the -n and -q command-line options. It is useful when executing omake recursively. For example: nt .MAKE : If you execute omake -n nt, omake changes directory into nt.dir and executes omake -n. Without this attribute, the result is to display ( cd nt.dir ; omake $(MFLAGS) ) Similarly, omake -q nt changes directory and execute of omake -q. |
.NOCMP_NON_MF_DEPS : tgt ... | Builds the specified targets as if the -G option were specified; for each specified target, any dependency not explicitly declared in the makefile is not used in configuration lookup. |
.NOCONFIG_REC : tgt ... | Builds the specified targets as if the -L option were specified; modification time is used for build avoidance, and no CRs or derived objects are created. |
.PRECIOUS | When a build script returns a nonzero status, omake checks whether the current target has been written. If it has, omake deletes the target, which prevents corrupted files from being used. This attribute prevents the deletion of the target itself and of chained targets. |
.RULE | Is set when the percent sign appears on a dependency line. You can use the .NORULE attribute to allow a target with % in its name. |
.SILENT | A target's build scripts are displayed before being executed unless the target has the .SILENT attribute. The -s command-line option is equivalent to a .SILENT attribute for every target in the makefile. The @ shell-line prefix also prevents display of the build script. |
Feedback on the documentation in this site? We welcome any comments!
Copyright © 2001 by Rational Software Corporation. All rights reserved. |