]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
kbuild: Use relative path when building in a subdir of the source tree
authorMichal Marek <mmarek@suse.cz>
Fri, 25 Apr 2014 21:25:18 +0000 (23:25 +0200)
committerMichal Marek <mmarek@suse.cz>
Wed, 14 May 2014 20:43:05 +0000 (22:43 +0200)
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>
Makefile

index 3e134ec4c3d339b8e1723a6032c548c819c4c9b2..f4702c10b2b8daba066f6e3c796db7c2ab1f3488 100644 (file)
--- 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)