help-make
[Top][All Lists]
Advanced

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

Re: redefining variables based on target


From: Boris Kolpackov
Subject: Re: redefining variables based on target
Date: Thu, 5 Aug 2004 20:26:36 +0000 (UTC)
User-agent: nn/6.6.5+RFC1522

"Tanuz, Adam R" <address@hidden> writes:


> I am working on a project and am trying to move from the sun make
> to the gnu make.  I have found that the following method for
> switching between the debug option and the optimization option
> doesn't work in gnu make.  Is their a way to do this in gnu?
> I would appreciate any help at all.

GNU make has target- and pattern-specific variables with 
inheritance. You can read about them in GNU make manual.


> CC68KOPTS = -Wall -fno-builtin $(CC_DEFINES) $(TST_FLG)
> 
> CC_68K = cc68k
> 
> #
> all:= CC_68K += $(CC68KOPTS) -O2
> all: $(EXEC) $(TEXEC) 
> 
> debug := CC_68K += $(CC68KOPTS) -g 
> debug:  $(EXEC) $(TEXEC)  
> 
> obj/$(TGT)/%.o: %.c
>       $(CC_68K) -c -o $@ $(INC_DIR) $<


In GNU make you would write:


CC68KOPTS := -Wall -fno-builtin $(CC_DEFINES) $(TST_FLG)
 
CC_68K := cc68k

all: CC_68K += $(CC68KOPTS) -O2
all: $(EXEC) $(TEXEC) 
 
debug: CC_68K += $(CC68KOPTS) -g 
debug: $(EXEC) $(TEXEC)  

 
obj/$(TGT)/%.o: %.c
        $(CC_68K) -c -o $@ $(INC_DIR) $<


-boris





reply via email to

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