[Top][All Lists]

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

Help me simplify this makefile

From: Bob Stark
Subject: Help me simplify this makefile
Date: Mon, 24 Mar 2008 19:05:53 -0400

I have a directory full of word documents (..\courses) that I want to
programmatically convert into a separate directory of adobe PDF files
(..\pdf), using make.

It seems that this should be a simple project, but it is eluding me.

After some hours, I wrote the make file below, which works. I run in from
the PDF directory (the output directory), so as to follow Paul's Make file
rule # 2.

The makefile below will be a bear to maintain (as there are actually several
thousand files). I don't want to hard-code the targets, as I have done; I
merely want EVERY word document converted to a corresponding PDF document,
if the word document has been updated or if the PDF document does not exist.

Can someone guide me thru proper use of the wildcard function, or whatever
approach is the "best practice" here?


Bob Stark 
# Makefile for building PDF outlines from word documents w/ gnu make

.SUFFIXES  :                      # Clean out default suffixes
.SUFFIXES  : .pdf .doc            # Define suffixes that make acts on

vpath %.doc ../courses


all : ${outline1}.pdf           \
      ${outline2}.pdf           \
      ${outline3}.pdf           \
      ${outline4}.pdf           \
      ${outline5}.pdf           \
      ${outline6}.pdf           \
      ${outline7}.pdf           \
      ${outline8}.pdf           \

${outline1}.pdf : ${outline1}.doc
${outline2}.pdf : ${outline2}.doc
${outline3}.pdf : ${outline3}.doc
${outline4}.pdf : ${outline4}.doc
${outline5}.pdf : ${outline5}.doc
${outline6}.pdf : ${outline6}.doc
${outline7}.pdf : ${outline7}.doc
${outline8}.pdf : ${outline8}.doc

  # Generic rule to create intermediate PDF files from Word documents
%.pdf : %.doc
        printdoc -PRINTER="Adobe PDF" -EXITWORD=YES -OUTDIR=. -FILES=${<}

reply via email to

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