title: Change make's working directory without long command line
body: <p>I would like to change the working directory of a makefile.</p>
  <p>(Extraneous info: I have a legacy makefile that I mostly want to reuse, though many targets and generated deps files make assume that the working directory will not be different. My idea is to create a makefile for my newer project, which is in a different directory, and include the old one, and set the working directory to the old directory.)</p>
  <p>I easily can do this from the command line with</p>
  <pre><code>make -f /path/to/new/makefile -C /path/to/old/makefile
  </code></pre>
  <p>The users of this makefile would like not to type that out every time.</p>
  <hr />
  <h3>Attempt 1</h3>
  <p>Use <code>MAKEFLAGS</code> in the makefile itself. But neither of these seem to have any effect. (I understand why <code>-f</code> couldn't have an effect; I'm really wondering about <code>-C</code>.)</p>
  <p>I've looked at <a href="http://www.gnu.org/software/make/manual/html_node/Options-Summary.html" rel="nofollow noreferrer">http://www.gnu.org/software/make/manual/html_node/Options-Summary.html</a>, but I can't find anything about what is allowed in <code>MAKEFLAGS</code> and what isn't.</p>
  <hr />
  <h3>Attempt 2</h3>
  <p>Create a <code>makefile2</code> with the new targets</p>
  <pre><code>include path/to/old/makefile
  
  foo: bar
  </code></pre>
  <p>and then <code>makefile</code> passes everything through</p>
  <pre><code>%:
      $(MAKE) -f $(abspath makefile2) -C path/to/old/makfele /$*
  </code></pre>
  <p>I don't get nice autocompletion, parallel jobs don't work, and debug options (dry run) doesn't work.</p>
  <hr />
  <p>So</p>
  <p>(1) Why doesn't <code>-C</code> work <code>MAKEFLAGS</code> (it does work, but I made a mistake; it doesn't work, and it is documented; it doesn't work, and it is not documented but it is intentional; it doesn't work, and it is a bug)?</p>
  <p>(2) Is there a better way of change a makefile's working directory?</p>