[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Append value on the command line to a predefined macro in the make f
From: |
Greg Chicares |
Subject: |
Re: Append value on the command line to a predefined macro in the make file |
Date: |
Thu, 28 Jan 2010 15:57:19 +0000 |
User-agent: |
Thunderbird 2.0.0.23 (Windows/20090812) |
On 2010-01-28 15:12Z, Guan Wang wrote:
>
> CPPFLAGS=-DFOO
[...]
> %.o:%.c
> gcc -c $< ${CPPFLAGS}
>
> if I make it and run a.out (I am on a GNU Make 3.81), the output is
> FOO!. If I want to print out BAR! or FOO!BAR!, I could always append -
> DBAR onto CPPFLAGS.
>
> So, my question is: what if I want to append -DBAR on the command
> line?
>
> I tried: make CPPFLAGS+=-DBAR
>
> But it will completely replace the defined CPPFLAGS in the Makefile.
Put the default in one variable, and the overridding value in
another. See "Variables for Specifying Commands" in the gnu
make manual (the ALL_CFLAGS example).