Re: [PATCH] kbuild: only clean objtool on mrproper

From: Nathan Chancellor

Date: Wed Feb 25 2026 - 15:04:29 EST


On Wed, Feb 25, 2026 at 12:26:29PM +0100, Michal Suchanek wrote:
> For packaging purposes I want to be able to grab the tool binaries
> without the .o files
>
> Fixes: 68b4fe32d737 ("kbuild: Add objtool to top-level clean target")
> Signed-off-by: Michal Suchanek <msuchanek@xxxxxxx>

Wouldn't resolve_btfids need the same treatment? Why is objtool special
here? Also, what's the use case? Running 'make clean' then copying what
is left? Josh, thoughts on this change?

> ---
> Makefile | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index e944c6e71e81..e9b8811a02f5 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1675,7 +1675,7 @@ vmlinuxclean:
> $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
> $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)
>
> -clean: archclean vmlinuxclean resolve_btfids_clean objtool_clean
> +clean: archclean vmlinuxclean resolve_btfids_clean
>
> # mrproper - Delete all generated files, including .config
> #
> @@ -1686,7 +1686,7 @@ PHONY += $(mrproper-dirs) mrproper
> $(mrproper-dirs):
> $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
>
> -mrproper: clean $(mrproper-dirs)
> +mrproper: clean objtool_clean $(mrproper-dirs)
> $(call cmd,rmfiles)
> @find . $(RCS_FIND_IGNORE) \
> \( -name '*.rmeta' \) \
> --
> 2.51.0
>