[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230617153025.1653851-1-masahiroy@kernel.org>
Date: Sun, 18 Jun 2023 00:30:25 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nicolas Schier <nicolas@...sle.eu>,
Masahiro Yamada <masahiroy@...nel.org>,
Eugeniu Rosca <erosca@...adit-jv.com>
Subject: [PATCH] kbuild: make clean rule robust against too long argument error
Commit cd968b97c492 ("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@...adit-jv.com>
Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
---
scripts/Makefile.clean | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean
index 3649900696dd..235408a44f90 100644
--- a/scripts/Makefile.clean
+++ b/scripts/Makefile.clean
@@ -37,8 +37,9 @@ __clean-files := $(wildcard $(addprefix $(obj)/, $(__clean-files)))
# ==========================================================================
+# Use xargs to make this robust against "Argument list too long" error
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)),)
--
2.39.2
Powered by blists - more mailing lists