All,
I have a tricky make problem that maybe you can help with.
I have a list of `types' and a list of source files. For
each type I want to create a new file based on the type and
the source file.
The command for creating the new files looks something like:
$(COMPILE) <type> $< > $@
where <type> is replaced somehow with one of the tokens in
the TYPES list.
An example is something like:
TYPES = a b
FILES = foo.cpp bar.cpp
would result in 4 files:
foo_a.o
foo_b.o
bar_a.o
bar_b.o
if TYPES was changed to:
TYPES = a b d
I would expect:
foo_a.o
foo_b.o
foo_d.o
bar_a.o
bar_b.o
bar_d.o
I am familiar with normal % patterns, but it seems like I
need multiple patterns here. If it was possible to have
two patterns in a rule, with the second wild-card being ? and
the corresponding variable being $(*2), I would be able to
make a rule like this:
OFILES = $(foreach type,$(TYPES),$(patsubst %.cpp,%_$(type).o))
$(OFILES): %_?.o: %.cpp
$(COMPILE) $(*2) $< > $@
But since---as far as I know---this is not possible, what are
my alternatives?
Thanks for your help,
Jim
_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make