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

    继续翻译

    6.6 Appending More Text to Variables
    ====================================
    
    Often it is useful to add more text to the value of a variable already
    defined.  You do this with a line containing `+=', like this:
    
         objects += another.o
    
    This takes the value of the variable `objects', and adds the text
    `another.o' to it (preceded by a single space).  Thus:
    
         objects = main.o foo.o bar.o utils.o
         objects += another.o
    
    sets `objects' to `main.o foo.o bar.o utils.o another.o'.
    
       Using `+=' is similar to:
    
         objects = main.o foo.o bar.o utils.o
         objects := $(objects) another.o
    
    but differs in ways that become important when you use more complex
    values.
    
       When the variable in question has not been defined before, `+=' acts
    just like normal `=': it defines a recursively-expanded variable.
    However, when there _is_ a previous definition, exactly what `+=' does
    depends on what flavor of variable you defined originally.  *Note The
    Two Flavors of Variables: Flavors, for an explanation of the two
    flavors of variables.

    6.6 给变量追加更多文本
    ====================================

    给一个已经定义好的变量追加更多的文本经常是很有用的。你可以用一行包含+=的行来做这件事。向这样:

    objects += another.o

    这将获得变量objects得值,然后把another.o 追加到它后面(前面放一个空格)。因此:

    objects = main.o foo.o bar.o utils.o
    objects += another.o

    设置 `objects' 为 `main.o foo.o bar.o utils.o another.o'。

    Using `+=' 等同于:

    objects = main.o foo.o bar.o utils.o

    objects := $(objects) another.o

    但是当你使用更加复杂的值的时候,其差异就变得重要了。

    当上述问题中的变量没有被定义的时候,+=就像通常的=: 一样,它定义了一个递归的变量。但是当变量已经有了定义,+=要做的依赖于你事前定义此变量所用的风格。关于变量两种风格,参照 *Note the Tow Flavors of Variables: Flavors

    后文待续

  • 相关阅读:
    在asyncio 中跳出正在执行的task
    运行代码框代码
    GridView单击行
    J2ME 使用HTTP网络连接实现排行榜
    Oxite的配置
    如何使用vs2005自带的sql2005
    点击右键出现导航菜单效果
    J2ME播放声音CODE
    将行为层和结构层分离 Html文档
    图片横向无缝滚动
  • 原文地址:https://www.cnblogs.com/gaojian/p/2711295.html
Copyright © 2011-2022 走看看