Skip to content

Commit 8212f89

Browse files
committed
kbuild: use more subdir- for visiting subdirectories while cleaning
Documentation/kbuild/makefiles.rst suggests to use "archclean" for cleaning arch/$(SRCARCH)/boot/, but it is not a hard requirement. Since commit d92cc4d ("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 in arch/$(SRCARCH)/Makefile. The "archdep" target no longer exists. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Kees Cook <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> Acked-by: Michael Ellerman <[email protected]> (powerpc)
1 parent 10c6ae2 commit 8212f89

File tree

42 files changed

+71
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+71
-103
lines changed

Documentation/kbuild/makefiles.rst

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,22 +1050,9 @@ is not sufficient this sometimes needs to be explicit.
10501050
The above assignment instructs kbuild to descend down in the
10511051
directory compressed/ when "make clean" is executed.
10521052

1053-
To support the clean infrastructure in the Makefiles that build the
1054-
final bootimage there is an optional target named archclean:
1055-
1056-
Example::
1057-
1058-
#arch/x86/Makefile
1059-
archclean:
1060-
$(Q)$(MAKE) $(clean)=arch/x86/boot
1061-
1062-
When "make clean" is executed, make will descend down in arch/x86/boot,
1063-
and clean as usual. The Makefile located in arch/x86/boot/ may use
1064-
the subdir- trick to descend further down.
1065-
10661053
Note 1: arch/$(SRCARCH)/Makefile cannot use "subdir-", because that file is
1067-
included in the top level makefile, and the kbuild infrastructure
1068-
is not operational at that point.
1054+
included in the top level makefile. Instead, arch/$(SRCARCH)/Kbuild can use
1055+
"subdir-".
10691056

10701057
Note 2: All directories listed in core-y, libs-y, drivers-y and net-y will
10711058
be visited during "make clean".

arch/alpha/Kbuild

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
obj-y += kernel/ mm/
33
obj-$(CONFIG_MATHEMU) += math-emu/
4+
5+
# for cleaning
6+
subdir- += boot

arch/alpha/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ $(boot)/vmlinux.gz: vmlinux
5555
bootimage bootpfile bootpzfile: vmlinux
5656
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
5757

58-
archclean:
59-
$(Q)$(MAKE) $(clean)=$(boot)
60-
6158
archheaders:
6259
$(Q)$(MAKE) $(build)=arch/alpha/kernel/syscalls all
6360

arch/arc/Kbuild

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0
22
obj-y += kernel/
33
obj-y += mm/
4+
5+
# for cleaning
6+
subdir- += boot

arch/arc/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,3 @@ uImage: $(uimage-default-y)
112112
@$(kecho) ' Image $(boot)/uImage is ready'
113113

114114
CLEAN_FILES += $(boot)/uImage
115-
116-
archclean:
117-
$(Q)$(MAKE) $(clean)=$(boot)

arch/arm/Kbuild

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ obj-y += kernel/ mm/ common/
99
obj-y += probes/
1010
obj-y += net/
1111
obj-y += crypto/
12+
13+
# for cleaning
14+
subdir- += boot

arch/arm/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,6 @@ ifeq ($(CONFIG_VDSO),y)
317317
$(Q)$(MAKE) $(build)=arch/arm/vdso $@
318318
endif
319319

320-
# We use MRPROPER_FILES and CLEAN_FILES now
321-
archclean:
322-
$(Q)$(MAKE) $(clean)=$(boot)
323-
324320
# My testing targets (bypasses dependencies)
325321
bp:; $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/bootpImage
326322

arch/arm64/Kbuild

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ obj-$(CONFIG_KVM) += kvm/
44
obj-$(CONFIG_XEN) += xen/
55
obj-$(subst m,y,$(CONFIG_HYPERV)) += hyperv/
66
obj-$(CONFIG_CRYPTO) += crypto/
7+
8+
# for cleaning
9+
subdir- += boot

arch/arm64/Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,6 @@ ifeq ($(CONFIG_ARM64_USE_LSE_ATOMICS),y)
182182
endif
183183
endif
184184

185-
186-
# We use MRPROPER_FILES and CLEAN_FILES now
187-
archclean:
188-
$(Q)$(MAKE) $(clean)=$(boot)
189-
$(Q)$(MAKE) $(clean)=arch/arm64/kernel/vdso
190-
$(Q)$(MAKE) $(clean)=arch/arm64/kernel/vdso32
191-
192185
ifeq ($(KBUILD_EXTMOD),)
193186
# We need to generate vdso-offsets.h before compiling certain files in kernel/.
194187
# In order to do that, we should use the archprepare target, but we can't since

arch/arm64/kernel/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,6 @@ extra-y += $(head-y) vmlinux.lds
8181
ifeq ($(CONFIG_DEBUG_EFI),y)
8282
AFLAGS_head.o += -DVMLINUX_PATH="\"$(realpath $(objtree)/vmlinux)\""
8383
endif
84+
85+
# for cleaning
86+
subdir- += vdso vdso32

0 commit comments

Comments
 (0)