[Top][All Lists]

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

Re: (no subject)

From: Paul D. Smith
Subject: Re: (no subject)
Date: Thu, 11 Mar 2004 16:52:08 -0500

%% address@hidden writes:

  d> I have two direcories:
  d>  - xmldocs with files named abc<pattern>def.xml
  d>  - txtdocs with files named rst<pattern>uvw.txt

  d> There's a command which converts xml to txt, f.e. abc001def.xml to
  d> rst001uvw.txt.

  d> I'm looking for a rule that for every xml file in xmldocs
  d> looks in txtdocs for the corresponding txt-version of the
  d> file. If it is older or doesn't exist then it has to be made.
  d> xmldocs/abc%def.xml:  txtdocs/rst%uvw.txt
  d>    convert $@ $<

That's good.

  d> I tried this, but you have to call make for every file in
  d> xmldocs. I would like make to detect new(er) xml files and convert
  d> them to txt automatically.

You have to tell make what you want to build.  Add a line like this:

  XML_FILES = abc001def.xml abc002def.xml <...>

  .PHONY: all
  all: $(XML_FILES:abc%def.xml=txtdocs/rst%uvw.txt)

and away you go.

If you want make to determine the list for you, do something like:

  XML_FILES := $(wildcard xmldocs/abc*def.xml)

  .PHONY: all
  all: $(XML_FILES:xmldocs/abc%def.xml=txtdocs/rst%uvw.txt)

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "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]