GNU make manual 翻译( 一百八十二)
继续翻译
`ifdef VARIABLE-NAME' The `ifdef' form takes the _name_ of a variable as its argument, not a reference to a variable. The value of that variable has anon-empty value, the TEXT-IF-TRUE is effective; otherwise, theTEXT-IF-FALSE, if any, is effective. Variables that have neverbeen defined have an empty value. The text VARIABLE-NAME isexpanded, so it could be a variable or function that expands tothe name of a variable. For example:bar = truefoo = barifdef $(foo)frobozz = yesendifThe variable reference `$(foo)' is expanded, yielding `bar', whichis considered to be the name of a variable. The variable `bar' isnot expanded, but its value is examined to determine if it isnon-empty.Note that `ifdef' only tests whether a variable has a value. Itdoes not expand the variable to see if that value is nonempty.Consequently, tests using `ifdef' return true for all definitionsexcept those like `foo ='. To test for an empty value, use`ifeq ($(foo),)'. For example, bar =foo = $(bar)ifdef foofrobozz = yeselsefrobozz = noendifsets `frobozz' to `yes', while:foo =ifdef foofrobozz = yeselsefrobozz = noendifsets `frobozz' to `no'.
`ifdef VARIABLE-NAME'
`ifdef' 把变量的名字作为它的参数,并不是对变量的一个参照。此变量的值有一个非空值。此时TEXT-IF-TRUE is effective 有效;否则,若TEXT-IF-FALSE存在,则TEXT-IF-FALSE有效。从未定义的变量拥有一个空值 。VARIABLE-NAME 文本会被扩展,因此它可以是一个变量或者函数的扩展,例如:
bar = true
foo = bar
ifdef $(foo)
frobozz = yes
endif
变量参照$(foo)被扩展,转化为bar,它可以视为一个变量的名字。变量bar不再扩展,但是它的值会用来被检查看其是否为空。
请注意 ifdef 只测试是否一个变量有一个值。它并不扩展词比变量来看它是否为非空。此外,用ifdef来测试会返回真,只有像foo=那种测试才会是例外。为了测试一个空值,可以使用 ifeq($(foo),)。例如:
bar =
foo = $(bar)
ifdef foo
frobozz = yes
else
frobozz = no
endif
设置 `frobozz' 为 `yes', 而:
foo =
ifdef foo
frobozz = yes
else
frobozz = no
endif
设置 `frobozz' 为 `no'.
后文待续
GNU make manual 翻译( 一百八十二)相关推荐
- GNU make manual 翻译( 一百六十二)
继续翻译 6.5 Setting Variables =====================To set a variable from the makefile, write a line st ...
- GNU make manual 翻译( 一百五十五)
继续翻译 6.2 The Two Flavors of Variables ================================There are two ways that a vari ...
- GNU make manual 翻译( 一百五十四)
继续翻译 6.1 Basics of Variable References =================================To substitute a variable's v ...
- GNU make manual 翻译( 一百八十一)
继续翻译 The syntax of the CONDITIONAL-DIRECTIVE is the same whether the conditional is simple or comple ...
- GNU make manual 翻译( 一百八十三)
继续翻译 `ifndef VARIABLE-NAME' If the variable VARIABLE-NAME has an empty value, the TEXT-IF-TRUEis eff ...
- GNU make manual 翻译( 一百五十九)
继续翻译 A computed variable name need not consist entirely of a single variable reference. It can conta ...
- GNU make manual 翻译( 一百七十五)
继续翻译 `.DEFAULT_GOAL' Sets the default goal to be used if no targets were specified onthe command lin ...
- GNU make manual 翻译( 一百六十)
继续翻译 The only restriction on this sort of use of nested variable references is that they cannot spec ...
- GNU make manual 翻译( 一百六十四)
继续翻译 When you add to a variable's value with `+=', `make' acts essentially as if you had included th ...
最新文章
- (C++)string 的两种输入方式和输出方式
- python的mysql模块_python使用MySQLdb模块连接MySQL
- platform_driver_probe与platform_driver_register的区别
- php表单提交完返回,表单内容不清空解决方法
- ASP.NET MVC 入门5、View与ViewData
- mysql 排序num_MySQL 实现row_number() 分组排序功能
- Python精通-Python函数使用
- bat管理mstsc 远程桌面连接
- submit和button的区别
- iPhone企业应用实例分析之四:技术要点分析(1)
- 定时器编写 例子
- 【版本控制】如何从github 上获取源码
- opencv-python 霍夫变换
- 迅雷极速版服务器响应,如何阻止迅雷极速版强制更新?这个方法很简单
- Tableau基础图表制作
- 电脑没声音 小喇叭不见了怎么办
- KEIL、uVision、RealView、MDK、KEIL C51区别
- 【考研复试】面试问答
- 芝士和奶酪一样吗_使用简单工厂设计模式就像制作芝士蛋糕一样
- 计算机英语(61-90)
热门文章
- 解决vue在ie9中的兼容问题
- 技术分享连载(七十九)
- POJ 2480 Longge#39;s problem 积性函数
- 新型智慧城市 相关网址
- 记一次DRBD Unknown故障处理过程
- java搜索引擎lucene_简单lucene搜索实现(搜索引擎)
- 【免费毕设】ASP.NET 城市酒店入住信息管理系统 (源代码+lunwen)
- go语言和php哪个建站好,从0开始Go语言,用Golang搭建网站
- Python+OpenCV:ORB: An efficient alternative to SIFT or SURF
- QT不同线程间signal-slot机制的值传递