开发者

Cleanup Strategies after Building Source Code using eg. Git

I (mostly) use git to download and compile various projects from their source code, keeping my source in /usr/local/src and installing the bin开发者_运维技巧aries in /usr/local/bin.

Following the building procedure, usually with ./configure && make && make install, I'm left with a lot of cruft that ends up as 'new' files in my local git repository.

To my understanding, make clean, make distclean and possibly also (?) ./configure clean are thinkable procedures in order to trash most leftover files. But in specific scenarios (see example below) I'm left clueless what thing to do in order to "stay clean", such as I was prior to the installation...

A recent example – installing jscoverage (via git svn) from http://svn.siliconforks.com/jscoverage/trunk jscoverage:

The building instructions for this project prompted me to use ./bootstrap.sh && make && make install. In this case, after compiling and installing was finished, I tried all of the aforementioned cleanup commands (by random), but didn't manage to get rid of everything.

To wrap my question up: Is there any all-mighty, superior cleaning strategy that I haven't grasped? How do you approach this cleanup issue when using a VCS such as git, in a typical workflow where you 1.) download – 2.) build – 3.) pull updates from upstream repository – 4.) build once again – and so forth?


There is also git clean ("Remove untracked files from the working tree"). It's a simple command with relatively few command line options. See the git-clean man page.


For an autotooled project (i.e., most of the ones that use ./configure && make && make install), make distclean will get you to the state of a pristine distribution tarball. They won't remove everything autogenerated because that would introduce dependencies on additional tools for the end user.

Many packages will provide a make maintainer-clean that removes as much as possible, but will still keep around enough to build the project (if you have the correct developer tools). This still won't remove files like Makefile.in, which is needed to make Makefile. The idea here is that ./configure && make should still be enough to build everything (provided all of the dependencies are installed).

That said, I think you're potentially asking the wrong question here. If I'm not going to keep the source around for anything, I'd just delete the source directory after installing. If I'm planning on pulling updates and rebuilding, I'd not even bother with a make clean: the whole point of tools like make is that they rebuild only the changed parts of a project and obsessive cleaning defeats that.

When I develop my own projects, I mark any autogenerated file as ignored by the VCS, so it doesn't show up all the time. SVN has the svn:ignore property, mercurial has the .hgignore file and git has the .gitignore file, for example.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜