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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.acMakefile.amAUTHORS,NEWSetc.Makefile.amin subdirectoriesTo 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
bootstraporautogen.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, yourautogen.shreally only needs to consist of one line:although some people prefer to run
./configureautomatically at the end ofautogen.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
configurefile to generate theMakefiles is true for source code distributions (the.tar.gzfile that you get when you typemake dist) but not necessarily for freshly checked out copies from version control.