我应该保留在版本控制库中的Autotools生成哪些文件? [英] Which files generated by Autotools should I keep in version control repository?

查看:148
本文介绍了我应该保留在版本控制库中的Autotools生成哪些文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是autotools的新手,我正在开发一个C项目。我想将我的项目添加到git存储库。我需要在我的版本控制系统中跟踪哪些autotools生成哪些文件,哪些应该忽略? 你不应该保留任何不受手动编辑的版本控制下的文件。这意味着任何生成的文件都应该被版本控制系统忽略。我基本上只在版本控制下放入


$ b

  • configure.ac code $ Makefile.am

  • 文档文件,例如 AUTHORS 新闻

  • Makefile.am 在子目录中



为了解决由Scharron提出的准备安装版本,有些人在项目的根目录中包含一个名为 bootstrap autogen.sh 的脚本,你检查一个新的副本。您可以在我的一个项目中看到一个示例这里。对于更简单的项目,您的 autogen.sh 确实只需要包含一行:

  autoreconf --install ||退出1 

尽管有些人更喜欢运行 ./configure autogen.sh 。



为什么不能在版本控制中跟踪所有生成的文件?因为它们的内容取决于您正在构建的机器,您生成的自动工具的版本以及月亮的相位。任何时候任何这些改变,生成的autotools文件都会改变,并且你的提交中会有很多垃圾。



另外,任何检查你的代码的人为了构建它,版本控制应该被期望安装适当的开发工具,所以你真的不需要担心由于缺少自动工具而陷入麻烦的人们。



什么VonC说C项目来与一个配置文件生成 Makefile s适用于源代码分发 .tar.gz c> make dist ),但不一定是从版本控制中新鲜检出的副本。


I am new to autotools and I am working on a C project. I want to add my project to a git repository. Which files generated by the autotools I need to track in my version control system and which should be ignored?

解决方案

You should not keep any files under version control that are not hand-edited. That means any generated file should be ignored by the version control system. I basically put only the following under version control:

  • configure.ac
  • Makefile.am
  • the documentation files such as AUTHORS, NEWS etc.
  • Makefile.am in subdirectories

To address the point of having a "ready-to-install" version brought up by Scharron, some people include a script in the project's root directory, called bootstrap or autogen.sh, that you run once when you check a fresh copy out. You can see an example in one of my projects here. For a simpler project, your autogen.sh really only needs to consist of one line:

autoreconf --install || exit 1

although some people prefer to run ./configure automatically at the end of autogen.sh.

Why not track all the generated files in version control? Because their contents depend on the machine you are building on, the version of autotools you generated them with, and the phase of the moon. Any time any of these changes, the generated autotools files will change, and you will get a lot of junk in your commits.

Also, anyone who checks your code out of version control in order to build it should be expected to have proper development tools installed, so you really don't need to worry about people running into trouble because of missing autotools.

What VonC says about C projects coming with a configure file to generate the Makefiles is true for source code distributions (the .tar.gz file that you get when you type make dist) but not necessarily for freshly checked out copies from version control.

这篇关于我应该保留在版本控制库中的Autotools生成哪些文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆