Re: [PATCH] kbuild: make clean rule robust against too long argument error

From: Eugeniu Rosca
Date: Mon Jun 19 2023 - 05:35:42 EST


Hello Yamada-san,

On Mon, Jun 19, 2023 at 12:50:48AM +0900, Masahiro Yamada wrote:
> On Sun, Jun 18, 2023 at 5:07 AM Eugeniu Rosca <erosca@xxxxxxxxxxxxxx> wrote:

[snip]

> > Please, correct me if I am wrong, but it looks like the magic/brilliance
> > is in the 'patsubst' function, since below version also fails for me:
> >
> > NOK: cmd_clean = printf '%s ' $(__clean-files) | xargs rm -rf
>
> Right.
> Now, 'printf' (instead of 'rm') failed with the too long argument list.
>
> GNU Make does not have the length limit, but shell does.
> So, the full-path list must be passed via stdout
> instead of the command line.
>
>
> The comment might be confusing.
>
> I will repeat the same comment written in scripts/Makefile.build:
>
> # To make this rule robust against "Argument list too long" error,
> # remove $(obj)/ prefix, and restore it by a shell command.

Sounds good to me. No open questions from my end :)

--
Best regards,
Eugeniu Rosca