diff mbox series

[WIP,04/30] build: add trailing slash to $(*tree)

Message ID f0595a783d60c80c78a861ff70e7cf52f3a0729a.1709508290.git.ehem+linux@m5p.com (mailing list archive)
State New, archived
Headers show
Series Adding trailing slash to $(*tree) | expand

Commit Message

Elliott Mitchell March 3, 2024, 11:24 p.m. UTC
Date: Tue, 20 Feb 2024 09:13:37 -0800

This better handles the case of $({src|obj}tree) being the current
directory and $({src|obj}) being an absolute path.  Instead of being
".", $({src|obj}tree) ends up empty, and $({src|obj}) can be directly
appended.

Signed-off-by: Elliott Mitchell <ehem+linux@m5p.com>
---
I suspect the Makefile sections in tools/ are attempting to solve the
*exact* *same* issue.  Problem is that workaround requires changes in
every Makefile, whereas this looks closer to the root cause.

I'm less than 100% sure I've avoided all spacing changes.  I forget
where, but I seem to recall running into a space which was instead a tab.

`find . -name Makefile* -print0 | xargs -0 grep -e^\[\[:space:\]\]\*srctree.\*=`
is a handy way to locate these.
---
 Makefile | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index a7696f13bece..6d7758a76429 100644
--- a/Makefile
+++ b/Makefile
@@ -246,24 +246,24 @@  else # need-sub-make
 
 ifeq ($(abs_srctree),$(abs_objtree))
         # building in the source tree
-        srctree := .
+        srctree := ./
 	building_out_of_srctree :=
 else
         ifeq ($(abs_srctree)/,$(dir $(abs_objtree)))
                 # building in a subdirectory of the source tree
-                srctree := ..
+                srctree := ../
         else
-                srctree := $(abs_srctree)
+                srctree := $(abs_srctree)/
         endif
 	building_out_of_srctree := 1
 endif
 
 ifneq ($(KBUILD_ABS_SRCTREE),)
-srctree := $(abs_srctree)
+srctree := $(abs_srctree)/
 endif
 
-objtree		:= .
-VPATH		:= $(srctree)
+objtree		:= ./
+VPATH		:= $(srctree).
 
 export building_out_of_srctree srctree objtree VPATH