Skip to contentSkip to conversation

kbuild: drop $(objtree)/ prefix support for clean-files

PATCH In review Masahiro Yamada 2 participants 3 messages Apr 30, 2022 – May 3, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: drop $(objtree)/ prefix support for clean-files

I think this hack is a bad idea. arch/powerpc/boot/Makefile is the only user. Let's stop doing this.

---

 arch/powerpc/boot/Makefile | 4 ++--
 scripts/Makefile.clean     | 8 +-------
 2 files changed, 3 insertions(+), 9 deletions(-)
arch/powerpc/boot/Makefile +2 -2
index 4b4827c475c6..008bf0bff186 100644
@@ -453,8 +453,8 @@ clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
 clean-kernel-base := vmlinux.strip vmlinux.bin
 clean-kernel := $(addsuffix .gz,$(clean-kernel-base))
 clean-kernel += $(addsuffix .xz,$(clean-kernel-base))
-# If not absolute clean-files are relative to $(obj).
-clean-files += $(addprefix $(objtree)/, $(clean-kernel))
+# clean-files are relative to $(obj).
+clean-files += $(addprefix ../../../, $(clean-kernel))
 
 WRAPPER_OBJDIR := /usr/lib/kernel-wrapper
 WRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts
scripts/Makefile.clean +1 -7
index 74cb1c5c3658..878cec648959 100644
@@ -36,13 +36,7 @@ __clean-files	:= \
 
 __clean-files   := $(filter-out $(no-clean-files), $(__clean-files))
 
-# clean-files is given relative to the current directory, unless it
-# starts with $(objtree)/ (which means "./", so do not add "./" unless
-# you want to delete a file from the toplevel object directory).
-
-__clean-files   := $(wildcard                                               \
-		   $(addprefix $(obj)/, $(filter-out $(objtree)/%, $(__clean-files))) \
-		   $(filter $(objtree)/%, $(__clean-files)))
+__clean-files   := $(wildcard $(addprefix $(obj)/, $(__clean-files)))
 
 # ==========================================================================
 
Signature · 1 line
2.32.0
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Masahiro Yamada

I think this hack is a bad idea. arch/powerpc/boot/Makefile is the only user. Let's stop doing this.

---

 arch/powerpc/boot/Makefile | 4 ++--

cheers

Quoted 39 lines
 scripts/Makefile.clean     | 8 +-------
 2 files changed, 3 insertions(+), 9 deletions(-)
arch/powerpc/boot/Makefile +2 -2
index 4b4827c475c6..008bf0bff186 100644
@@ -453,8 +453,8 @@ clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
 clean-kernel-base := vmlinux.strip vmlinux.bin
 clean-kernel := $(addsuffix .gz,$(clean-kernel-base))
 clean-kernel += $(addsuffix .xz,$(clean-kernel-base))
-# If not absolute clean-files are relative to $(obj).
-clean-files += $(addprefix $(objtree)/, $(clean-kernel))
+# clean-files are relative to $(obj).
+clean-files += $(addprefix ../../../, $(clean-kernel))
 
 WRAPPER_OBJDIR := /usr/lib/kernel-wrapper
 WRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts
scripts/Makefile.clean +1 -7
index 74cb1c5c3658..878cec648959 100644
@@ -36,13 +36,7 @@ __clean-files	:= \
 
 __clean-files   := $(filter-out $(no-clean-files), $(__clean-files))
 
-# clean-files is given relative to the current directory, unless it
-# starts with $(objtree)/ (which means "./", so do not add "./" unless
-# you want to delete a file from the toplevel object directory).
-
-__clean-files   := $(wildcard                                               \
-		   $(addprefix $(obj)/, $(filter-out $(objtree)/%, $(__clean-files))) \
-		   $(filter $(objtree)/%, $(__clean-files)))
+__clean-files   := $(wildcard $(addprefix $(obj)/, $(__clean-files)))
 
 # ==========================================================================
 
Signature · 1 line
2.32.0
#2 lore raw
Quoted 5 lines · Michael Ellerman
Quoted 3 lines · Masahiro Yamada

I think this hack is a bad idea. arch/powerpc/boot/Makefile is the only user. Let's stop doing this.

Quoted 9 lines
Quoted 4 lines

---

 arch/powerpc/boot/Makefile | 4 ++--

cheers

Applied to linux-kbuild.

Quoted 39 lines
Quoted 39 lines
 scripts/Makefile.clean     | 8 +-------
 2 files changed, 3 insertions(+), 9 deletions(-)
arch/powerpc/boot/Makefile +2 -2
index 4b4827c475c6..008bf0bff186 100644
@@ -453,8 +453,8 @@ clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
 clean-kernel-base := vmlinux.strip vmlinux.bin
 clean-kernel := $(addsuffix .gz,$(clean-kernel-base))
 clean-kernel += $(addsuffix .xz,$(clean-kernel-base))
-# If not absolute clean-files are relative to $(obj).
-clean-files += $(addprefix $(objtree)/, $(clean-kernel))
+# clean-files are relative to $(obj).
+clean-files += $(addprefix ../../../, $(clean-kernel))
 
 WRAPPER_OBJDIR := /usr/lib/kernel-wrapper
 WRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts
scripts/Makefile.clean +1 -8
index 74cb1c5c3658..878cec648959 100644
@@ -36,13 +36,7 @@ __clean-files      := \
 
 __clean-files   := $(filter-out $(no-clean-files), $(__clean-files))
 
-# clean-files is given relative to the current directory, unless it
-# starts with $(objtree)/ (which means "./", so do not add "./" unless
-# you want to delete a file from the toplevel object directory).
-
-__clean-files   := $(wildcard                                               \
-                $(addprefix $(obj)/, $(filter-out $(objtree)/%, $(__clean-files))) \
-                $(filter $(objtree)/%, $(__clean-files)))
+__clean-files   := $(wildcard $(addprefix $(obj)/, $(__clean-files)))
 
 # ==========================================================================
 
--

2.32.0

Signature · 2 lines
Best Regards
Masahiro Yamada