小编Jay*_*Fix的帖子

$@ 如何在 make 条件下工作?

我正在使用 GNU Make 3.80。在我的 Makefile 中,我使用自动变量 $@ 来引用当前目标。

    @echo current target is ... [$@]
ifeq ($@,sms)
    @echo yep, they are equal
else
    @echo no, they are not equal
endif
Run Code Online (Sandbox Code Playgroud)

似乎 $@ 扩展为 sms,如下面的输出所示。

输出是:

current target is ... [sms]
no, they are not equal
Run Code Online (Sandbox Code Playgroud)

我的问题:由于 $@(显然)扩展为 sms,不应该执行 ifeq 条件的“true”分支(结果输出应该是 yep,它们是相等的)?[我不知道为什么输出不是,它们不相等。]

conditional makefile

3
推荐指数
1
解决办法
2385
查看次数

如何在Make中捕获并处理错误?

我正在使用GNU Make 3.80.

在我的Makefile_1中,我正在调用Makefile_2.在某些情况下,Makefile_2"抛出"错误.

有没有办法让我"捕获"和"处理"(在Makefile_1中)Makefile_2可能抛出的错误?

error-handling makefile

3
推荐指数
1
解决办法
3378
查看次数

标签 统计

makefile ×2

conditional ×1

error-handling ×1