GNU make manual 翻译( 一百五十七)

继续翻译

6.3.2 Computed Variable Names
-----------------------------

Computed variable names are a complicated concept needed only for
sophisticated makefile programming.  For most purposes you need not
consider them, except to know that making a variable with a dollar sign
in its name might have strange results.  However, if you are the type
that wants to understand everything, or you are actually interested in
what they do, read on.

   Variables may be referenced inside the name of a variable.  This is
called a "computed variable name" or a "nested variable reference".
For example,

     x = y
     y = z
     a := $($(x))

defines `a' as `z': the `$(x)' inside `$($(x))' expands to `y', so
`$($(x))' expands to `$(y)' which in turn expands to `z'.  Here the
name of the variable to reference is not stated explicitly; it is
computed by expansion of `$(x)'.  The reference `$(x)' here is nested
within the outer variable reference.

6.3.2 被计算的变量名
-----------------------------

被计算的变量名是一个复杂的概念,仅当复杂的makefile编程时才需要使用。在大多数的时候你不需要考虑,除了要知道在一个变量名中包含一个美元符号可能会导致奇怪的结果。但是,如果你是那些想要了解所有的东西的类型,或者确实对此感兴趣的人,请继续阅读。

变量可以在变量名中被参照。这被称为 "被计算的变量名"或者"嵌套变量参照"。例如,

x = y
y = z
a := $($(x))

把'a' 定义为'z': `$($(x))' 中的 '$(X) 扩展为 `y', 因此
`$($(x))' 扩展为 `$(y)' ,进而扩展为 `z'。这里要参照的变量名字没有显式地给出;
它是由$(X)计算而得出的。对`$(x)' 的参照嵌入到外层变量参照中。

后文待续

原文地址:https://www.cnblogs.com/gaojian/p/2710957.html