Thanks,

Let me explain my original problem -and may be you'll find a better
solution for me :-)

I want to launch a number of make processes in different directories.
unfortunatlly each one needs a different target to be made.
I can do it like this:

      $(MAKE) -C $(dir1)  $(target1)
      $(MAKE) -C $(dir2)  $(target2)
      $(MAKE) -C $(dir3)  $(target3)
      ....
      ...


Is there a better way ?


Yossi




                                                                                       
                                          
                      Der Herr Hofrat                                                  
                                          
                      <[EMAIL PROTECTED]         To:      
[EMAIL PROTECTED]                                        
                      ofr.at>                  cc:      [EMAIL PROTECTED]              
                                          
                      Sent by:                 Subject: Re: handling two parallel 
lists                                          
                      help-make-admin@                                                 
                                          
                      gnu.org                                                          
                                          
                                                                                       
                                          
                                                                                       
                                          
                      14/08/2002 10:21                                                 
                                          
                                                                                       
                                          
                                                                                       
                                          



> Hi,
>
> I have two lists with same number of items in each one.
>
> DIRS  is a list of directories
> TARGETS  is a list  of targets
>
> I want to do something like:
>
> foreach num from 1 to MAX_NUM
> $(MAKE) -C $(DIR)[$num]  $(TARGET)[$num]
>
>
> Is there a way to do it in make, or should I use shell instead ?
>
you could use the foreach function but you would have to pack the "1 to
MAX_NUM"
into a variable that you have to generate with a shell call as there is no
for loop available in the way you are suggesting it.

Alternatively if you simply want to handle the rule for every numeric
subdir
in a specific directory then you can use make builtin functions.

something like

---Makefile.dirlist---
all: dirlist

top_dir := .
DIRS := $(foreach dir,$(top_dir),$(wildcard $(dir)/[0-9]*))

dirlist:
             @echo $(DIRS)


should be able to fill in the DIRS variable with all existing numeric
directory names in $(top_dir). The targets can then be generated the
same way.


hofrat

_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make





_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to