Subject: bug#7671: Presetting various *CLEANFILES variables

From: Stefano Lattarini <[email-masked]>
Date: Sat, 18 Dec 2010 11:02:45 +0100

On Saturday 18 December 2010, Behdad Esfahbod wrote:
> Hi,
Hello Behdad.

> Currently, automake doesn't set any of the various *CLEANFILES variables.
> Since the "+=" syntax is not portable when the variables are not initialized
> (and causes an automake warning), this leaves no option for Makefile.am
> snippets from various tools other than using the *clean-local targets to do
> their cleanups.  The problem with this is that it's imperative as opposed to
> declarative.
>
I agree this might be quite annoying sometimes.

> I've been maintaining a pieces of Makefile.am snippet called git.mk:
> 
>   http://git.gnome.org/browse/pango/tree/git.mk
> 
> What it does is to generate .gitignore files based on what "make
> maintainer-clean" removes.  However, because of the problem stated above,
> I cannot simply aggregate the various *CLEANFILES variables and also have
> to add support for individual tools (autoconf, automake, libtool, gtk-doc,
> gnome-doc-utils, mallard, intltool, and gsettings so far).
>
Note that the *CLEANFILES variables cannot be used to remove directories,
so, for your approach to be really useful in all cases (i.e. also be able
to git-ignore generated directories easily), a similar set of *CLEANDIRS
variables would be needed.

And IMHO adding them would be a good idea regardless of your particular
use case.

> If instead automake was changed to always pre-initialize *CLEANFILES
> variables, all snippets could just append to do variables and my git.mk
> snippet would be more generic and much more simpler at the same time.
> So I want to suggest that automake be changed to initialized *CLEANFILES
> if the Makefile.am doesn't initialize them explicitly.
>
If the change you propose can be implemented without breaking backward
compatibility (and I think it probably can), then I'm all in favor of it.

I'd like to hear Ralf's opinion on this before taking any further
action, though.

> In another note, if that change is made and my git.mk simplified to not have
> tool-specific logic in it, it would be a great addition to automake itself.
> 
> Cheers,
> behdad
> 

Thanks,
   Stefano