GNU make - 使一个任务也完成另一个任务

时间:2015-06-10 16:35:13

标签: linux makefile dependencies gnu-make

这是我的makefile:

z : a
    echo "REDOING Z" ; touch z

a : b b2
    touch a
    touch a2
    touch z # should disable z but doesn't

b : c c2
    touch b
    touch b2

当我执行make a时,z被触摸两次,我希望它只被触摸一次,我该怎么做?

1 个答案:

答案 0 :(得分:1)

这里的目标和食谱是脱节的:食谱应该只产生目标,而不是其他目标。 E.g:

z : a
    touch z

a : b b2
    touch a

b : c c2
    touch b

# add rules for b2, c and c2