help-make
[Top][All Lists]
Advanced

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

Executing Commands for Items in a List?


From: Jonah Bishop
Subject: Executing Commands for Items in a List?
Date: Tue, 9 Feb 2010 16:32:57 -0500

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.

Here's a Perl variant of what I'm trying to do:

@myDirs = ("alpha", "bravo", "charlie", "delta", "foxtrot");

foreach(@myDirs)
{
# Do some shell related stuff (copy files, move files, chmod, etc)
}

How can I do that in a Makefile? Suppose my variable looks like the following:

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?

Thanks in advance!
Jonah

reply via email to

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