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


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to