I have already seen How to manually call another target from a make target?, 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):
TEXENGINE=pdflatex
pdflatex:
echo the engine is $(TEXENGINE)
lualatex:
TEXENGINE=lualatex
echo Here I want to call the pdflatex rule, to check $(TEXENGINE) there!
Here, if I run the default target (pdflatex
), I get the expected output:
$ make pdflatex
echo the engine is pdflatex
the engine is pdflatex
But, with the target lualatex
, I want to:
- change the
make
variableTEXENGINE
tolualatex
, and then - call the same code as in
pdflatex
(which uses it).
How could I do that?
Clearly, in my lualatex
rule I don't even manage to change the TEXENGINE
variable, because I get this when I try it:
$ 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!
... so I would really like to know if something like this is possible in Makefiles.