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 10:24:19 -0400

On Sat, 2010-09-18 at 14:17 +0000, Greg Chicares wrote:
> %.dvi: TOOL := latex
> %.pdf: TOOL := pdflatex
> 
> %.dvi %.pdf: %.tex
>         @echo 'Sample command: $(TOOL) --input=$< --output=$@'
>         # ...further commands here...

You need to write these rules separately; the above doesn't do what I
think the OP wanted.  Best is to use a variable to hold the commands,
along with the target-specific variable:

%.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)

-- 
-------------------------------------------------------------------------------
 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]