title: How to include wildcard pattern in foreach statement of Makefile
body: <p>I have some rules in a makefile like below</p>
  <pre><code> ...
  
   $(MODEL_DIR)/2001.model : $(DATA_DIR)/2000.dat
      python fit.py --year 2001 --data-dir $(DATA_DIR) --output-dir $(MODEL_DIR)
  
   $(MODEL_DIR)/2002.model : $(DATA_DIR)/2000.dat $(DATA_DIR)/2001.dat 
      python fit.py --year 2002 --data-dir $(DATA_DIR) --output-dir $(MODEL_DIR)
  
   $(MODEL_DIR)/2003.model : $(DATA_DIR)/2000.dat $(DATA_DIR)/2001.dat $(DATA_DIR)/2002.dat 
      python fit.py --year 2003 --data-dir $(DATA_DIR) --output-dir $(MODEL_DIR)
  
   $(MODEL_DIR)/2004.model : $(DATA_DIR)/2000.dat $(DATA_DIR)/2001.dat $(DATA_DIR)/2002.dat $(DATA_DIR)/2003.dat 
      python fit.py --year 2004 --data-dir $(DATA_DIR) --output-dir $(MODEL_DIR)
  
   ...
  </code></pre>
  <p>This basically specifies that the model for a year depends on data from previous years having been created.</p>
  <p>I would like a simpler pattern based rule to make this less prone to copy paste errors. I tried</p>
  <pre><code>$(MODEL_DIR)/%.model : $(foreach num,$(shell seq 2000 %),$(DATA_DIR)/$(num).dat) 
      python fit.py --year $* --data-dir $(DATA_DIR) --output-dir $(MODEL_DIR)
  </code></pre>
  <p>But I get the error</p>
  <pre><code>seq: invalid floating point argument: %
  </code></pre>
  <p>indicating that the wildcard is not being expanded in the shell command.</p>