[Top][All Lists]

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

Re: Matching subdirectories in patterns?

From: CHEN Cheng
Subject: Re: Matching subdirectories in patterns?
Date: Thu, 24 Sep 2009 10:45:14 +0800
User-agent: Mutt/1.5.17 (2007-11-01)

On Wed, Sep 23, 2009 at 08:59:42PM -0500, Roy Stogner wrote:
> On Thu, 24 Sep 2009, CHEN Cheng wrote:
>> IIUC, a generic pattern rule may help:
>> all : vpath/subdir/test.o
>> %.o : %.c
>>  mkdir -p $(dir $(subst vpath,,$@))
>>  gcc -c -o $(subst vpath,,$@) $<
> Thank you, but unless I'm misunderstanding how the rule would work,
> I'm not sure it's suitable for our documents.
> I'm worried about how it would handle duplicated filenames.  Having
> the same document use figures like "rawfigs/experiment1/results.eps"
> and "rawfigs/experiment2/results.eps" would not be unlikely, and make
> would have to have some way of knowing to use the first source to
> generate "figs/experiment1/results.pdf" but the second source to
> generate "figs/experiment2/results.pdf"

I'm sorry that a mistake needs to be corrected.

As the manual (section 10.8) says, if there is a slash in the pattern,
then the full path name will be matched. So the solution shall be:

all: figs/experiment1/results.pdf figs/experiment2/results.pdf

figs/%.pdf : rawfigs/%.eps
  mkdir -p $(dir $@)
  epstopdf -o=$@ $<

My previous suggestion is not good because the dependency is a fake that
your figs would be always made everytime you invoke make.


reply via email to

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