summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2014-04-25 23:25:18 +0200
committerMichal Marek <mmarek@suse.cz>2014-05-14 22:43:05 +0200
commit9da0763bdd82572be243fcf5161734f11568960f (patch)
tree96a4b40fc2b5dc6044687ff448963ea9ee8a66f1
parent890676c65d699db3ad82e7dddd0cf8fb449031af (diff)
kbuild: Use relative path when building in a subdir of the source tree
When doing make O=<subdir>, use '..' to refer to the source tree. This allows for more readable compiler messages, and, more importantly, it sets the VPATH to '..', so filenames in WARN_ON() etc. will be shorter. Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
-rw-r--r--Makefile12
1 files changed, 11 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 3e134ec4c3d..f4702c10b2b 100644
--- a/Makefile
+++ b/Makefile
@@ -149,7 +149,17 @@ else
_all: modules
endif
-srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),.)
+ifeq ($(KBUILD_SRC),)
+ # building in the source tree
+ srctree := .
+else
+ ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
+ # building in a subdirectory of the source tree
+ srctree := ..
+ else
+ srctree := $(KBUILD_SRC)
+ endif
+endif
objtree := .
src := $(srctree)
obj := $(objtree)