title: Nested for loop not working in makefile
body: <p>I am trying to use a nested for loop for searching and copying some files inside the recipe of one of the targets inside a makefile:</p>
  
  <pre><code>DIR = $(DIR_A) $(DIR_B)
  
  install:
        for dirs in $(DIR); do \
          for file in $(shell find $(dirs) -type f -and -not -path "*/.svn*" | sed -e "s|$(dirs)||"); do \
          folder=$${file%/*}; \
            $(INSTALL) -d $(DEST_DIR)$$folder/log; \
            $(INSTALL) $(dirs)/$$file $(DEST_DIR)$$folder/log; \
          done \
        done
  </code></pre>
  
  <p>However $(dirs) variable always evaluates to empty inside the second for loop and the current working directory gets passed to "find" instead of first directory path from $(DIR).</p>
  
  <p>Can someone please suggest if I am missing something ?</p>
  
  <p>Thanks.</p>