help-make
[Top][All Lists]
Advanced

[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 10:01:35 -0400

%% "Adrian Ashley" <address@hidden> writes:

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

  aa> foo-%.o : CFLAGS += -DVARIANT=FOO
  aa> bar-%.o : CFLAGS += -DVARIANT=BAR

  aa> %-gcc.o : CFLAGS += -DGCC
  aa> %-other.o : CFLAGS += -DOTHERCC

You could put one of these into a different variable, like:

  %-gcc.o : CCTYPE = -DGCC
  %-other.o : CCTYPE = -DOTHERCC

Then:

 %-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



reply via email to

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