On Sat, 2010-09-18 at 12:43 -0400, James wrote:
> %.dvi: TOOL := latex
> %.pdf: TOOL := pdflatex
>
> define TEX_RECIPE
> $(TOOL) ... args ...
> command1
> $(TOOL) ... args ...
> command2
> command3
> $(TOOL) ... args ...
> endef
>
> %.dvi: %.tex
> $(TEX_RECIPE)
> %.pdf: %.tex
> $(TEX_RECIPE)
Thanks very much. Exactly what I was looking for.
Welcome. Please remember to keep the mailing list CC'd for posterity.
If possible, I would like to add one more complexity. Can I use an
ifdef/ifndef inside of the recipe?
Not in this situation, because the variable is expanded in the context
of a recipe. Hence the entire contents of the variable are passed to
the shell to be executed.
I tried this:
define TEX_RECIPE
$(TOOL) ... args ...
ifndef SKIPCOMMAND1
command1
endif
$(TOOL) ... args ...
command2
command3
$(TOOL) ... args ...
endef
When I try this, I get:
process_begin: CreateProcess(NULL, #ifndef SKIPCOMMAND1, ...) failed.
Ah! Windows! Anyway, that's expected because the recipe is sent to the
shell, and so the shell tries to run teh "ifndef" program.