[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multiple pattern-specific variable assignments
From: |
Paul D. Smith |
Subject: |
Re: Multiple pattern-specific variable assignments |
Date: |
Tue, 28 May 2002 13:23:34 -0400 |
%% "Adrian Ashley" <address@hidden> writes:
aa> Tried that:
Oh right. Duh. Need to remember to drink my morning tea before
responding :).
aa> I hesitate to call this a bug, as the documentation does say that
aa> pattern rule matching proceeds until the first match and then
aa> stops. But perhaps there's a case for arguing that if the effect
aa> is only to set target- or pattern-specific variables, then all
aa> patterns which match should do so cumulatively (perhaps excepting
aa> terminal ones?)
Not sure what you mean by "terminal ones" in this context, but I agree
that stopping at the first pattern is perhaps not useful behavior for
target-specific variable patterns. I'll think about this.
aa> Or is there a Cunning Trick?
Well, you can always fall back to old-fashioned recursive variables :)
CC_GCC=gcc
CC_OTHER=another-cc
CFLAGS = -DBASIC
foo-%.o : CFLAGS += -DVARIANT=FOO
bar-%.o : CFLAGS += -DVARIANT=BAR
gcc-CFLAGS = -DGCC
other-CFLAGS = -DOTHERCC
CCTYPE = $($(patsubst $*-%.o,%,$@)-CFLAGS)
%-gcc.o: %.c
$(CC_GCC) $(CCTYPE) $(CFLAGS) -o $@ -c $<
%-other.o: %.c
$(CC_OTHER) $(CCTYPE) $(CFLAGS) -o $@ -c $<
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://www.paulandlesley.org/gmake/
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist