kbuild: Use relative path when building in the source tree
authorMichal Marek <mmarek@suse.cz>
Fri, 25 Apr 2014 15:36:14 +0000 (17:36 +0200)
committerMichal Marek <mmarek@suse.cz>
Wed, 14 May 2014 20:43:05 +0000 (22:43 +0200)
When not using O=, $(srctree) refers to the same directory as
$(objtree), so we can set it to '.' as well. This makes the default
include path more compact and results in more readable messages from the
compiler. The only case where we need the absolute path is when creating
the 'source' symlink in /lib/modules.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Makefile

index dec0845..3e134ec 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -149,7 +149,7 @@ else
 _all: modules
 endif
 
-srctree                := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
+srctree                := $(if $(KBUILD_SRC),$(KBUILD_SRC),.)
 objtree                := .
 src            := $(srctree)
 obj            := $(objtree)
@@ -1059,7 +1059,7 @@ _modinst_:
        @rm -rf $(MODLIB)/kernel
        @rm -f $(MODLIB)/source
        @mkdir -p $(MODLIB)/kernel
-       @ln -s $(srctree) $(MODLIB)/source
+       @ln -s `cd $(srctree) && /bin/pwd` $(MODLIB)/source
        @if [ ! $(objtree) -ef  $(MODLIB)/build ]; then \
                rm -f $(MODLIB)/build ; \
                ln -s $(CURDIR) $(MODLIB)/build ; \