On Tue, Feb 9, 2010 at 4:45 PM, Paul Smith <[email protected]> wrote:

> On Tue, 2010-02-09 at 16:32 -0500, Jonah Bishop wrote:
> > I'd like to do what I think should be very simple, but I can't find
> > any examples of what I'm trying to do. I have a variable in a make
> > file that has a bunch of directory names in it, and I'd like to
> > perform multiple actions on those directory names, namely by "looping"
> > over the list. The "foreach" construct was what I went to initially,
> > and might be the right goods, but I can't figure out the right syntax.
>
> > DIRS = alpha bravo charlie delta foxtrot
> >
> > All I want to do is "loop" over that list, performing some shell
> > operations (or issuing other commands) on those directories. Is there
> > a simple way to do that?
>
> The simplest way is to use shell constructs:
>
>        dostuff:
>                for dir in $(DIRS); do \
>                        stuff-1 $$dir ; \
>                        stuff-2 $$dir ; \
>                done
>
> There are a lot of sub-optimal things about this, such as no parallel
> capability, no error handling, etc. but without more details about what
> you really want to do that's the simplest solution that will solve your
> problem.
>
>
>
Here's some more information that may be helpful. I have a bunch of child
directories that each have their own makefiles. I want to iterate over a
list of those directories, changing into each, and issuing the appropriate
make call in each. Similarly, I'd like to have a "make clean" target to do
the same thing: loop over the directories and do the appropriate "make
clean" call.

Hopefully that makes things a little clearer.
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to