zoukankan      html  css  js  c++  java
  • GNU make manual 翻译(六十二)

    继续翻译

       If that special target is defined then in between the two phases mentioned above, right at the end of the read-in phase, all the prerequisites of the targets defined after the special target are  expanded a _second time_.  In most circumstances this secondary   expansion will have no effect, since all variable and function references will have been expanded during the initial parsing of the makefiles.  In order to take advantage of the secondary expansion phase of the parser, then, it's necessary to _escape_ the variable or function reference in the makefile.  In this case the first expansion   merely un-escapes the reference but doesn't expand it, and expansion is  left to the secondary expansion phase.  For example, consider this  
    makefile:                        
                            
         .SECONDEXPANSION:                        
         ONEVAR = onefile                        
         TWOVAR = twofile                        
         myfile: $(ONEVAR) $$(TWOVAR)                        

    如果这个特殊的 目的被定义了,那么在前面提到的两个阶段种,在读取阶段接受市,所有在此特殊目的之后的目的,都会被进行第二次扩展。

    在大多数情况下,这个二次扩展没有什么效果,因为所有的变量和函数都会在初始的解析中被扩展过了。

    为了获得解析阶段二次扩展的好处,有必要对变量或函数参照进行转义(_escape_)。

    在这种情况下,第一次扩展对参照进行反转义(un-escape),但是并不扩展它,扩展将被留在第二次扩展阶段中。例如,考虑如下的 makefile:

              .SECONDEXPANSION:

               ONEVAR =onefile

               TOWVAR = twofile

               myfile: $(ONEVAR)  $$(TWOVAR)

    后文待续

  • 相关阅读:
    英语发音-自然拼读法
    最小二乘法
    BZOJ 1650 [Usaco2006 Dec]River Hopscotch 跳石子
    洛谷 1803 凌乱的yyy
    【模板】矩阵加速(数列)
    【模板】矩阵快速幂
    洛谷 4246 BZOJ 1018 [SHOI2008]堵塞的交通
    洛谷 1276 校门外的树(增强版)
    BZOJ 1468 Tree 【模板】树上点分治
    洛谷 1501 [国家集训队]Tree II BZOJ 2631 Tree
  • 原文地址:https://www.cnblogs.com/gaojian/p/2688401.html
Copyright © 2011-2022 走看看