[PATCH 2/2] kbuild: use more subdir- for visiting subdirectories while cleaning

2021-10-13 Thread Masahiro Yamada
Documentation/kbuild/makefiles.rst suggests to use "archclean" for
cleaning arch/$(SRCARCH)/boot/.

Since commit d92cc4d51643 ("kbuild: require all architectures to have
arch/$(SRCARCH)/Kbuild"), we can use the "subdir- += boot" trick for
all architectures. This can take advantage of the parallel option (-j)
for "make clean".

I also cleaned up the comments. The "archdep" target does not exist.

Signed-off-by: Masahiro Yamada 
---

 Documentation/kbuild/makefiles.rst | 17 ++---
 arch/alpha/Kbuild  |  3 +++
 arch/alpha/Makefile|  3 ---
 arch/arc/Kbuild|  3 +++
 arch/arc/Makefile  |  3 ---
 arch/arm/Kbuild|  3 +++
 arch/arm/Makefile  |  4 
 arch/arm64/Kbuild  |  3 +++
 arch/arm64/Makefile|  7 ---
 arch/arm64/kernel/Makefile |  3 +++
 arch/csky/Kbuild   |  3 +++
 arch/csky/Makefile |  3 ---
 arch/h8300/Kbuild  |  3 +++
 arch/h8300/Makefile|  3 ---
 arch/ia64/Makefile |  2 --
 arch/m68k/Makefile |  4 +---
 arch/microblaze/Kbuild |  3 +++
 arch/microblaze/Makefile   |  3 ---
 arch/mips/Kbuild   |  3 +++
 arch/mips/Makefile |  8 +---
 arch/mips/boot/Makefile|  3 +++
 arch/nds32/Kbuild  |  3 +++
 arch/nds32/Makefile|  3 ---
 arch/nios2/Kbuild  |  3 +++
 arch/nios2/Makefile|  6 +-
 arch/openrisc/Kbuild   |  3 +++
 arch/openrisc/Makefile |  7 +--
 arch/parisc/Kbuild |  3 +++
 arch/parisc/Makefile   |  7 +--
 arch/powerpc/Kbuild|  3 +++
 arch/powerpc/Makefile  |  7 +--
 arch/riscv/Kbuild  |  3 +++
 arch/riscv/Makefile|  7 +--
 arch/s390/Kbuild   |  3 +++
 arch/s390/Makefile |  8 +---
 arch/sh/Kbuild |  3 +++
 arch/sh/Makefile   |  3 ---
 arch/sparc/Kbuild  |  3 +++
 arch/sparc/Makefile|  3 ---
 arch/x86/Kbuild|  3 +++
 arch/x86/Makefile  |  2 --
 arch/xtensa/Makefile   |  4 +---
 42 files changed, 71 insertions(+), 103 deletions(-)

diff --git a/Documentation/kbuild/makefiles.rst 
b/Documentation/kbuild/makefiles.rst
index db3af0b45baf..b008b90b92c9 100644
--- a/Documentation/kbuild/makefiles.rst
+++ b/Documentation/kbuild/makefiles.rst
@@ -1050,22 +1050,9 @@ is not sufficient this sometimes needs to be explicit.
 The above assignment instructs kbuild to descend down in the
 directory compressed/ when "make clean" is executed.
 
-To support the clean infrastructure in the Makefiles that build the
-final bootimage there is an optional target named archclean:
-
-   Example::
-
-   #arch/x86/Makefile
-   archclean:
-   $(Q)$(MAKE) $(clean)=arch/x86/boot
-
-When "make clean" is executed, make will descend down in arch/x86/boot,
-and clean as usual. The Makefile located in arch/x86/boot/ may use
-the subdir- trick to descend further down.
-
 Note 1: arch/$(SRCARCH)/Makefile cannot use "subdir-", because that file is
-included in the top level makefile, and the kbuild infrastructure
-is not operational at that point.
+included in the top level makefile. Instead, arch/$(SRCARCH)/Kbuild can use
+"subdir-".
 
 Note 2: All directories listed in core-y, libs-y, drivers-y and net-y will
 be visited during "make clean".
diff --git a/arch/alpha/Kbuild b/arch/alpha/Kbuild
index c2302017403a..345d79df24bb 100644
--- a/arch/alpha/Kbuild
+++ b/arch/alpha/Kbuild
@@ -1,3 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-y  += kernel/ mm/
 obj-$(CONFIG_MATHEMU)  += math-emu/
+
+# for cleaning
+subdir- += boot
diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile
index 52529ee42dac..881cb913e23a 100644
--- a/arch/alpha/Makefile
+++ b/arch/alpha/Makefile
@@ -55,9 +55,6 @@ $(boot)/vmlinux.gz: vmlinux
 bootimage bootpfile bootpzfile: vmlinux
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
-archclean:
-   $(Q)$(MAKE) $(clean)=$(boot)
-
 archheaders:
$(Q)$(MAKE) $(build)=arch/alpha/kernel/syscalls all
 
diff --git a/arch/arc/Kbuild b/arch/arc/Kbuild
index 699d8cae9b1f..b94102fff68b 100644
--- a/arch/arc/Kbuild
+++ b/arch/arc/Kbuild
@@ -1,3 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-y += kernel/
 obj-y += mm/
+
+# for cleaning
+subdir- += boot
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 08995f6c6441..efc54f3e35e0 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -112,6 +112,3 @@ uImage: $(uimage-default-y)
@$(kecho) '  Image $(boot)/uImage is ready'
 
 CLEAN_FILES += $(boot)/uImage
-
-archclean:
-   $(Q)$(MAKE) $(clean)=$(boot)
diff --git a/arch/arm/Kbuild b/ar

Re: [PATCH 2/2] kbuild: use more subdir- for visiting subdirectories while cleaning

2021-10-13 Thread Kees Cook
On Wed, Oct 13, 2021 at 03:36:22PM +0900, Masahiro Yamada wrote:
> Documentation/kbuild/makefiles.rst suggests to use "archclean" for
> cleaning arch/$(SRCARCH)/boot/.
> 
> Since commit d92cc4d51643 ("kbuild: require all architectures to have
> arch/$(SRCARCH)/Kbuild"), we can use the "subdir- += boot" trick for
> all architectures. This can take advantage of the parallel option (-j)
> for "make clean".
> 
> I also cleaned up the comments. The "archdep" target does not exist.
> 
> Signed-off-by: Masahiro Yamada 

I like the clean-up!

Reviewed-by: Kees Cook 

-- 
Kees Cook

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/2] kbuild: use more subdir- for visiting subdirectories while cleaning

2021-10-13 Thread Geert Uytterhoeven
On Wed, Oct 13, 2021 at 8:43 AM Masahiro Yamada  wrote:
> Documentation/kbuild/makefiles.rst suggests to use "archclean" for
> cleaning arch/$(SRCARCH)/boot/.
>
> Since commit d92cc4d51643 ("kbuild: require all architectures to have
> arch/$(SRCARCH)/Kbuild"), we can use the "subdir- += boot" trick for
> all architectures. This can take advantage of the parallel option (-j)
> for "make clean".
>
> I also cleaned up the comments. The "archdep" target does not exist.
>
> Signed-off-by: Masahiro Yamada 

>  arch/m68k/Makefile |  4 +---

Acked-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc