Mail Archives: djgpp/1998/01/22/13:47:57
On 16 Jan 1998 15:28:14 GMT in comp.os.msdos.djgpp Ruiter de M
<mdruiter AT cs DOT vu DOT nl> wrote:
: I want to do, in a makefile:
: # -*- makefile -*-
: 10/%.enc: 10/%.jpg
: same commands
: 20/%.enc: 20/%.jpg
: same commands
: ...
: 90/%.enc: 90/%.jpg
: same commands
: Any ideas?
I'm sorry for the delayed reply, I thought you'd already been answered
satisfactorily. Anyway, I think this might point you in the right
direction:
:TARGETS = $(patsubst %.b,%.a,$(wildcard */*.b))
:
:.PHONY: all
:
:all: $(TARGETS)
:
:%.a: %.b
: @echo "wibble $< $@"
: @touch $@
With directories 10 and 20 and input files 10/foo.b, 10/bar.b,
20/foo.b the output was:
wibble 10/bar.b 10/bar.a
wibble 10/foo.b 10/foo.a
wibble 20/foo.b 20/foo.a
The effect, then, is to pick out the names of all *.b files one
directory level lower than the current directory, change the
extensions to `.a', put them in the variable TARGETS. Make these
dependencies of `all', the first rule in the file, so that they all
become goals. Then define a pattern rule telling Make how to create
a %.a file from %.b.
I think this is pretty much what you wanted; you'll have to tweak of
course. This was running on a DEC Alpha, but it ought to work on
djgpp too AFAICS.
Remember, with GNU Make [almost] anything is possible... ;)
--
george DOT foot AT merton DOT oxford DOT ac DOT uk
- Raw text -