Skip to content

Commit

Permalink
kbuild: make clean rule robust against too long argument error
Browse files Browse the repository at this point in the history
Commit cd968b9 ("kbuild: make built-in.a rule robust against too
long argument error") made a build rule robust against "Argument list
too long" error.

Eugeniu Rosca reported the same error occurred when cleaning an external
module.

The $(obj)/ prefix can be a very long path for external modules.

Apply a similar solution to 'make clean'.

Reported-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Tested-by: Eugeniu Rosca <erosca@de.adit-jv.com>
  • Loading branch information
masahir0y committed Jun 25, 2023
1 parent 1fffe7a commit 3602906
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/Makefile.clean
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ __clean-files := $(wildcard $(addprefix $(obj)/, $(__clean-files)))

# ==========================================================================

# To make this rule robust against "Argument list too long" error,
# remove $(obj)/ prefix, and restore it by a shell command.
quiet_cmd_clean = CLEAN $(obj)
cmd_clean = rm -rf $(__clean-files)
cmd_clean = printf '$(obj)/%s ' $(patsubst $(obj)/%,%,$(__clean-files)) | xargs rm -rf

__clean: $(subdir-ymn)
ifneq ($(strip $(__clean-files)),)
Expand Down

0 comments on commit 3602906

Please sign in to comment.