help-make
[Top][All Lists]
Advanced

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

Multiple pattern-specific variable assignments


From: Adrian Ashley
Subject: Multiple pattern-specific variable assignments
Date: Tue, 28 May 2002 14:25:43 +0100

Can anyone suggest a way to accomplish multiple pattern-specific variable
assignments?  This fragment illustrates what I'm trying to do.

----------snip----------
CC_GCC=gcc
CC_OTHER=another-cc

CFLAGS = -DBASIC

foo-%.o : CFLAGS += -DVARIANT=FOO

bar-%.o : CFLAGS += -DVARIANT=BAR

%-gcc.o : CFLAGS += -DGCC

%-other.o : CFLAGS += -DOTHERCC

%-gcc.o: %.c
        $(CC_GCC) $(CFLAGS) -o $@ -c $<

%-other.o: %.c
        $(CC_OTHER) $(CFLAGS) -o $@ -c $<
----------snip----------

$ make foo-gcc.o
gcc -DBASIC -DVARIANT=FOO -o foo-gcc.o -c foo.c

What happens is that only the first matching pattern is used to append to
CFLAGS - as you'd expect from the documentation and from previous threads on
this list.

Is there any way to do this kind of thing?

Thanks,
--
Adrian Ashley
address@hidden





reply via email to

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