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: Sam Ravnborg
Subject: Re: Help-make Digest, Vol 77, Issue 5
Date: Thu, 9 Apr 2009 08:54:08 +0200
User-agent: Mutt/1.4.2.1i

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]