git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Lars Schneider <larsxschneider@gmail.com>
Subject: Re: [RCF/PATCH] Makefile: move 'ifdef DEVELOPER' after config.mak* inclusion
Date: Wed, 1 Jun 2016 04:03:48 -0400	[thread overview]
Message-ID: <20160601080348.GA22528@sigill.intra.peff.net> (raw)
In-Reply-To: <vpqpos11gv3.fsf@anie.imag.fr>

On Wed, Jun 01, 2016 at 09:57:20AM +0200, Matthieu Moy wrote:

> Jeff King <peff@peff.net> writes:
> 
> > Hmm. So I think this does fix some issues, but it also means that one's
> > config.mak cannot use DEVELOPER as a base and then override particular
> > flags.
> 
> You mean, using "make DEVELOPER=1" and then tweak CFLAGS in config.mak?
> 
> Well, you still can do "CFLAGS += ..." (the extra CFLAGS will come
> before the ones added by DEVELOPER instead of after), which should cover
> 99% use-cases.

I specifically meant this, that your flags will now come before the
DEVELOPER ones. So they will not override for any options which are
parsed in command-line order (e.g., -Wno-error=something-specific).

> You can't do "CFLAGS = $(filter-out ..., $(CFLAGS))" anymore indeed. But
> if you are at that level of customization, I'd say DEVELOPER isn't for
> you and you should just set CFLAGS directly.

Yes, though it would be nice if the developer cflags were in a separate
variable to make that easier to play with.

Perhaps:

  DEVELOPER_CFLAGS += -Wfoo
  DEVELOPER_CFLAGS += -Wbar
  ...
  -include config.mak
  ...
  ifdef DEVELOPER
  CFLAGS += $(DEVELOPER_CFLAGS)
  endif

would be more flexible.

I don't currently use filter-out, but I do have compiler-specific flags
(which I accomplish by just not adding them in the first place for
certain compilers). For example, you may notice that:

  make DEVELOPER=1 CC=clang

is broken (clang doesn't know -Wold-style-declaration).

-Peff

  parent reply	other threads:[~2016-06-01  8:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31 13:24 [RCF/PATCH] Makefile: move 'ifdef DEVELOPER' after config.mak* inclusion Matthieu Moy
2016-05-31 17:00 ` Junio C Hamano
2016-06-01  7:30 ` Jeff King
2016-06-01  7:57   ` Matthieu Moy
2016-06-01  8:00     ` [PATCH] Makefile: add $(DEVELOPER_CFLAGS) variable Matthieu Moy
2016-06-01  8:03     ` Jeff King [this message]
2016-06-01  8:05       ` [RCF/PATCH] Makefile: move 'ifdef DEVELOPER' after config.mak* inclusion Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160601080348.GA22528@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=larsxschneider@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).