GNU make manual 翻译(六十五)

继续翻译


   This is marginally more exciting, but the true power of this feature only becomes apparent when you discover that secondary expansions  always take place within the scope of the automatic variables for that  target.  This means that you can use variables such as `$@', `$*', etc.  during the second expansion and they will have their expected values,  just as in the recipe.  All you have to do is defer the expansion by  escaping the `$'.  Also, secondary expansion occurs for both explicit  and implicit (pattern) rules.  Knowing this, the possible uses for this feature increase dramatically.  For example:    

这是更加边缘化更加令人兴奋的,但是这个功能的真正威力只是在于 二次扩展发生在此目的的自动变量的范畴的时候。

这意味着,你可以使用 诸如 $@, $* 等变量。在二次扩展期间,它们将获得自己在片段中的扩展值。

所有你需要做的就是用 $来推迟其扩展。

并且,二次扩展既可对显式也可对隐式规则起作用。

了解了这一点,对此功能可行的利用大规模扩大了。例如:

后文待续

posted @ 2012-09-17 13:06  健哥的数据花园  阅读(167)  评论(0编辑  收藏  举报