Which files of an autoconf project to put into .gitignore?
Asked Answered
T

1

13

We have the ctemplate library included in our git-managed project which is based on GNU Autoconf.

I would like to put everything which is generated by Autoconf into the .gitignore file to avoid conflicts if someone accidentally commits his platform-specific generated files.

Can someone tell me how to figure out the complete list of files autoconf generates/modifies for all platforms (Mac, Ubuntu, CentOS, etc.)?

Tetradymite answered 6/5, 2013 at 17:36 Comment(4)
Not an answer to the downvote question - wasn't me... but, it seems pretty trivial to 1) start with the files you wrote and commit them, 2) run autoconf and look at what files exist now - anything new was generated by autoconf - add those to .gitignore...Tombstone
This might work for your local machine but autoconf can also generate stuff only on specific platforms.Tetradymite
Don't give commit privileges to anyone who would commit autotools-generated files :-PWives
adding ref to list : github.com/github/gitignore/blob/master/Autotools.gitignoreCarmarthenshire
H
15

Here is what I have in my various .gitignore (on Debian testing):

Shared library: (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]
*~

Executable:

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

You may want to adapt this a bit, but this is the bulk of it. make dist-clean followed by commit, rebuild, and finally git status may show you new files though, depending on what exactly your build generates.

Halfwit answered 6/5, 2013 at 17:44 Comment(5)
hm, seems some of the files inside the m4/ directory are needed. I get configure.ac:65: error: possibly undefined macro: AC_COMPILER_CHARACTERISTICSTetradymite
Are you using autoreconf --install first? I do, and it regenerates the m4 directory.Halfwit
I'd work from a make maintainer-clean rather than distclean.Wallraff
+1, but *~ and *.o should probably be globally ignored (eg, in ~/.gitconfig:[core])Bijection
For the bleeding edge, you might want to add ar-lib to this list.Forsythe

© 2022 - 2024 — McMap. All rights reserved.