本文介绍了Makefile ifeq逻辑与的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在GNU make文件的if循环中检查多个条件.这是一个示例:

I would like to check multiple conditions in an if loop of GNU make file. Here's an example:

ifeq ($(TEST_FLAG),TRUE && ($(DEBUG_FLAG),FALSE))
true statement 
else 
false statement
endif

什么是正确的方法?

推荐答案

您可以将ifeq与值的串联使用,例如.

You can use ifeq with a concatenation of your values, eg.

ifeq ($(TEST_FLAG)$(DEBUG_FLAG),TRUEFALSE)
   do something
endif

还可以使用条件函数,这些函数在循环中更有用(因为ifeq可能不会在循环中做您期望的事情,它将被精确地测试一次).

It's also possible to use the Conditional functions, which are more likely to be useful in a loop (as ifeq will probably not do what you expect in a loop, it will be tested exactly once).

这篇关于Makefile ifeq逻辑与的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 16:40