Long Command Lines and @FILE
Paul Smith
psmith@gnu.org
Fri Sep 17 13:45:50 GMT 2021
On Thu, 2021-09-16 at 22:08 +0200, Florian Weimer via Binutils wrote:
> Modern GNU make has $(file …) for this purpose. The manual
> specifically mentions @ listing files:
This is for sure the way to go. It's actually quite tricky to do this
using foreach and shell, because you can't (obviously) invoke shell
with all the arguments... and make doesn't have any built-in way to do
math.
You'd have to use $(words ...) to select a set of words, but you can't
just loop for "all the words", or "words up to N chars in length", or
similar things. You have to choose a set of sizes and hard-code the
looping for that, or else get really fancy (you could do something like
$(patsubst %,x,...) to change all words to 1 char then invoke $(shell
...) to count them and hope that made the list small enough to fit, or
something).
Requiring $(file ...) is much more robust, if possible. It was added
in GNU make 4.0, released in Oct 2013.
More information about the Binutils
mailing list