delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/12/21:28:24

Date: Sun, 12 Oct 1997 18:25:35 -0700 (PDT)
Message-Id: <199710130125.SAA20102@adit.ap.net>
Mime-Version: 1.0
To: Rik Blok <blok AT physics DOT ubc DOT ca>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: updating command-line variables in make?

At 08:10  10/11/1997 -0700, Rik Blok wrote:
>I have a makefile with the line
>
>	CFLAGS += -I$(INCLUDE_LIBS)
>
>and I sometimes want to call the makefile with CFLAGS preset 
>
>	make CFLAGS=-g
>
>but this seems to override CFLAGS instead of just initializing it.  How
>can I make this result in 
>
>	CFLAGS = -g -I$(INCLUDE_DIRS)
>
>I'm new to make and any help would be appreciated.
A traditional solution is to do something like:
CFLAGS = $(OVERRIDE_CFLAGS) -I$(INCLUDE_DIRS)

and say
 make OVERRIDE_CFLAGS=-g

>	Rik Blok
>
>P.S. Is it possible to copy an implicit rule?  For example, is there a
>generic way to copy the rule for %:%.o to %.exe:%.o?  
No. You will probably have to write it yourself. (It's usually a bad idea to
depend on implicit rules anyway, IMHO).

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019