title: How to specify a makefile target in a different directory?
body: <p>I am trying to figure out why I can't specify a target as being in different directory.</p>
  
  <p>I am trying to generate some php classes from json files, but I've changed the line that actually generates the php to a dummy echo statement, so somebody else can just copy paste and test if they feel very generous. </p>
  
  <p>There are two other things to add to the directory containing the makefile:</p>
  
  <ul>
  <li>A dummy dependency file called PatientDbPath.json</li>
  <li>A directory called out</li>
  </ul>
  
  <p>If  I have a makefile with the following:</p>
  
  <pre><code>.SUFFIXES: .php .json
  .json.php:
      echo "HelloMe" &gt; PatientDbPath.php
  
  PatientDbPath.php: PatientDbPath.json
  
  clean:
      $(RM) PatientDbPath.php
  </code></pre>
  
  <p>Then everything works when I run make; PatientDbPath.php  is correctly created and the next time I run make, I get the message <code>make: 'PatientDbPath.php' is up to date.</code></p>
  
  <p>However, I want to generate the php file in a separate directory, so I updated my makefile to the following:</p>
  
  <pre><code>.SUFFIXES: .php .json
  .json.php:
      echo "HelloMe" &gt; out/PatientDbPath.php
  
  out/PatientDbPath.php: PatientDbPath.json
  
  clean:
      $(RM) out/PatientDbPath.php
  </code></pre>
  
  <p>As soon as I do that, Make tells me <code>make: Nothing to be done for 'out/PatientDbPath.php'</code> even though there is no file PatientDbPath.php in the out directory.</p>
  
  <p>So I thought maybe it was something with the suffix rules and I created a third makefile.</p>
  
  <pre><code>out/PatientDbPath.php: PatientDbPath.json
      echo "Whatever" &gt; out/PatientDbPath.php
  
  clean:
      rm out/PatientDbPath.php
  </code></pre>
  
  <p>This one works well, like the first one. Can anybody see what I'm doing wrong in my 2nd makefile?</p>
  
  <p>Thanks.</p>