views:

101

answers:

1

Hi all,

I'm starting to try out lighttpd for an embedded linux project. I got the curret source package and and started writing a master makefile ecapsulating all configer, compile, install (for testing) etc stuff. And vice-versa I want to cleanup every step. This cleanup should be 100%, i.e. there should be no generated files anymore after cleanup. This is important for repetitive tests.

I wonder, is there a way to cleanup all the stuff "./configure" generated? And is make uninstall, make clean, etc. 100%? I don't know the autotools in detail, I'm a beginner in using them.

Any hints? Thanx, Andi

+2  A: 

I personally would really use the features of a source control software (you should use one) for this. This would cleanup make independent of your build process. See e.g. svn-cleanup or git clean.

Nevertheless, automake allows some tweaking when to remove which files. This has (intentionally?) built-in limitations on what files generated by autotools can be remove this way though. Have a look at the definitions for MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, and MAINTAINERCLEANFILES and adjust your Makefile.am's. With them you can remove a lot of stuff with

make mostlyclean
make clean
make distclean
make maintainer-clean

You won't be able to remove e.g. Makefile or .deps/ this way.

As for the reliability of make clean it should "work 100%" if you stick to cleanly specifying your files and stay away from manual intervention. Otherwise extend the cleanup rules.

honk
Thanks Honk, I will have a look to the suggested parts of the documentation. If make clean works 99% and a few well-known files can be removed manually, this will be ok.Another question arises: is it possible to redirect all generated output to a specified build-directory (like CMake)? This would be helpful for cleanup, and for building for different platforms I guess?
Andi
Ok, it looks like that a command like "make mostlyclean clean distclean maintainer-clean" will do the job! One funny effect is that in the lighttpd package 2 source files are modified by the build processs: src/configparser.c and src/mod_ssi_exprparser.c. But only the relatve include pathes. Maybe this files are re-generated by the build process. Thank you, Honk!
Andi
honk
@Honk: will try this. In the meantime I had a similar idea: create builddir, copy the whole source tree into it and do everything as usual. This doesn't change the modified source files in the original tree. And parallel builds for different platforms doesn't affect each other.
Andi
@Andi: Maybe I don't understand your point. In that example I gave `build/` doesn't have to be in the source directory. Also, files in the source directory won't be modified by this. Whatever `Makefile` is created from you `./configure` call has all the information on platform, compiler, ... and will be saved in `build/`.
honk
@Honk: you are right, using build/ works file! I wasn't sure about the changed source files mentioned above, but this files are created inside the build/ directory. Great! with this solution I can realize the clean all by removing the build/ directory.
Andi