【问题标题】:Which files of an autoconf project to put into .gitignore?将 autoconf 项目的哪些文件放入 .gitignore?
【发布时间】:2013-05-06 17:36:09
【问题描述】:

我们的 git 管理项目中包含 ctemplate 库,该库基于 GNU Autoconf

我想将 Autoconf 生成的所有内容放入 .gitignore 文件中,以避免在有人意外提交特定于平台的生成文件时发生冲突。

谁能告诉我如何找出 autoconf 为所有平台(Mac、Ubuntu、CentOS 等)生成/修改的文件的完整列表?

【问题讨论】:

  • 不是对否决问题的答案-不是我...但是,1)从您编写的文件开始并提交它们,2)运行autoconf并查看现在存在哪些文件 - autoconf 生成了任何新文件 - 将这些文件添加到 .gitignore...
  • 这可能适用于您的本地机器,但 autoconf 也只能在特定平台上生成内容。
  • 不要给任何会提交自动工具生成文件的人提交权限:-P

标签: c++ git makefile autoconf


【解决方案1】:

这是我在各种 .gitignore 中的内容(在 Debian 测试中):

共享库: (libtool)

/Makefile
/Makefile.in
/aclocal.m4
/autom4te.cache/
/config.*
/configure
/depcomp
/install-sh
/libtool
/ltmain.sh
/m4/
/missing
/stamp-h?
.deps/
.dirstamp
.libs/
*.l[ao]
*~

可执行文件:

/Makefile
/Makefile.in
/aclocal.m4
/autom4te.cache/
/config.*
/configure
/m4/
/stamp-h?
.deps/
.dirstamp
*.o
*~

您可能需要稍微调整一下,但这是大部分内容。 make dist-clean 之后是提交、重建,最后是 git status 可能会向您显示新文件,具体取决于您的构建生成的具体内容。

【讨论】:

  • hm,似乎 m4/ 目录中的一些文件是必需的。我得到 configure.ac:65: error: possible undefined macro: AC_COMPILER_CHARACTERISTICS
  • 你是先用autoreconf --install吗?我这样做了,它会重新生成m4 目录。
  • 我会使用make maintainer-clean 而不是distclean
  • +1,但 *~*.o 可能应该被全局忽略(例如,在 ~/.gitconfig:[core] 中)
  • 对于最先进的技术,您可能需要将ar-lib 添加到此列表中。
猜你喜欢
  • 2023-01-29
  • 2017-11-23
  • 1970-01-01
  • 1970-01-01
  • 2012-03-29
  • 1970-01-01
  • 1970-01-01
  • 2018-04-30
  • 2019-11-24
相关资源
最近更新 更多