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).
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make