summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorPeter Maydell2012-10-19 15:54:23 +0200
committerBlue Swirl2012-10-27 16:41:13 +0200
commitd1bd2423a90a144576cd140dc84b1fe8c7c8fda0 (patch)
tree1a5464003a797897421486bdf7b659fc93a37ada /Makefile
parenttests/tcg: fix a few warnings (diff)
downloadqemu-d1bd2423a90a144576cd140dc84b1fe8c7c8fda0.tar.gz
qemu-d1bd2423a90a144576cd140dc84b1fe8c7c8fda0.tar.xz
qemu-d1bd2423a90a144576cd140dc84b1fe8c7c8fda0.zip
Makefile: Forbid out-of-tree build from a source tree that has been built in
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> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile11
1 files changed, 11 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 17e2d58ce5..b522b10195 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