|
|
If a target must be created, the sequence of commands is executed. Normally, each command line is printed and then passed to a separate invocation of the shell after substituting for macros. The printing is suppressed in the silent mode (-s option of the make command) or if the command line in the description file begins with an ``@'' sign. make normally stops if any command signals an error by returning a nonzero error code. Errors are ignored if the -i flag has been specified on the make command line, if the fake target name .IGNORE appears in the description file, or if the command string in the description file begins with a hyphen (-). If a program is known to return a meaningless status, a hyphen in front of the command that invokes it is appropriate. Because each command line is passed to a separate invocation of the shell, care must be taken with certain commands (cd and shell control commands, for instance) that have meaning only within a single shell process. These results are forgotten before the next line is executed.
Before issuing any command, certain internally maintained
macros are set.
The $@ macro is set to the full target name
of the current target.
The $@ macro is
evaluated only for explicitly
named dependencies.
The $? macro is set to the
string of names
that were found to be younger than the target.
The $? macro is evaluated when explicit rules from the
makefile are evaluated.
If the command was
generated by an implicit rule, the $< macro is
the name of the
related file that caused the action; and the $ macro
is the
prefix shared by the current and the dependent file names.
If a file must be made but there are no explicit commands
or relevant
built-in rules,
the commands associated with the name
.DEFAULT
are used.
If there is no such name,
make
prints a message and stops.
In addition, a description file may also use
the following related
macros: $(@D), $(@F), $(D), $(
F),
$(<D), and $(<F) (see below).