【发布时间】:2016-04-27 21:18:15
【问题描述】:
如果当前目标满足特定条件,我如何中止 makefile 继续其他目标。
例如:
Step01:
@# Do something
Step02: Step01_Output
@# Check that Step01_output meet certain condition, otherwise, abort
Step03: Step02
@# Do somethings (of course if did not abort in Step02)
# And so on
我尝试使用状态为 0 的“退出” ==> 但它仍然继续! 我尝试使用“exit 1”或其他存在状态==>它中止,但在输出时给出错误消息。 我想中止,但在 make 调用 shell 时仍然没有给出错误消息。 我还尝试从 Step02 设置 env 变量并围绕 Step03 并在 if 之后检查如下:
ifneq ($(ToAbort),1)
Step03:
...
StepN
endif
不幸的是,make 似乎连条件都没有看,或者变量值没有在目标之间传递。
有什么想法吗?可能是通过添加额外的目标吗?
【问题讨论】:
-
请提供一个真实的例子而不是伪代码,这可能是XY problem。