【问题标题】:How to write multiple "_or_ (i.e. ||)" conditions in Makefile.am?如何在 Makefile.am 中写入多个“_or_(即 ||)”条件?
【发布时间】:2015-03-30 05:04:04
【问题描述】:

我正在寻找在 Makefile.am 中编写多个“OR”条件的方法。 例如,如果只定义 MOBILE 并且 Makefile.am 编写如下。

if (MOBILE || PC_CLIENT)
    # stuff
endif

不幸的是,这个 Makefile.am 代码返回编译时错误。

什么是正确的做法?

【问题讨论】:

标签: makefile autotools


【解决方案1】:

您在Makefile.am 中找不到很大的灵活性。但是通常的做法是在configure.ac 中执行复杂的任务,然后将一个简单的参数传递给Makefile.am. Theconfigure.acusesbashcommands and in this case you can usetestofbash`:

configure.ac

AM_CONDITIONAL([STUFF], [test $var1 = "MOBILE" -o  $var1 = "PC_CLIENT"])

Makefile.am

if STUFF
   # stuff
endif

查看文档here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-01
    • 2018-03-27
    • 2015-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多