There is a set of variables that are automatically defined at runtime by the Make program.
$@ | expands to: target filename |
$* | expands to: target filename without its suffix |
$< | expands to: the first dependent filename |
$ˆ | expands to: all dependents of target newer than target (not implemented) |
$% | expands to: dependent member of the target archive (not implemented) |
$? | expands to: all dependents of the target archive (not implemented) |
The value of an automatic variable depends on where it is referenced. An automatic variable has a different value according to the objects of the rule to which it applies. $@ does not expand in the target position. Automatic variables making reference to dependencies do not make sense when used in the place of a target name or dependency, so they will not be defined when referenced in those situations; those variables will expand to their proper values in command lines.
If a D extension appears in the automatic variable name then only the
directory part of the value is returned. A F extension returns only
the file part of the value. Thus, $(@D)
is equivalent to
$(dir $@)
; in fact, all of these extensions are implemented as
builtin macros.