qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Alexander Graf" <agraf@suse.de>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-block@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Fam Zheng" <famz@redhat.com>,
	qemu-trivial@nongnu.org, "Alberto Garcia" <berto@igalia.com>,
	qemu-ppc@nongnu.org, "Kevin Wolf" <kwolf@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Max Reitz" <mreitz@redhat.com>,
	"Max Filippov" <jcmvbkbc@gmail.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"Peter Crosthwaite" <crosthwaite.peter@gmail.com>,
	qemu-arm@nongnu.org, "Yongbok Kim" <yongbok.kim@mips.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Igor Mitsyanko" <i.mitsyanko@gmail.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Richard Henderson" <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH v2 1/5] make: improve check for stale generated files in source dir
Date: Fri, 23 Mar 2018 15:31:58 +0100	[thread overview]
Message-ID: <20180323143202.28879-2-lvivier@redhat.com> (raw)
In-Reply-To: <20180323143202.28879-1-lvivier@redhat.com>

From: Daniel P. Berrangé <berrange@redhat.com>

When doing a build with builddir != srcdir, if any generated files are
accidentally present in srcdir from a previous build, these can cause
unexpected failures.

Currently there is a rule that checks for existance of config-host.mak,
but there have been cases where config-host.mak is absent, while other
generated files still exist.

Update the check to look at every file listed in $(GENERATED_FILES). To
do this we must move the check further down after $(GENERATED_FILES) has
been populated.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 Makefile | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 727ef118f3..d588a13687 100644
--- a/Makefile
+++ b/Makefile
@@ -52,16 +52,6 @@ endif
 
 .git-submodule-status: git-submodule-update config-host.mak
 
-# Check that we're not trying to do an out-of-tree build from
-# a tree that's been used for an in-tree build.
-ifneq ($(realpath $(SRC_PATH)),$(realpath .))
-ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
-$(error This is an out of tree build but your source tree ($(SRC_PATH)) \
-seems to have been used for an in-tree build. You can fix this by running \
-"$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
-endif
-endif
-
 CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
 CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
 CONFIG_XEN := $(CONFIG_XEN_BACKEND)
@@ -1028,6 +1018,25 @@ ifdef SIGNCODE
 endif # SIGNCODE
 endif # CONFIG_WIN
 
+define nl
+
+
+endef
+
+CHECK_FILES = config-host.mak $(filter-out .git-submodule-status, $(GENERATED_FILES))
+UNEXPECTED_FILES = $(wildcard $(CHECK_FILES:%=$(SRC_PATH)/%))
+
+# Check that we're not trying to do an out-of-tree build from
+# a tree that's been used for an in-tree build.
+ifneq ($(realpath $(SRC_PATH)),$(realpath .))
+ifneq ($(UNEXPECTED_FILES),)
+$(error Stale files in source tree:${nl}${nl} $(UNEXPECTED_FILES:%=  %${nl}) ${nl}\
+This is an out of tree build but your source tree ($(SRC_PATH)) \
+seems to have been used for an in-tree build. You can fix this by running \
+"$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
+endif
+endif
+
 # Add a dependency on the generated files, so that they are always
 # rebuilt before other object files
 ifneq ($(wildcard config-host.mak),)
-- 
2.14.3

  reply	other threads:[~2018-03-23 14:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 14:31 [Qemu-devel] [PATCH v2 0/5] coccinelle: re-run scripts from scripts/coccinelle Laurent Vivier
2018-03-23 14:31 ` Laurent Vivier [this message]
2018-03-23 14:31 ` [Qemu-devel] [PATCH v2 2/5] error: Strip trailing '\n' from error string arguments (again again) Laurent Vivier
2018-03-23 16:59   ` Eric Blake
2018-03-23 14:32 ` [Qemu-devel] [PATCH v2 3/5] error: Remove NULL checks on error_propagate() calls Laurent Vivier
2018-03-23 19:14   ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
2018-03-23 14:32 ` [Qemu-devel] [PATCH v2 4/5] qdict: remove useless cast Laurent Vivier
2018-03-27  3:10   ` Fam Zheng
2018-03-23 14:32 ` [Qemu-devel] [PATCH v2 5/5] Remove unnecessary variables for function return value Laurent Vivier
2018-03-24  0:24   ` David Gibson
2018-03-23 16:26 ` [Qemu-devel] [PATCH v2 0/5] coccinelle: re-run scripts from scripts/coccinelle no-reply
2018-03-23 17:47 ` Eric Blake
2018-03-23 22:08   ` Laurent Vivier

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=20180323143202.28879-2-lvivier@redhat.com \
    --to=lvivier@redhat.com \
    --cc=agraf@suse.de \
    --cc=armbru@redhat.com \
    --cc=aurelien@aurel32.net \
    --cc=berrange@redhat.com \
    --cc=berto@igalia.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=famz@redhat.com \
    --cc=i.mitsyanko@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=yongbok.kim@mips.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).