help-make
[Top][All Lists]
Advanced

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

Re: Interating over Target List with Jobs?


From: Per Jessen
Subject: Re: Interating over Target List with Jobs?
Date: Tue, 01 Jun 2010 08:58:26 +0200
User-agent: KNode/0.10.4

Philip Guenther wrote:

> On Sun, May 30, 2010 at 3:30 PM, Erik Rull <address@hidden>
> wrote:
>> Per Jessen wrote:
> ...
>>> clean1:
>>> make -C mod1 clean
>>> clean2:
>>> make -C mod2 clean
> ...
>>> clean: clean1 clean2 clean3 clean4 clean5
>>
>> Hm, well, yes - this could be possbile - but quite brute-force ;-)
>> If I add a new module, just the list of targets gets extended and
>> I've nothing to change in the makefile - with your approach a new
>> clean rule must be added manually.
> 
> If only there was some way to express a set of rules that all followed
> a pattern.  We could even call them "pattern rules"...
> 
> clean-%:
>         ${MAKE} -C ${@:clean-%=%} clean
> 
> clean: $(foreach mod,${MODULE_LIST},clean-${mod})
> 

Yep, that's exactly what I was hinting at. 

If the module list isn't fixed, you could take a little step further:

clean: $(foreach mod,$(shell find moduledir -type d),clean-${mod})

Of course, replace 'find moduledir -type d' with whatever will give you
a suitable list of directories.


/Per Jessen, Zürich




reply via email to

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