help-make
[Top][All Lists]
Advanced

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

Re: Help me simplify this makefile


From: Paul Smith
Subject: Re: Help me simplify this makefile
Date: Tue, 25 Mar 2008 00:31:53 -0400

On Mon, 2008-03-24 at 19:05 -0400, Bob Stark wrote:
> .SUFFIXES  : .pdf .doc

You don't need to define .SUFFIXES if you're using pattern rules;
they're only used for old-style suffix rules.  It won't hurt, though.

You left out one crucial detail when describing your setup: what is the
directory containing the makefile?  What is the directory where you will
be when you run make?

Will you be in the courses directory?  Or the pdf directory?  Or the
parent of those two directories?  Or in another sibling of those
directories?

Without knowing that we can't give you a complete answer.  However,
using wildcard is simple enough: $(wildcard ../courses/*.doc).  Given
your "printdoc" command doesn't seem to specify an output file I'll
assume that you're running make from the pdf directory.

In that case, write your makefile something like this:

  DOCFILES := $(notdir $(wildcard ../courses/*.doc))

  all: $(DOCFILES:%.doc=%.pdf)

  %.pdf : ../courses/%.doc
            printdoc -PRINTER="Adobe PDF" -EXITWORD=YES -OUTDIR=. -FILES=$<

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.us
 "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]