qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] Makefile: Don't build generated headers before Makefile is reread
Date: Mon, 30 Jun 2014 14:09:37 +0200	[thread overview]
Message-ID: <53B15381.7060308@redhat.com> (raw)
In-Reply-To: <1403974776-23966-1-git-send-email-peter.maydell@linaro.org>

Il 28/06/2014 18:59, Peter Maydell ha scritto:
> Having a direct dependency
>    Makefile: $(GENERATED_HEADERS)
> can result in not-from-clean builds failing sometimes, because it means
> that when Make does its "is any makefile or include out of date and
> needing a rebuild?" check, as well as possibly running configure (to
> update config-host.mak) it will also rebuild GENERATED_HEADERS under
> the "old" config-host.mak regime. If the makefile rules for rebuilding
> the generated headers have changed in a way that means they're not
> compatible with the old config-host.mak variable names, the build will
> fail. Even if it does work, it's wasted effort since we'll need to
> rebuild them with the right config-host.mak settings immediately.
>
> Instead, make the generated headers depend on config-host.mak
> and config-target.mak. This means we'll definitely rebuild them
> if the configuration changes, but it will be done after Make
> reloads its makefiles and includes so will happen with the
> correct set of config-host.mak settings.
>
> We rely on the various .o files having correct autogenerated
> dependency rules to cause the generated headers to be generated
> as and when they are needed.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> The specific example of this is the change from CONFIG_TRACE_BACKEND
> to CONFIG_TRACE_BACKENDS, which I am still hitting on a pretty
> regular basis. This patch fixes that problem and I don't think it
> has any unpleasant side effects; Paolo, have I missed anything?
>
>  Makefile        | 8 +++-----
>  Makefile.target | 2 +-
>  2 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 145adb6..dca33b4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -546,11 +546,9 @@ ifdef SIGNCODE
>  endif # SIGNCODE
>  endif # CONFIG_WIN
>
> -# Add a dependency on the generated files, so that they are always
> -# rebuilt before other object files
> -ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
> -Makefile: $(GENERATED_HEADERS)
> -endif
> +# Make the generated files depend on config-host.mak so that if
> +# the configuration settings change we will rebuild them
> +$(GENERATED_HEADERS): config-host.mak
>
>  # Include automatically generated dependency files
>  # Dependencies in Makefile.objs files come from our recursive subdir rules
> diff --git a/Makefile.target b/Makefile.target
> index 6089d29..ea8614a 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -198,4 +198,4 @@ ifdef CONFIG_TRACE_SYSTEMTAP
>  endif
>
>  GENERATED_HEADERS += config-target.h
> -Makefile: $(GENERATED_HEADERS)
> +$(GENERATED_HEADERS): config-target.mak config-devices.mak

config-devices.mak is not reflected in any C header file.  Apart from this,

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

  reply	other threads:[~2014-06-30 12:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-28 16:59 [Qemu-devel] [PATCH] Makefile: Don't build generated headers before Makefile is reread Peter Maydell
2014-06-30 12:09 ` Paolo Bonzini [this message]
2014-06-30 12:13   ` Peter Maydell
2014-06-30 12:34     ` Paolo Bonzini
2014-06-30 12:42       ` Peter Maydell
2014-06-30 12:45         ` Paolo Bonzini
2014-07-04 14:33   ` Peter Maydell
2014-07-04 15:47     ` Paolo Bonzini
2014-07-08 12:03     ` Peter Maydell

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=53B15381.7060308@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).