[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
patterns
From: |
Jim Gale |
Subject: |
patterns |
Date: |
Fri, 5 Oct 2001 14:07:54 -0700 |
User-agent: |
Mutt/1.2.5i |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |