Skip to content

Commit

Permalink
kbuild: Use relative path when building in a subdir of the source tree
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michal Marek committed May 14, 2014
1 parent 890676c commit 9da0763
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9da0763

Please sign in to comment.