"Jason Friedman" <write.to.ja...@gmail.com> 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 | p...@goldshmidt.org ================================================================= To unsubscribe, send mail to linux-il-requ...@cs.huji.ac.il with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail linux-il-requ...@cs.huji.ac.il