diff mbox series

[WIP,30/30] tools/build: modify uses of $(objtree) to assume trailing slash

Message ID 87d95fd7abd1449477cba6d9fc201fd4eedd7df5.1709508292.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 isn't much more than `find | sed` to adjust all uses of $(objtree).
This is split into a separate commit to highlight the actual changes to
the build machinery.

Signed-off-by: Elliott Mitchell <ehem+linux@m5p.com>
---
`grep` was also used to locate things which needed other actions
(notably the non-toplevel Makefile adjustments), but this is roughly:
find . -name Makefile\* -print0 | xargs -0 sed -i -e's,$(objtree)$,$(objtree:%/=%),' -e's,$(objtree)\([^,/]\),$(objtree:%/=%)\1,g' -es',$(objtree)/,$(objtree),g'

There could be goofs in here or missed bits.  I hope not, but...
---
 tools/perf/Makefile.perf                | 2 +-
 tools/testing/selftests/nolibc/Makefile | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 626b07d34c9f..a347500f50b6 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -150,7 +150,7 @@  srctree := $(dir $(srctree:%/=%))
 endif
 
 ifneq ($(objtree),)
-#$(info Determined 'objtree' to be $(objtree))
+#$(info Determined 'objtree' to be $(objtree:%/=%))
 endif
 
 ifneq ($(OUTPUT),)
diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 99eebfb35468..82e8d3478639 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -65,7 +65,7 @@  IMAGE_ppc64le    = arch/powerpc/boot/zImage
 IMAGE_riscv      = arch/riscv/boot/Image
 IMAGE_s390       = arch/s390/boot/bzImage
 IMAGE_loongarch  = arch/loongarch/boot/vmlinuz.efi
-IMAGE            = $(objtree)$(IMAGE_$(XARCH))
+IMAGE            = $(objtree:%/=%)$(IMAGE_$(XARCH))
 IMAGE_NAME       = $(notdir $(IMAGE))
 
 # default kernel configurations that appear to be usable
@@ -230,7 +230,7 @@  run-user: nolibc-test
 	$(Q)$(REPORT) $(CURDIR)/run.out
 
 initramfs.cpio: kernel nolibc-test
-	$(QUIET_GEN)echo 'file /init nolibc-test 755 0 0' | $(objtree)usr/gen_init_cpio - > initramfs.cpio
+	$(QUIET_GEN)echo 'file /init nolibc-test 755 0 0' | $(objtree:%/=%)usr/gen_init_cpio - > initramfs.cpio
 
 initramfs: nolibc-test
 	$(QUIET_MKDIR)mkdir -p initramfs
@@ -240,7 +240,7 @@  initramfs: nolibc-test
 defconfig:
 	$(Q)$(MAKE) -C $(srctree:%/=%) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) prepare
 	$(Q)if [ -n "$(EXTRACONFIG)" ]; then \
-		$(srctree)scripts/config --file $(objtree)/.config $(EXTRACONFIG); \
+		$(srctree)scripts/config --file $(objtree).config $(EXTRACONFIG); \
 		$(MAKE) -C $(srctree:%/=%) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) olddefconfig < /dev/null; \
 	fi