I'm trying out lighttpd
for an embedded Linux project. I got the latest source package and started writing a master Makefile encapsulating all configure, compile, install (for testing) etc stuff.
And vice-versa, I want to cleanup every step. After the cleanup there should be no generated files anymore. This is important for repetitive testing.
I wonder if there is a way to do a complete cleanup of what ./configure
generated? I'm not familiar with autotools
in details.
Any hints?
If make built it, and it is commonly something that one would want to rebuild (for instance, a .o file), then mostlyclean should delete it. Otherwise, if make built it, then clean should delete it. If configure built it, then distclean should delete it.
configure.ac (sometimes also named: configure.in) is an input file for autoconf. It contains tests that check for conditions that are likely to differ on different platforms. The tests are made by actually invoke autoconf macros.
make distclean is the first step up from the basic make clean on many GNU Make systems. It seems to be pseudonymous or at least very similar to with make realclean and make clobber in many, but not all cases. It will delete everything that make clean does and remove the configuration.
The "sh" command is required to invoke the configure script. There a number of ways to create an Autotools project. The first method is through the CDT C and C++ Project wizards which can be activated from the File -> New -> C Project and File -> New -> C++ Project menu items, respectively, which are available while in the C/C++ Perspective.
For details on the new CDT Autotools, see the CDT/Autotools/User_Guide The Autotools plug-in for Eclipse extends the CDT (C/C++ Development Tools) to add support for maintaining and building C/C++ projects that use GNU Autotools. The GNU Autotools are a set of tools used to make a project portable to multiple systems or build environments.
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.
If GNU Autoconf is installed on your system ( autoreconf should be in the system PATH ), CLion will call it first. Pre-configuration is performed on every project reload. By default, CLion uses the following commands to configure an Autotools project: which autoreconf && autoreconf --install --force --verbose; /bin/sh configure
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.
In addition to Benjamin Bannier's answer, the generated files names may be listed in .gitignore
file so that they are ignored, not tracked with git and don't irritate and bother when run git status
. You can't remove these files with git clean
. In this case I personally use rm -rf * ; git checkout .
command.
But don't use that if you have other ignored files which you don't want to be removed!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With