help-make
[Top][All Lists]
Advanced

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

Re: Help-make Digest, Vol 77, Issue 5


From: xiangfeng shen
Subject: Re: Help-make Digest, Vol 77, Issue 5
Date: Fri, 10 Apr 2009 09:45:33 +0800

Hi Sam,
 
I want to replace the for loop to avoid BAD DO.
So i tried the 3) method, but it does not work :(
any more suggestion?
 
thanks.
carl
2009/4/9 Sam Ravnborg <address@hidden>
On Thu, Apr 09, 2009 at 02:27:43PM +0800, xiangfeng shen wrote:
> Hi,
>
> I have a question about how to replace for loop in clearmake to avoid bad
> DO.
> Makefile:
>
> SUBDIRS = foo bar baz
>
> subdirs:
>
> for dir in $(SUBDIRS); do \
>
> $(MAKE) -C $$dir; \
>
> done

So you want to execute $(MAKE) for each dir.
There are several ways to do so:

1) Using the shell

subdirs:
       for D in $(SUBDIRS); do make -C $D; done

2) Using the builtin shell
subdirs:
       $(foreach D, $(SUBDIRS), $(shell $(MAKE) -C $D))

3) Using dependencies

subdirs: $(SUBDIRS)

$(SUBDIRS):
       $(MAKE) -C $@


This is all from memory and un-tested..

       Sam


reply via email to

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