Seeing the make complexity makes me happy that I abandoned make a few years
ago in favor of scons in which you have a real language (python) to express
your dependencies:

import glob
import re

for f in glob.glob("*.eps") :
    Command(re.sub(".eps","_fixed.eps", name),
                    name,
                    ["eps2eps $SOURCE > $TARGET"])

Regards,
Dov

2008/12/18 Oleg Goldshmidt <[email protected]>

> "Jason Friedman" <[email protected]> writes:
>
> > Hi all,
> >
> > I have had this make question that has been bugging me for a long time.
> >
> > I want to fix some eps files using eps2eps. This is the makefile I use:
> >
> > figure1_fixed.eps: figure1.eps
> > [tab] eps2eps $< $@
> >
> > (replace [tab] with the tab character)
> >
> > This works fine, but when I have many eps files to convert, I have to
> > repeat the command line many times. A similar problem is this one:
> >
> > figure2.eps: ../../some/other/path/some_long_ugly_filename.eps
> >
> > After lots of googling, I have not been able to find a solution. Is
> > there a way to do this in make, if not, can you suggest another tool
> > that can do this? I have been running into variants of this problem
> > several times.
>
> Hi Jason,
>
> For a fellow Penn State postdoc (I was there in 1995) let me offer a
> variant of Omer's solution with some enhancements and a bit simpler
> syntax (works with GNU make, I assume this is the case as it is a
> Linux list):
>
> ######################################################
>
> # list directories where files to be fixed live
> VPATH := /long/ugly/path:/some/other/path/too
>
> # list all files to be fixed here
> ORIG := figure1.eps figure2.eps
> FIXED := $(ORIG:.eps=_fixed.eps)
>
> # you can override this if eps2eps lives in a
> # different place from default
> FIX := /usr/bin/eps2eps
>
> fix:    $(FIXED)
>
> %_fixed.eps: %.eps
> ifdef HERE
>        $(FIX) $< $@
> else
>        $(FIX) $< $(dir $<)$@
> endif
>
> PHONY:  fix
>
> #######################################################
>
> With this, simple "make fix" will put each fixed file in the same
> directory with the original, while "make fix HERE=yes" will collect
> the fixed files in the current directory. The makefile searches VPATH
> so you can move the originals around, etc.
>
> --
> Oleg Goldshmidt | [email protected]
>
> =================================================================
> To unsubscribe, send mail to [email protected] with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail [email protected]
>
>

Reply via email to