【发布时间】:2011-10-28 05:15:56
【问题描述】:
可能重复:
GNU Makefile rule generating a few targets from a single source file
如果我有这样的 Makefile 规则:
a b c:
echo "Creating a b c"
touch a b c
output: a b c
cat a b c > output
然后我运行 make -j9 output
make 看到 3 个依赖项 (a,b,c),寻找如何生成它们:(上面的“a b c”规则),但接下来会发生什么?它应该没有意识到“a b c”规则只需要运行一次即可创建所有 3 个目标吗?
这是 make 实际做的:
[pavel@orianna test]$ make -j9 output -n
echo "Creating a b c"
touch a b c
echo "Creating a b c"
touch a b c
echo "Creating a b c"
touch a b c
cat a b c > output
[pavel@orianna test]$
相同的配方运行 3 次,每个依赖项运行一次以规则“输出”!
有人知道它为什么会这样吗?
【问题讨论】: