On Tue, May 02, 2017 at 03:22:23PM +0200, Ævar Arnfjörð Bjarmason wrote: > Is there any way with this to both supply CFLAGS & DEVELOPER=1 on the > command-line, to get my custom -O<whatever> & these -W flags? I.e.: > > $ make DEVELOPER=1 V=1 > [...] -g -O2 -Wall -Werror -Wdeclaration-after-statement > -Wno-format-zero-length -Wold-style-definition -Woverflow > -Wpointer-arith -Wstrict-prototypes -Wunused -Wvla -I. [...] > $ make DEVELOPER=1 CFLAGS="-g -O0 -Wall" V=1 > [...] -g -O0 -Wall -I. [...] > > I thought the second case would prepend my "-g -O0 -Wall" but then be > followed by the various -W developer flags, but it isn't, am I just > doing something stupid, or is there no way to combine these two? The problem is that when you give "make" a variable on the command line, it overrides all of the modifications. So if you were to set that CFLAGS in your config.mak, I think everything would work as you expect. I actually do this in my config.mak: O = 0 CFLAGS += -g -O$(O) which lets me override the optimization level as a one-off on the command-line: make O=2 without disturbing the rest of the CFLAGS. I also do this: CFLAGS += $(EXTRA_CFLAGS) as a catch-all, so that I can do: make EXTRA_CFLAGS=-Wone-off-warning-that-I-am-testing Perhaps those are things the main Makefile should support. I dunno. You could see the full depths of my depravity at: https://github.com/peff/git/blame/meta/config/config.mak (I linked to the blame view because there are a lot of WTF bits in there that are explained by the commit messages). -Peff