title: Change a make variable, and call another rule, from a recipe in same Makefile?
body: <p>I have already seen <a href="https://stackoverflow.com/questions/5377297/how-to-manually-call-an-other-target-from-a-make-target">How to manually call another target from a make target?</a>, but my question is a bit different; consider this example (note, stackoverflow.com changes the tabs to spaces in display; but tabs are preserved in source, if you try to edit):</p>
  
  <pre><code>TEXENGINE=pdflatex
  
  pdflatex:
      echo the engine is $(TEXENGINE)
  
  lualatex:
      TEXENGINE=lualatex
      echo Here I want to call the pdflatex rule, to check $(TEXENGINE) there!
  </code></pre>
  
  <p>Here, if I run the default target (<code>pdflatex</code>), I get the expected output:</p>
  
  <pre><code>$ make pdflatex 
  echo the engine is pdflatex
  the engine is pdflatex
  </code></pre>
  
  <p>But, with the target <code>lualatex</code>, I want to: </p>
  
  <ul>
  <li>change the <code>make</code> variable <code>TEXENGINE</code> to <code>lualatex</code>, and then </li>
  <li>call the same code as in <code>pdflatex</code> (which uses it). </li>
  </ul>
  
  <p>How could I do that? </p>
  
  <p>Clearly, in my <code>lualatex</code> rule I don't even manage to change the <code>TEXENGINE</code> variable, because I get this when I try it:</p>
  
  <pre><code>$ make lualatex 
  TEXENGINE=lualatex
  echo Here I want to call the pdflatex rule, to check pdflatex there!
  Here I want to call the pdflatex rule, to check pdflatex there!
  </code></pre>
  
  <p>... so I would really like to know if something like this is possible in Makefiles.</p>