help-make
[Top][All Lists]
Advanced

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

Re: clean recursively into sub-directories


From: John Calcote
Subject: Re: clean recursively into sub-directories
Date: Tue, 29 Apr 2008 09:26:05 -0600
User-agent: Thunderbird 2.0.0.12 (X11/20080226)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Paul,

Hmmm, I guess Automake's been doing it wrong all these years...

BTW, I see your points, and I agree. I'm just wondering why, if this
method that you (and the manual) mention is more correct, Automake has
not been retrofitted years ago to handle this syntax. Could it have
something to do with the fact that some of the syntax you use is GNU
make specific?

John

Paul Smith wrote:
> On Tue, 2008-04-29 at 08:57 -0600, John Calcote wrote:
> 
>> You have multiple conflicting rules for "all" and "clean".
> 
> This is true.  You may only have one recipe defined for a given target.
> Else, how can make know which one you want to run?
> 
>> Here's the right way to do this (untested):
> 
> But this is not correct.  See the GNU make manual for a number of
> reasons why this model (using a for-loop in a single rule) is a bad way
> to handle subdirectory makes.
> 
> Hongliang's method of handling "all" is correct and appropriate.
> 
> However, to have a different set of rules that also are run in
> subdirectories, you have to create different targets.  Something like:
> 
>         SUBCLEAN = $(addsuffix .clean,$(SUBDIRS))
>         
>         .PHONY: clean $(SUBCLEAN)
>         clean: $(SUBCLEAN)
>         
>         $(SUBCLEAN): %.clean:
>               $(MAKE) -C $* -f Makefile.hvr_gcc clean
> 
> (untested).  There are a lot of ways to do this but you need to do
> something like it.
> 
>> all clean:
>>         for dir in $(SUBDIRS); do \
>>        $(MAKE) -C $$dir -f Makefile.hvr_gcc $@; \
>>         done
> 
>> Cleaner and simpler.
> 
> But, not correct :-).  For example, what happens if one of the submakes
> fails?  That's not even mentioning the problems this brings if you want
> to run parallel builds.
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFIFz4NdcgqmRY/OH8RAj2SAKCDfU5LDF7UVaDh0Lk0qMpxkfyg8ACeJ6GI
/67V8867gzjHO2XKnJ4UMF8=
=VYtD
-----END PGP SIGNATURE-----




reply via email to

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