From: Michal Marek Date: Fri, 25 Apr 2014 21:25:18 +0000 (+0200) Subject: kbuild: Use relative path when building in a subdir of the source tree X-Git-Tag: v3.16~235^2~6 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9da0763b;p=people%2Faperard%2Flinux.git kbuild: Use relative path when building in a subdir of the source tree When doing make O=, 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 Signed-off-by: Michal Marek --- diff --git a/Makefile b/Makefile index 3e134ec4c3d33..f4702c10b2b8d 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)