[PATCH] kbuild: Use relative path when building in a subdir of the source tree
From: Michal Marek
Date: Fri Apr 25 2014 - 17:25:18 EST
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@xxxxxxxxxxxx>
Signed-off-by: Michal Marek <mmarek@xxxxxxx>
---
Makefile | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 3e134ec..f4702c1 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)
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/