[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <05f8480125584a9caea029b9c3111ef4@AcuMS.aculab.com>
Date: Wed, 8 Jun 2022 07:43:45 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Kevin Locke' <kevin@...inlocke.name>,
Masahiro Yamada <masahiroy@...nel.org>,
"linux-kbuild@...r.kernel.org" <linux-kbuild@...r.kernel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] kbuild: avoid regex RS for POSIX awk
From: Kevin Locke
> Sent: 07 June 2022 03:43
>
> In 22f26f21774f8 awk was added to deduplicate *.mod files.
Can't this be done with gmake's $(sort) function?
$(sort list)
Sorts the words of list in lexical order, removing duplicate words.
The output is a list of words separated by single spaces.
...
> # To make this rule robust against "Argument list too long" error,
> # ensure to add $(obj)/ prefix by a shell command.
> -cmd_mod = echo $(call real-search, $*.o, .o, -objs -y -m) | \
> - $(AWK) -v RS='( |\n)' '!x[$$0]++ { print("$(obj)/"$$0) }' > $@
> +cmd_mod = printf '%s\n' $(call real-search, $*.o, .o, -objs -y -m) | \
> + $(AWK) '!x[$$0]++ { print("$(obj)/"$$0) }' > $@
I think the above only works because 'printf' is (usually) a
shell builtin - so the kernel's argv[] limit doesn't apply.
So the comment isn't really right.
But I think:
cmd_mod = $(addprefix $(obj)/,$(sort $(call real-search, $*.o, .o, -objs -y -m))) >$@
will have the required effect.
Without forking and execing multiple processes.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists