help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using make for latex


From: Paul Smith
Subject: Re: using make for latex
Date: Sat, 18 Sep 2010 14:28:39 -0400

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.

I recommend you use a variable:

ifndef SKIPCOMMAND1
command1 = command1
endif

define TEX_RECIPE
    $(TOOL) ... args ...
    $(command1)
    $(TOOL) ... args ...
    command2
    command3
    $(TOOL) ... args ...
endef

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]