help-make
[Top][All Lists]
Advanced

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

Re: (no subject)


From: d3
Subject: Re: (no subject)
Date: Tue, 16 Mar 2004 10:18:37 +0100
User-agent: Internet Messaging Program (IMP) 3.0

Citeren "Paul D. Smith" <address@hidden>:

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

Hi Paul,

Thank you for your answer. This is exactly what I needed.

Bye,

Douwe.





reply via email to

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