help-make
[Top][All Lists]
Advanced

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

Re: Advanced expansion of prereg pattern?


From: Boris Kolpackov
Subject: Re: Advanced expansion of prereg pattern?
Date: Thu, 5 May 2005 09:10:32 +0000 (UTC)
User-agent: nn/6.6.5+RFC1522

Lars Noschinski <address@hidden> writes:

> I have the following directory structure:
>
> exercise01.tex
> exercise01/a-drawing.fig
> exercise01/another-figure.fig
> exercise02.tex
> exercise02/...
>
> So I want to compile the .tex files, which depend on the .fig files
> converted to .eps before.
>
> My first try was a rule like the first one below (I know it is not
> correct, but I think it is clear what I try to achieve):
>
> %.pdf: %.tex %/*.eps
>     .....
>
> %.eps: %.fig
>     .....
>
> This will obviously not work, and it seems also impossible to replace
> "%/*.eps" like
>
>     $(wildcard $@/*.eps)
>
> or
>     $(filter $@/%,$drawings)
>
> where $drawings is a list of all fig files in all subdirectories.
>
> So it looks to me like I would need to generate dependencies by using an
> little shell script, but before I do this, I want to be sure that make
> cannot do this for itself ;)

Make from CVS (and soon to be released 3.81) can do this but not current
release (3.80). Meantime you can use $(call), $(eval) and target-specific
variables to do the trick:

# $1 - directory, e.g., exercise01, exercise02
#
define set-eps-deps
$1: eps := $(patsubst %.fix,%.eps,$(wildcard $1/*.fig))
endef

exercises := exercise01.tex exercise02.tex ...

$(for e,$(exercises),$(eval $(call set-eps-deps,$(basename $e))))

%.pdf: %.tex $(eps)
  .....

%.eps: %.fig
  .....

hth,
-boris





reply via email to

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