GNU make manual 翻译(六十四)

简介:
继续翻译

复制代码
   Obviously, this is not a very interesting case since the same result could more easily have been achieved simply by having both variables appear, unescaped, in the prerequisites list.  One difference becomes apparent if the variables are reset; consider this example:  
     .SECONDEXPANSION:                        
     AVAR = top                        
     onefile: $(AVAR)                        
     twofile: $$(AVAR)                        
     AVAR = bottom                        
                        
   Here the prerequisite of `onefile' will be expanded immediately, and resolve to the value `top', while the prerequisite of `twofile' will not be full expanded until the secondary expansion and yield a value of  `bottom'.                        
复制代码
很显然,这并不是一个有趣的例子,以为同样的结果可以用更加简单的办法来达成:将所有变量定义好,没有转义符号。但是有一个地方是不同的,即变量被重置的时候;考虑下面的例子:

.SECONDEXPANSION: 
AVAR = top
onefile: $(AVAR)
twofile: $$(AVAR)
AVAR = bottom
这里,onefile的前提条件将立即被展开,然后解释为值 top。而twofile的前提条件就不会马上展开,而是要等到第二次扩展,此时的值已经是 bottom。

后文待续


本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/archive/2012/09/17/2688522.html,如需转载请自行联系原作者
目录
相关文章
|
Linux C语言
make: gcc:命令未找到
make: gcc:命令未找到
make: gcc:命令未找到
|
C语言 C++ Perl
如何处理错误消息Please install the gcc make perl packages
如何处理错误消息Please install the gcc make perl packages
143 0