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

    继续翻译

    6.9 Undefining Variables
    ========================
    
    If you want to clear a variable, setting its value to empty is usually
    sufficient. Expanding such a variable will yield the same result (empty
    string) regardless of whether it was set or not. However, if you are
    using the `flavor' (*note Flavor Function::) and `origin' (*note Origin
    Function::) functions, there is a difference between a variable that
    was never set and a variable with an empty value.  In such situations
    you may want to use the `undefine' directive to make a variable appear
    as if it was never set. For example:
    
         foo := foo
         bar = bar
    
         undefine foo
         undefine bar
    
         $(info $(origin foo))
         $(info $(flavor bar))
    
       This example will print "undefined" for both variables.
    
       If you want to undefine a command-line variable definition, you can
    use the `override' directive together with `undefine', similar to how
    this is done for variable definitions:
    
         override undefine CFLAGS

    6.9 取消变量定义
    ========================

    如果你想要清除一个变量,设置它的值为空通常是有效率的。扩展这样一个变量将会达到同样的效果(空串),无论它是否被设置了。但是如果你正在使用 flavor(*note Flavor Function::)或origin(*note Origin Function::)函数,对一个从没有设置过的变量和有一个空值的变量会有区别。在这种场合下,你也许想要使用 undefine 指令来使得一个变量看上去就好像从来没有设置过。例如:

    foo := foo
    bar = bar

    undefine foo
    undefine bar

    $(info $(origin foo))
    $(info $(flavor bar))

    这个例子会给两个变量都打印出 "undefined"。

    如果你想要取消一个命令行变量的定义,你可以将override 指令和 undefine结合使用,和如何为变量定义反向操作的做法类似:

    override undefine CFLAGS

    后文待续

  • 相关阅读:
    APICloud学习笔记之图片缓存
    正则表达式笔记01
    hahah
    panel 绑定鼠标滚轮事件
    C#无边框窗体移动 将事件绑定到想实现的控件上
    消消看最高分破解
    字符串补齐
    ant android打包--学习第一弹
    Windsock套接字I/O模型学习 --- 第三章
    Lua 垃圾收集机制
  • 原文地址:https://www.cnblogs.com/gaojian/p/2711523.html
Copyright © 2011-2022 走看看