automake
[Top][All Lists]
Advanced

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

Re: race condition gnulib-tool's mostlyclean-local rule


From: Ralf Wildenhues
Subject: Re: race condition gnulib-tool's mostlyclean-local rule
Date: Fri, 4 Aug 2006 17:40:27 +0200
User-agent: Mutt/1.5.12-2006-07-14

Hello Jim,

* Jim Meyering wrote on Fri, Aug 04, 2006 at 04:35:30PM CEST:
> 
> mostlyclean-local:
>       @test -z "$(MOSTLYCLEANDIRS)" ||        \
>         for dir in $(MOSTLYCLEANDIRS); do     \
>           if test -d $$dir; then              \
>             echo "rmdir $$dir"; rmdir $$dir;  \
>           fi;                                 \
>       done
> 
> It works fine when Make rules are run in sequence.
> But I always run make in parallel, e.g., with -j3.
> That causes the rmdir to fail if not all MOSTLYCLEANFILES
> have been removed when the above rmdir runs.

> The problem would be solved if automake were to emit this instead:
> 
> mostlyclean-am: mostlyclean-compile mostlyclean-generic
>       $(MAKE) mostlyclean-local

IMVHO it's ugly (and resource-wasting) to have a $(MAKE) reinvocation
to paper over limitations in the extensibility of Automake-generated
Makefiles; the right fix would be to add dependency information
  mostlyclean-local: mostlyclean-compile mostlyclean-generic

in this case, except that the latter two targets are not published.

I suggest that for most *-local targets it supports (i.e., where it
makes sense), Automake add a set of hooks
  *-local-before
  *-local-after

for which, if defined in Makefile.am, appropriate such dependency rules
are added.  For example, Automake would generate:

  clean-am: clean-local-before clean-generic clean-whatnotelse ... \
            clean-local clean-even-more ... clean-local-after
            # ...

  clean-generic clean-whatnotelse ... clean-even-more ...: \
            clean-local-before

  clean-local-after: clean-local-before clean-generic \
            clean-whatnotelse ... clean-local clean-even-more

This is just a suggestion and comes without a patch, as I clearly
haven't thought through whether this is indeed feasible or simple
to do within Automake, but I believe it would help in a number of
similar situations.  Comments appreciated (including "go for it").

Cheers,
Ralf




reply via email to

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