通过更改执行顺序来触发(并行)GNU make中缺少的依赖项 [英] Trigger missing dependencies in (parallel) GNU make by changing order of execution

查看:80
本文介绍了通过更改执行顺序来触发(并行)GNU make中缺少的依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个Makefile:

Suppose I have a Makefile:

a.out:
    sleep 3
    touch a.out a1

b.out:
    cat a1 > b.out

c.out: a.out b.out
    cat a.out b.out > c.out

make c.out通常会成功执行 ,因为a.out的命令先于b.out的命令执行.但是make b.out将失败(在干净目录中),make -j c.out也将失败.

make c.out will usually succeed, as the commands for a.out are executed before the commands for b.out. But make b.out will fail (in a clean directory), as will make -j c.out.

在现实情况中,很少会出现sleep 3,因此该错误仅会非常随机地显示,我正在寻找一种更有可能排除此类错误的方法.一个想法是颠倒目标在同一级别"上的执行顺序:由于测试套件通常会触发第一代a.out,然后触发b.out,如果首先生成了b.out,则该错误会表面.

As in real-life scenarios there is seldomly a sleep 3 and the bug will thus only show very randomly, I'm looking for a way to smoke out such errors with a higher probability. One idea would be to reverse the order of execution for targets "on the same level": As the test suite will usually trigger first generation of a.out, then b.out, if instead first b.out was generated, the bug would surface.

GNU make中有没有办法做到这一点?

Is there a way in GNU make to do this?

推荐答案

Paul Smith在 help-make@gnu.org ,这对于当前的GNU make来说是不可能的.

Paul Smith replied on help-make@gnu.org that this is not possible with current GNU make.

这篇关于通过更改执行顺序来触发(并行)GNU make中缺少的依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆