Makefile 条件 OR 定义
我有一个带有 2 个 ifdef 条件的 Makefile,当选择该特定配置时,它们执行相同的操作。
#ifdef A
//perform C
#endif /* A */
#ifdef B
//perform C
#endif /* B */
#ifdef A || B
//perform C
#endif
最后一个代码块不起作用。在 Makefile 中执行它的正确方法是什么?
I have a Makefile with 2 ifdef conditions that perform same action when that particular config is selected.
#ifdef A
//perform C
#endif /* A */
#ifdef B
//perform C
#endif /* B */
#ifdef A || B
//perform C
#endif
Last code block is not working. What is the right way to execute it in Makefile?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
#ifdef
和#endif
不是 make 条件。您可能想要:请注意,
ifdef A
与ifneq ($(A),)
不同。因此,如果您想测试这些变量不是为了定义而是为了空性,您可能需要:#ifdef
and#endif
are not make conditionals. You probably want:Note that
ifdef A
is not the same asifneq ($(A),)
. So, if you want to test these variables not for definition but for emptiness, you probably want:这是使用我在评论中提出的技术变体的一种方法:
Here's one way to do it using a variant of the technique I proposed in a comment: