title: Makefile pattern rule with variable in target
body: <p>I'm using Gnu Make 3.81, and getting an error trying to match a pattern rule that also has a variable in it.</p>
  
  <p>Here's the smallest example I could come up with:</p>
  
  <pre><code>YYMMDD:=$(shell date +%y%m%d)
  TMP_DIR:=/tmp/$(YYMMDD)
  
  # create a temporary directory, and put a "source" file in it
  $(TMP_DIR):
      mkdir $(TMP_DIR)
      echo something &gt; $(TMP_DIR)/somefile.orig
  
  # to build an "object" file in the temp dir, process the "source" file
  $(TMP_DIR)/%.new: $(TMP_DIR)/%.orig
      wc -l $&lt; &gt; $@
  
  atarget: $(TMP_DIR) $(TMP_DIR)/somefile.new
  </code></pre>
  
  <p>Then when I run <code>make atarget</code>, I get:</p>
  
  <pre><code>mkdir /tmp/141021
  echo something &gt; /tmp/141021/somefile.orig
  make: *** No rule to make target `/tmp/141021/somefile.new', needed by `atarget'.  Stop.
  </code></pre>
  
  <p>Shouldn't this work?  it seems like the pattern rule should match this just fine.</p>