bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: distclean vs. clean order dependency


From: Ralf Wildenhues
Subject: Re: distclean vs. clean order dependency
Date: Sun, 16 Nov 2008 17:50:37 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Hi Eric,

old old thread:

* Eric Blake wrote on Sat, Apr 05, 2008 at 02:56:43PM CEST:
> I was trying to silence warnings during 'automake -Wall' for autoconf.
> However, I can't figure out what to do for this last warning, that
> autoconf is overriding automake's definition of distclean-generic.  It
> turns out that autoconf has this comment in tests/Makefile.am:
>
> # Avoid a race condition that would make parallel "distclean" fail.
> # The rule in clean-local tests for existence of $(TESTSUITE), and
> # if found, attempts to run it.  But the distclean-generic rule may
> # be running in parallel, and it removes $(DISTCLEANFILES) which
> # includes $(TESTSUITE).
[...]
> It seems like this is a bug in automake - shouldn't it output something like:
>
> | distclean: clean-am distclean-am
>
> or, conditional on clean-local being defined,
>
> | distclean: clean-local distclean-am
>
> so that distclean rules don't start until clean rules have completed?  Or
> is there some other way, using automake 1.10.1, to add the needed
> serialization between clean-local and distclean-generic without triggering
> the automake warning about overriding an Automake target?

We should have optional, strictly ordered siblings to *-local and
*-hook rule add-ons.  Optional because they may introduce overhead
not necessary otherwise, and strictly ordered for parallel make, as
in this case.

How about this slightly different workaround.  It exploits the
undocumented feature^Wbug that automake doesn't look through variables
for rule targets.  This avoids the need to hardcode the rule contents.

WDYT?

Cheers,
Ralf

    Use a different workaround for an automake quirk.
    
    * tests/Makefile.am (AUTOMAKE_OPTIONS): Remove.
    (distclean_generic): New helper variable, to fool automake.
    ($(distclean_generic)): Depend on clean-local, to prevent
    the race in the two rules with accessing and removing
    $(TESTSUITE).
    Report by Eric Blake.

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 01acf3a..0556b29 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -127,12 +127,11 @@ atconfig: $(top_builddir)/config.status
 # if found, attempts to run it.  But the distclean-generic rule may
 # be running in parallel, and it removes $(DISTCLEANFILES) which
 # includes $(TESTSUITE).  This is the Automake rule, plus our
-# dependency, and we silence the warning from 'automake -Wall'.
+# dependency, and we silence the warning from 'automake -Wall' by
+# hiding the dependency behind a variable.
 # TODO - fix this if newer automake accomodates the dependency.
-AUTOMAKE_OPTIONS = -Wno-override
-distclean-generic: clean-local
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+distclean_generic = distclean-generic
+$(distclean_generic): clean-local
 
 clean-local:
        test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean





reply via email to

[Prev in Thread] Current Thread [Next in Thread]