From patchwork Sat Jun 17 15:30:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13283662 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B711EB64D9 for ; Sat, 17 Jun 2023 15:30:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229487AbjFQPah (ORCPT ); Sat, 17 Jun 2023 11:30:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231618AbjFQPaf (ORCPT ); Sat, 17 Jun 2023 11:30:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E25F1FD7; Sat, 17 Jun 2023 08:30:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9991560FA0; Sat, 17 Jun 2023 15:30:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62639C433C8; Sat, 17 Jun 2023 15:30:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687015833; bh=5iL1FxKNMlL/BSu7pumyfvfaweoKYzZMLOet3Mrh+B8=; h=From:To:Cc:Subject:Date:From; b=JKwE4ZuWdpep3jsmBWR6/OStT781HZs+JeLHr6Gj8JdPqnFoNuC88C/wjDniaqWor Eu0EylBuoewFFPFcFhp1Z1bK5RoL067rBj1l0mQ+ORGhXqokEnNR8fmzdIAb6q3H5e 9ksyD+6gPr5i8SBz18Qfeb2tUCK4ZEqgwaeizqTtFCua3U2g5Ql04lLwP3EQkigWZy idl7nfcsjpXO54AZ8fjAuBMtqx7Xd5DucsjdiWX2Vrt1YmdsI5bKgbKqOx5VhMhL2h u33MKHY2esIj/rms6ACTtJkkJC4S4nLFi1KYY22ptQmdbO1BldHJbhqeqOrcvSH3yZ jQe+bji+zDKcw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Masahiro Yamada , Eugeniu Rosca Subject: [PATCH] kbuild: make clean rule robust against too long argument error Date: Sun, 18 Jun 2023 00:30:25 +0900 Message-Id: <20230617153025.1653851-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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 Signed-off-by: Masahiro Yamada Reviewed-by: Eugeniu Rosca Tested-by: Eugeniu Rosca --- 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)),)