Skip to content

Commit 3602906

Browse files
committed
kbuild: make clean rule robust against too long argument error
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>
1 parent 1fffe7a commit 3602906

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

scripts/Makefile.clean

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ __clean-files := $(wildcard $(addprefix $(obj)/, $(__clean-files)))
3737

3838
# ==========================================================================
3939

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

4345
__clean: $(subdir-ymn)
4446
ifneq ($(strip $(__clean-files)),)

0 commit comments

Comments
 (0)