git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] add DEVELOPER makefile knob to check for acknowledged warnings

From
Jeff King <peff@peff.net>
Date
May 10, 2017, 04:59 UTC
Message-ID
<20170510045914.adtb5qmnc53z4vdq@sigill.intra.peff.net>
In-Reply-To
<CACBZZX4=QePHqDFnxvTSJ4siNv6TVzUvhCpA91aY8APZTpGEfQ@mail.gmail.com>
On Tue, May 02, 2017 at 03:22:23PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 13 quoted lines
> 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
Previous: Ævar Arnfjörð Bjarmason
Message 12 of 12 in “add DEVELOPER makefile knob to check for acknowledged warnings”
  1. add DEVELOPER makefile knob to check for acknowledged warningslarsxschneider@gmail.com, Feb 25, 2016
  2. Matthieu MoyFeb 25, 2016
  3. Michael HaggertyFeb 25, 2016
  4. Junio C HamanoFeb 25, 2016
  5. Lars SchneiderFeb 26, 2016
  6. Duy NguyenFeb 26, 2016
  7. Lars SchneiderFeb 26, 2016
  8. Duy NguyenFeb 26, 2016
  9. Lars SchneiderFeb 28, 2016
  10. Duy NguyenFeb 28, 2016
  11. Ævar Arnfjörð BjarmasonMay 2, 2017
  12. Jeff KingMay 10, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.