qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Makefile: Forbid out-of-tree build from a source tree that has been built in
@ 2012-10-19 13:54 Peter Maydell
  2012-10-19 17:57 ` Blue Swirl
  2012-10-27 16:54 ` Blue Swirl
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2012-10-19 13:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches

If we try to do an out-of-tree build but the source tree we're building from
has been used in the past for an in-tree build then things will go
confusingly wrong. Specifically, some parts of the build process will pull
in generated files from the old in-tree build (because SRC_PATH is on
the vpath). Diagnose this situation so we can produce a useful error
message and tell the user how to fix it (run distclean in the source tree).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
I got bitten by this again the other day so I figured it was worth
adding a molly-guard. The check is not perfect (it won't notice if
you did a distclean but didn't delete the *-softmmu &c directories,
for instance) but it should catch most cases of this user error.

 Makefile |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Makefile b/Makefile
index a9c22bf..5094a08 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,17 @@ ifneq ($(wildcard config-host.mak),)
 # Put the all: rule here so that config-host.mak can contain dependencies.
 all:
 include 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
+
 include $(SRC_PATH)/rules.mak
 config-host.mak: $(SRC_PATH)/configure
 	@echo $@ is out-of-date, running configure
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] Makefile: Forbid out-of-tree build from a source tree that has been built in
  2012-10-19 13:54 [Qemu-devel] [PATCH] Makefile: Forbid out-of-tree build from a source tree that has been built in Peter Maydell
@ 2012-10-19 17:57 ` Blue Swirl
  2012-10-27 16:54 ` Blue Swirl
  1 sibling, 0 replies; 3+ messages in thread
From: Blue Swirl @ 2012-10-19 17:57 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

On Fri, Oct 19, 2012 at 1:54 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> If we try to do an out-of-tree build but the source tree we're building from
> has been used in the past for an in-tree build then things will go
> confusingly wrong. Specifically, some parts of the build process will pull
> in generated files from the old in-tree build (because SRC_PATH is on
> the vpath). Diagnose this situation so we can produce a useful error
> message and tell the user how to fix it (run distclean in the source tree).
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

OK, but maybe we should deprecate in-tree build and warn if it is detected.

> ---
> I got bitten by this again the other day so I figured it was worth
> adding a molly-guard. The check is not perfect (it won't notice if
> you did a distclean but didn't delete the *-softmmu &c directories,
> for instance) but it should catch most cases of this user error.
>
>  Makefile |   11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index a9c22bf..5094a08 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -8,6 +8,17 @@ ifneq ($(wildcard config-host.mak),)
>  # Put the all: rule here so that config-host.mak can contain dependencies.
>  all:
>  include 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
> +
>  include $(SRC_PATH)/rules.mak
>  config-host.mak: $(SRC_PATH)/configure
>         @echo $@ is out-of-date, running configure
> --
> 1.7.9.5
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] Makefile: Forbid out-of-tree build from a source tree that has been built in
  2012-10-19 13:54 [Qemu-devel] [PATCH] Makefile: Forbid out-of-tree build from a source tree that has been built in Peter Maydell
  2012-10-19 17:57 ` Blue Swirl
@ 2012-10-27 16:54 ` Blue Swirl
  1 sibling, 0 replies; 3+ messages in thread
From: Blue Swirl @ 2012-10-27 16:54 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

Thanks, applied.

On Fri, Oct 19, 2012 at 1:54 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> If we try to do an out-of-tree build but the source tree we're building from
> has been used in the past for an in-tree build then things will go
> confusingly wrong. Specifically, some parts of the build process will pull
> in generated files from the old in-tree build (because SRC_PATH is on
> the vpath). Diagnose this situation so we can produce a useful error
> message and tell the user how to fix it (run distclean in the source tree).
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I got bitten by this again the other day so I figured it was worth
> adding a molly-guard. The check is not perfect (it won't notice if
> you did a distclean but didn't delete the *-softmmu &c directories,
> for instance) but it should catch most cases of this user error.
>
>  Makefile |   11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index a9c22bf..5094a08 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -8,6 +8,17 @@ ifneq ($(wildcard config-host.mak),)
>  # Put the all: rule here so that config-host.mak can contain dependencies.
>  all:
>  include 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
> +
>  include $(SRC_PATH)/rules.mak
>  config-host.mak: $(SRC_PATH)/configure
>         @echo $@ is out-of-date, running configure
> --
> 1.7.9.5
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-27 16:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-19 13:54 [Qemu-devel] [PATCH] Makefile: Forbid out-of-tree build from a source tree that has been built in Peter Maydell
2012-10-19 17:57 ` Blue Swirl
2012-10-27 16:54 ` Blue Swirl

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).