← Back to team overview

launchpad-dev team mailing list archive

Re: make clean, make distclean

 


On Aug 3, 2009, at 12:08 PM, Maris Fogels wrote:

Hi everyone,

So I've noticed some people have had problems with the initial build, and the first thing they try is 'make clean'. However, this doesn't do what they expect: instead of resetting the build, it just resets the application state. Subsequent attempts to use 'make' still fail, because the build artifacts are still broken.

So, to make things easier for our developers, should we follow a more standard set of behaviours for our Makefile targets?

From the GNU Coding Standards: Standard Targets:
http://www.gnu.org/prep/standards/html_node/Standard-Targets.html#Standard-Targets

'clean'
Delete all files in the current directory that are normally created by building the program. Also delete files in other directories if they are created by this makefile. However, don't delete the files that record the configuration. Also preserve files that could be made by building, but normally aren't because the distribution comes with them.

'distclean'
Delete all files in the current directory (or created by this makefile) that are created by configuring or building the program. If you have unpacked the source and built the program without creating any other files, ‘make distclean’ should leave only the files that were in the distribution.

The standard defines 'mostlyclean' and 'maintainer-clean' targets as well.

As an example of how this would help, when someone tells us "It says I have an error with foo.egg", we can simply tell them to run 'make distclean; make', and everything will be reset as expected.

Should we make this change?

I'm not thrilled with adding distclean, though I experienced one example of the use case this morning with Jono. Someone had inadvertently broken an egg (see bug 408413, https://bugs.edge.launchpad.net/launchpad-foundations/+bug/408413) . I have not seen any other problems like this. Any other stories out there?

We share our eggs across builds, just as we share our sourcecode. Therefore, running make distclean would break any branches using different eggs until they too reran make. That's surprising.

I like sharing eggs; it saves a lot of build time.

I suppose I'd be ok with a distclean target that simply added a warning to the output that it may make it necessary to rerun make in other branches.

Rereading the description of ``distclean`` in the quote above, perhaps a somewhat more elegant solution from a user perspective would be for a branch to remember what eggs it created, and just clean those. That's still fragile for considerably more work, so it doesn't strike me as a win.

So, in sum, maybe, but beware. :-)

Gary


References