自动工具和版本控制
我知道,这一定是个愚蠢的问题。 假设我有一个使用自动工具构建系统的库。 我拥有所有 configure
、configure.ac
、Makefile.am
、config.h
以及其他可能的文件我的项目根文件夹。其中一些是由开发人员编写的,另一些是由自动工具生成的。
问题是:如果我使用版本控制系统(在我的例子中 - hg) - 所有 autotools 文件中哪些应该由 VCS 跟踪,哪些不应该(hgignore'd)?
谢谢, 哔叽
I know, it must be a silly question.
Assume I have a library using an autotools build system.
I have all that configure
, configure.ac
, Makefile.am
, config.h
and may other files in my project root folder. Some of them wre written by a developer, others are generated by autotools.
The question is: if I use a version control system (in my case - hg) - which of all that autotools files should be tracked by a VCS and which shouldn't (hgignore'd)?
Thanks,
Serge
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为最好的程序是只将未生成的文件置于版本控制之下 - 使用 VCS 的人员是开发人员,应该在他们的计算机上安装自动工具,签入生成的文件只会给他们带来麻烦。
另一方面,您必须确保在所有生成的文件就位的情况下完成源代码级分发,以便非开发人员能够在不安装自动工具的情况下构建软件。
I think the best procedure is to only put files under version control that are not generated - people working with the VCS are developers and should have the autotools installed on their machines, checking in generated files will only cause trouble for them.
On the other hand you have to make sure that source-level distribution is done with all generated files in place, so that non-developers are able to build the software without the autotools installed.
对此有两种想法:
我个人通常属于后一组,但是如果您可能不再安装的某些特定版本中的构建系统存在问题,则前者可能会很好。
在您的示例中,
configure
和config.h
都是(可能)自动生成的,因此如果您要将它们包含在版本控制中,我倾向于包含 < code>Makefile.in 也是如此。在我的项目中,这通常意味着没有比
configure.ac
、Makefile.am
、文档(如果是 GNU)和名为m4
的目录更多的与 autotools 相关的文件code> 其中包括我的configure.ac 需要的任何自定义/非标准宏。There are two schools of thought on this:
I generally fall into the latter group personally, but the former can be nice if there are/were problems with the build system in some specific version that you probably don't have installed any more.
In your example
configure
andconfig.h
are both (probably) autogenerated, so if you're going to include them in version control I'd be inclined to include theMakefile.in
s too.In my projects this usually means having no more autotools related files than
configure.ac
,Makefile.am
, the documentation if it's GNU and a directory calledm4
which includes any custom/non-standard macros my configure.ac requires.