Alexandre Raymond <[email protected]> writes: > Hi Markus, > >> Well, I'd expect distclean to remove exactly what *this* makefile can >> build, and leave everything else alone. > > I was expecting "distclean" to bring back the source directory to > however it was after checkout, removing anything that might have been > created by the build/configure process. > > >> Your patch adds a special case to that simple rule: also remove >> not-configured target directories. Other not-configured stuff is still >> left behind. >> >> Special cases need special justification, hence my question above. > > This patch stems from the discussion in "Makefile: fix out-of-tree builds" > http://lists.gnu.org/archive/html/qemu-devel/2011-07/msg02707.html > > What happens is that SRC_PATH is set in the VPATH variable in the > Makefile, which causes it to search for files inside the source > directory (and outside the current build directory). > > Say you're building out-of-tree, and the Makefile happens to pick up > old files from your main source directory, it can lead to errors in > the build. If you are "unable" to delete old build data because you've > run a more restricted "configure" after an earlier build, this earlier > build data will not go away if you distclean. > > For example: [...]
There are many more object files that are built conditionally. Why is it okay not to delete them? If you unwisely messed up your source tree by building in it, a simple and reliable way out is to git-clone yourself a new one. Or if you insist on recovering in-place, remove files outside .git that aren't in git.
