如何使 automake 对丢失的文件保持沉默?

How to make automake silent about missing files?

要构建一个项目,我正在使用 automake:

automake --foreign --add-missing --copy

标准错误的输出目前过于冗长:

configure.ac:50: installing 'config/compile'
Makefile.am: installing 'config/depcomp'

这些行出现在标准错误输出中,即使它们不是错误(除非我弄错了)。

那么,是否可以避免出现标准错误时的安装输出?我不想将标准错误重定向到标准 in 或 /dev/null,如果它们是真正的错误,我仍然希望在标准错误上出现错误,但我不希望在标准错误上出现“非错误”。

理想情况下,我还可以避免将这些文件从 automake 复制到存储库中,因为那时我必须维护它们。

The output is currently too verbose on standard error:

configure.ac:50: installing 'config/compile'
Makefile.am: installing 'config/depcomp'

嗯,好的。是的,automake 将报告它添加到您的项目中的文件。而且它只会报告一次,除非您再次删除它们或 --force,所以如果您认为这是一个问题,那么它会自行解决。

These lines come on standard error output, even though they are not errors (unless I am mistaken).

您似乎对“标准错误”这个名称读得太多了。尽管此流是错误消息的适当目的地,但它并不局限于此类消息,无论是设计还是约定。对于主要 activity 不是在标准输出上产生输出的程序,对于应将什么写入 stdout vs 没有任何特别严格的规则。应该写入 stderr 的内容。

So, is it possible to avoid this installing output on standard error? I do not want to redirect standard error to standard in or /dev/null, I still want errors on standard error if they are real errors, but I do not want "non-errors" on standard error.

没有记录的机制来抑制 automake 关于复制这些文件的诊断输出。如果你想避免看到它,那么你需要破解 automake 或将其过滤掉。如果你是 运行 automake 来自 Bash 那么你可能会像这样完成后者:

automake --foreign --add-missing --copy 2> >(grep -v installing 1>&2)

不过,我真的不明白有什么大不了的。

Ideally, I would also avoid having to copy these files from automake into the repository since then I would have to maintain them.

所以这与其说是关于 ,不如说是关于其他可能从不完整的发行版构建你的项目的人?我真的觉得你多虑了

此外,虽然我知道从源代码控制中省略 autotools 派生文件已经变得很流行,但我发现这是错误的,至少在某种程度上源代码控制系统被迫承担分发的双重职责系统。有问题的文件将与项目的其余部分一起分发,因此构建项目不需要 autotools 的本地副本。这不仅是为了方便,也是为了保护那些构建您的项目的人免受使用与项目开发时不同版本的一个或多个 Autotools 可能引起的问题。

此外,如果您提供的构建说明旨在说明丢失的文件,那么我强烈建议您推荐...

autoreconf --install --force

... 而不是单独使用 运行 各种自动工具或单独使用 运行 automake--force 可能会被省略,如果你小心保持分发干净任何它会导致被覆盖的文件,但即使那样它也无害。