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。

后文待续

你可能感兴趣的:(Make)