title: Foreach template in makefile recipe
body: <p>Given the following Makefile fragment:</p>
  
  <pre><code>TOOLS=foo bar
  
  define TOOL_install
  install -c $(1) $$(prefix)/bin/$(1)
  endef
  
  .PHONY: install
  install: all
          $(foreach tool,$(TOOLS),$(eval $(call TOOL_install,$(tool))))
  </code></pre>
  
  <p>Why does <code>make install</code> print "Nothing to be done for `install'." instead of executing the commands specified by the foreach?  (There is a tab before the foreach, and I have tried putting a tab inside the TOOL_install definition; it doesn't help.)</p>
  
  <p>According to <code>make -p</code> the install target has no commands, which is obviously not as intended.</p>
  
  <p>Elsewhere in the same makefile I've successfully used the same technique to create entire rules including command recipes; how can I make this work within an existing rule?</p>
  
  <p>(If I replace <code>eval</code> with <code>info</code> then it prints the commands that I am expecting it to run.)</p>
  
  <p>In this simple case I can get it to work by inlining the command:</p>
  
  <pre><code>install: all
          @$(foreach tool,$(TOOLS),install -c $(tool) $(prefix)/bin/$(tool) ; )
  </code></pre>
  
  <p>But I would like to know how to get the first form to work as expected, in case I need something more complicated in future.</p>