最佳答案
我正在尝试执行以下操作。有一个程序,称为 foo-bin
,它接受一个输入文件并生成两个输出文件。对于这个问题,一个愚蠢的 Makefile 规则是:
file-a.out file-b.out: input.in
foo-bin input.in file-a.out file-b.out
However, this does not tell make
in any way that both targets will be generated simultaneously. That is fine when running make
in serial, but will likely cause trouble if one tries make -j16
or something equally crazy.
问题是是否存在为这种情况编写适当的 Makefile 规则的方法?显然,它会生成一个 DAG,但是 GNU make 手册并没有指定如何处理这种情况。
Running the same code twice and generating only one result is out of the question, because the computation takes time (think: hours). Outputting only one file would also be rather difficult, because frequently it is used as an input to GNUPLOT which doesn't know how to handle only a fraction of a data file.