[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simulating multiple wildcards in a match using .SECONDEXPANSION?

From: Michael R. Head
Subject: Re: Simulating multiple wildcards in a match using .SECONDEXPANSION?
Date: Sat, 04 Apr 2009 00:02:57 -0400

On Fri, 2009-04-03 at 23:38 -0400, Michael R. Head wrote:
> I'd like to make a rule that generates a output file for each pair in
> the cross product of two lists of input files. I have a simple makefile
> that does what I want, but it's ugly. 
> I'm wondering if anyone has any suggestions on improving it. At a
> minimum, I'd like to get rid of the foreachs in the targets.

Here's one tiny improvement:

As=a1 a2 a3
Bs=b4 b5 b6
ABs=$(foreach a,$(As),$(foreach b,$(Bs),$(a)_$(b)))
A=$(filter-out $@,$(foreach b,$(Bs),$(subst _$(b),,$@)))
B=$(filter-out $@,$(foreach a,$(As),$(subst $(a)_,,$@)))
A_SE=$$(filter-out $$@,$$(foreach b,$$(Bs),$$(subst _$$(b),,$$@)))
B_SE=$$(filter-out $$@,$$(foreach a,$$(As),$$(subst $$(a)_,,$$@)))

all: $(ABs)

$(As) $(Bs):


$(ABs): $(A_SE) $(B_SE)
        @echo $@: $^
        @echo A=$A, B=$B

Michael R. Head <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]