title: Unexpected execution order when pattern rule depends on another pattern rule
body: <p>I'm having trouble getting targets to execute in the order I expect. This is my <code>Makefile</code>:</p>
  <pre><code>.PHONY: deploy.%
  deploy.%: DEPLOY_ENV=$*
  deploy.%: fetch.% publish
      @echo &quot;[deploy] $(DEPLOY_ENV)&quot;
  
  .PHONY: publish
  publish:
      @echo &quot;[publish]&quot;
  
  .PHONY: fetch.%
  fetch.%: DEPLOY_ENV=$*
  fetch.%:
      @echo &quot;[fetch] $(DEPLOY_ENV)&quot;
  </code></pre>
  <p>This is the command I'm running:</p>
  <pre><code>make deploy.dev
  </code></pre>
  <h4>Desired output</h4>
  <p>I want the <code>fetch</code> target to run <strong>before</strong> <code>publish</code>, like this:</p>
  <pre><code>[fetch] dev
  [publish]
  [deploy] dev
  </code></pre>
  <h4>Actual output</h4>
  <p>Make always runs the <code>publish</code> target first:</p>
  <pre><code>[publish]
  [fetch] dev
  [deploy] dev
  </code></pre>
  <h4>Debug output</h4>
  <pre><code>$ make --debug=i deploy.dev
  GNU Make 3.81
  Copyright (C) 2006  Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.
  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
  PARTICULAR PURPOSE.
  
  This program built for i386-apple-darwin11.3.0
  Reading makefiles...
  Updating goal targets....
   File `deploy.dev' does not exist.
   Looking for an implicit rule for `deploy.dev'.
   Trying pattern rule with stem `dev'.
   Trying implicit prerequisite `fetch.dev'.
   Trying pattern rule with stem `deploy.dev'.
   Trying implicit prerequisite `deploy.dev,v'.
   Trying pattern rule with stem `deploy.dev'.
   Trying implicit prerequisite `RCS/deploy.dev,v'.
   Trying pattern rule with stem `deploy.dev'.
   Trying implicit prerequisite `RCS/deploy.dev'.
   Trying pattern rule with stem `deploy.dev'.
   Trying implicit prerequisite `s.deploy.dev'.
   Trying pattern rule with stem `deploy.dev'.
   Trying implicit prerequisite `SCCS/s.deploy.dev'.
   Trying pattern rule with stem `dev'.
   Trying implicit prerequisite `fetch.dev'.
   Looking for a rule with intermediate file `fetch.dev'.
    Avoiding implicit rule recursion.
    Trying pattern rule with stem `dev'.
   Trying rule prerequisite `publish'.
   Found an implicit rule for `deploy.dev'.
     File `publish' does not exist.
    Must remake target `publish'.
  [publish]
    Successfully remade target file `publish'.
    File `fetch.dev' does not exist.
   Must remake target `fetch.dev'.
  [fetch] dev
   Successfully remade target file `fetch.dev'.
  Must remake target `deploy.dev'.
  [deploy] dev
  Successfully remade target file `deploy.dev'.
  </code></pre>