All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] Which order: $(MAKE) $(TARGET_CONFIGURE_OPTS) or $(TARGET_CONFIGURE_OPTS) $(MAKE)
Date: Wed, 29 Mar 2017 21:35:52 +0200	[thread overview]
Message-ID: <20170329213552.6455f568@free-electrons.com> (raw)
In-Reply-To: <CAAXf6LUHH5Lo=LSSfjGRQ=onT4Bm_WfLAFc0RDjfcT_ZmADmbA@mail.gmail.com>

Hello,

On Wed, 29 Mar 2017 19:58:18 +0200, Thomas De Schampheleire wrote:

> The order matters because it has impact on the precedence rules of make.
> In the case where $(MAKE) is present first, the variables are passed
> as make variables, which have precedence over variables explicitly
> defined in the makefiles.
> However, if $(MAKE) is _after_ the variable list, then the variables
> are treated as environment variables. In make, environment variables
> are directly readable as make variables, but an explicit assignment to
> such variable overwrites the value passed via the environment, unless
> the assignment is done conditionally, e.g. with ?= instead of = / :=.
> 
> Given this, if you want to make sure that the value you give is taken
> into account, the forms:
> 
>     $(MAKE) $(TARGET_CONFIGURE_OPTS)
>     $(MAKE) $(HOST_CONFIGURE_OPTS)

Sadly, doing this breaks a number of packages. Many packages that use
hand-written Makefiles do:

CFLAGS += -I../include

for example. So if you pass CFLAGS="$(TARGET_CFLAGS)" as a make
variable (i.e after $(MAKE)), then it overrides the CFLAGS of the
package Makefile, and it no longer builds.

It would work if those packages were doing:

override CFLAGS += -I../include

but they often don't do this.

Recent example:

  https://git.buildroot.org/buildroot/commit/?id=f4dc73568b08bd96aa659c5ef29226349dee05de

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2017-03-29 19:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29 17:58 [Buildroot] Which order: $(MAKE) $(TARGET_CONFIGURE_OPTS) or $(TARGET_CONFIGURE_OPTS) $(MAKE) Thomas De Schampheleire
2017-03-29 19:35 ` Thomas Petazzoni [this message]
2017-03-29 19:43   ` Thomas De Schampheleire
2017-03-29 19:49     ` Thomas Petazzoni
2017-03-30 22:33       ` Arnout Vandecappelle

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=20170329213552.6455f568@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.