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

本文深入探讨了Make工具中几个关键变量的功能与使用方法,包括MAKE_RESTARTS、.RECIPEPREFIX及.VARIABLES等,并提供了具体的示例说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

继续翻译

`MAKE_RESTARTS'
     This variable is set only if this instance of `make' has restarted
     (*note How Makefiles Are Remade: Remaking Makefiles.): it will
     contain the number of times this instance has restarted.  Note
     this is not the same as recursion (counted by the `MAKELEVEL'
     variable).  You should not set, modify, or export this variable.

`.RECIPEPREFIX'
     The first character of the value of this variable is used as the
     character make assumes is introducing a recipe line.  If the
     variable is empty (as it is by default) that character is the
     standard tab character.  For example, this is a valid makefile:

          .RECIPEPREFIX = >
          all:
          > @echo Hello, world

     The value of `.RECIPEPREFIX' can be changed multiple times; once
     set it stays in effect for all rules parsed until it is modified.

`.VARIABLES'
     Expands to a list of the _names_ of all global variables defined
     so far.  This includes variables which have empty values, as well
     as built-in variables (*note Variables Used by Implicit Rules:
     Implicit Variables.), but does not include any variables which are
     only defined in a target-specific context.  Note that any value
     you assign to this variable will be ignored; it will always return
     its special value.

`MAKE_RESTARTS'

只有当 make 的实例重新启动后才会被设置(*note How Makefiles Are Remade: Remaking Makefiles.): 它会包含此实例重新启动的次数。请注意这个和递归(recursion)(由MAKELEVEL来计数)不同。你无法设定,更改或者导出此变量。

`.RECIPEPREFIX'这个变量的第一个字符被用作引入一个片段行。如果此变量的值为空(缺省值),那么这个引入片段行的字符将是标准tab键。例如下面是一个有效的makefile。

.RECIPEPREFIX = >
all:
> @echo Hello, world

 `.RECIPEPREFIX' 的值可以被改变很多次; 一旦被设置就开始对所有规则有效,直到被再次改变为止。

`.VARIABLES'

扩展为一个所有全局变量的列表。其中包括拥有空值的,也包口内建的变量(*note Variables Used by Implicit Rules: Implicit Variables.),但是不包括那些仅仅在目的特定的上下文中定义的变量。请注意任何你所设的值会被忽略,它总是返回其特殊值。

后文待续

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值