1 Automatic Variables
$@ The filename representing the target.
$% The filename element of an archive member specification.
$< The filename of the first prerequi$? The names of all prerequisites that are newer than the target, separated by
spaces.
$^ The filenames of all the prerequisites, separated by spaces. This list has dupli-
cate filenames removed since for most uses, such as compiling, copying, etc.,
duplicates are not wanted.
$+ Similar to $^, this is the names of all the prerequisites separated by spaces,
except that $+ includes duplicates. This variable was created for specific situa-
tions such as arguments to linkers where duplicate values have meaning.
$* The stem of the target filename. A stem is typically a filename without its suffix.
(We’ll discuss how stems are computed later in the section “Pattern Rules.”) Its
use outside of pattern rules is discouraged.
2 VPATH
You can tell make to look in different directories for its source files using the VPATH
and vpath features. To fix our immediate problem, we can add a VPATH assignment to
the makefile:
VPATH = src
3 vpath
The vpath directive is a more precise way to achieve our goals. The syntax of this
directive is:
So our previous VPATH use can be rewritten as:
vpath %.c src
vpath %.h include
阅读(806) | 评论(0) | 转发(0) |