条件判断
条件表达式的语法为:
<conditional-directive>
<text-if-true>
endif
以及:
<conditional-directive>
<text-if-true>
else
<text-if-false>
endif
其中<conditional-directive>
表示条件关键字,如“ifeq”。这个关键字有四个,如下:
1.“ifeq”
ifeq (<arg1>, <arg2> )
ifeq '<arg1>' '<arg2>'
ifeq "<arg1>" "<arg2>"
ifeq "<arg1>" '<arg2>'
ifeq '<arg1>' "<arg2>"
比较参数“arg1”和“arg2”的值是否相同,相同则为真。
2.第二个条件关键字是“ifneq”。语法是:
ifneq (<arg1>, <arg2> )
ifneq '<arg1>' '<arg2>'
ifneq "<arg1>" "<arg2>"
ifneq "<arg1>" '<arg2>'
ifneq '<arg1>' "<arg2>"
其比较参数“arg1”和“arg2”的值是否相同,如果不同,则为真。
3.第三个条件关键字是“ifdef”。语法是:
ifdef <variable-name>
如果变量<variable-name>
的值非空,则表达式为真。否则,表达式为假。
4.第四个条件关键字是“ifndef”。其语法是:
ifndef <variable-name>
如果<variable-name>
值为空,则表达式为真。