[PATCH v2 5/5] kbuild: Use relative path when building in a subdir of the source tree
From: Michal Marek
Date: Fri May 09 2014 - 08:53:20 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>
---
v1->v2: No changes
Makefile | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 4da1c4b..9872c53 100644
--- a/Makefile
+++ b/Makefile
@@ -153,7 +153,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.8.4.5
--
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/