GNU make manual 翻译( 一百八十)

继续翻译

7.2 Syntax of Conditionals
==========================

The syntax of a simple conditional with no `else' is as follows:
CONDITIONAL-DIRECTIVE TEXT-IF-TRUE endif The TEXT-IF-TRUE may be any lines of text, to be considered as part of the makefile if the condition is true. If the condition is false, no text is used instead. The syntax of a complex conditional is as follows: CONDITIONAL-DIRECTIVE TEXT-IF-TRUE else TEXT-IF-FALSE endif or: CONDITIONAL-DIRECTIVE TEXT-IF-ONE-IS-TRUE else CONDITIONAL-DIRECTIVE TEXT-IF-TRUE else TEXT-IF-FALSE endif There can be as many "`else' CONDITIONAL-DIRECTIVE" clauses as necessary. Once a given condition is true, TEXT-IF-TRUE is used and no other clause is used; if no condition is true then TEXT-IF-FALSE is used. The TEXT-IF-TRUE and TEXT-IF-FALSE can be any number of lines of text.

7.2 条件式的语法
==========================

简单的没有else的条件式的语法如下:

CONDITIONAL-DIRECTIVE
TEXT-IF-TRUE
endif

TEXT-IF-TRUE 可以是任意的内容,如果条件为真则其被认为是makefile的一部分。如果条件为假,则没有任何文本被利用。

复杂的条件式的语法如下:

CONDITIONAL-DIRECTIVE
TEXT-IF-TRUE
else
TEXT-IF-FALSE
endif

或者:

CONDITIONAL-DIRECTIVE
TEXT-IF-ONE-IS-TRUE
else CONDITIONAL-DIRECTIVE
TEXT-IF-TRUE
else
TEXT-IF-FALSE
endif

只要有必要,可以有很多的 else CONDITIONAL-DIRECTIVE 子句。一旦一个给定的条件为真,则 TEXT-IF-TRUE 就会被利用,而其他的子句就不会再被利用了;如果没有条件为真,那么 TEXT-IF-FALSE 被利用。TEXT-IF-TRUE 和 TEXT-IF-FALSE 的子句可以有任意多行。

后文待续

posted @ 2012-10-08 13:59  健哥的数据花园  阅读(168)  评论(0编辑  收藏  举报