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,vpath.new,$@))
>>  gcc -c -o $(subst vpath,vpath.new,$@) $<
>
> 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.


HTH,
Cheng



_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to