GNU make manual 翻译( 一百七十)

继续翻译

6.11 Target-specific Variable Values
====================================

Variable values in `make' are usually global; that is, they are the
same regardless of where they are evaluated (unless they're reset, of
course).  One exception to that is automatic variables (*note Automatic
Variables::).

   The other exception is "target-specific variable values".  This
feature allows you to define different values for the same variable,
based on the target that `make' is currently building.  As with
automatic variables, these values are only available within the context
of a target's recipe (and in other target-specific assignments).

   Set a target-specific variable value like this:

     TARGET ... : VARIABLE-ASSIGNMENT

   Target-specific variable assignments can be prefixed with any or all
of the special keywords `export', `override', or `private'; these apply
their normal behavior to this instance of the variable only.

   Multiple TARGET values create a target-specific variable value for
each member of the target list individually.

   The VARIABLE-ASSIGNMENT can be any valid form of assignment;
recursive (`='), static (`:='), appending (`+='), or conditional
(`?=').  All variables that appear within the VARIABLE-ASSIGNMENT are
evaluated within the context of the target: thus, any
previously-defined target-specific variable values will be in effect.
Note that this variable is actually distinct from any "global" value:
the two variables do not have to have the same flavor (recursive vs.
static).

6.11 目的特定的变量值
====================================

make中的变量的值通常是全局的,那就是说,它们无论在何被解析,都有相同的值(当然,除非它们被重新设定了)。一个例外是全局变量(*note Automatic Variables::)

令一个例外是,目的特定的变量的值。这个功能允许你为同样的变量,定义不同的值,这个值基于make正在进行构建的目的。和自动变量相仿,这些值只能在目的片段的上下文中有效(或者在其他的目的特定的赋值中)。

设置目的特定的变量的语法如下:

TARGET ... : VARIABLE-ASSIGNMENT

目的特定的变量赋之可以被用export ,override,或者 private之类的特殊关键字来做前缀; 这些仅仅作用于此变量的当前实例。

多目的的值为目的列表中的每一个成员单独创建一个目的特定的变量值。

VARIABLE-ASSIGNMENT 可以是任何有效的变量赋值;递归(=),静态(:=),连接(+=),或者条件式(?=)。所有的在 VARIABLE-ASSIGNMENT 中出现的变量都是在目的的上下文中被解析:因此,任何之前定义的目的特定的变量值都将有效。注意这个值和全局值彼此独立:这两个不需要保持同样的风格(递归 vs 静态)

后文待续

posted @ 2012-10-05 11:04  健哥的数据花园  阅读(280)  评论(0编辑  收藏  举报