automake-ng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Automake-NG] Avoding issues with command-line length limits (was: R


From: Akim Demaille
Subject: Re: [Automake-NG] Avoding issues with command-line length limits (was: Re: [PATCH 2/2] [ng] perf: optimize 'am__strip_suffixes' for speed)
Date: Wed, 30 May 2012 09:05:40 +0200

Le 22 mai 2012 à 12:23, Stefano Lattarini a écrit :

>> Presumably GNU make can help make this better.  If we are
>> willing to require GNU make, then perhaps we can be willing
>> to require a working 'xargs' implementation to help optimize
>> performance within command-line length limits.
>> 
> This would not help sadly, because the command-line length limits might
> still trip the shell executing the recipe; i.e., a rule like
> 
>   clean:
>       rm -f TOO-LONG-LIST
> 
> would cause the make-spawned shell itself to die for "command line
> length exceeded"; rewriting that as
> 
>   clean:
>       echo TOO-LONG-LIST | xargs rm -f
> 
> obviously won't help (we've even *increased* the command line length,
> in fact!)

Maybe you could add a spying target, say something like

  $ cat Makefile
  FOO = foo
  BAR = baz
  am-spy-%:
        @echo $($*)
  $ make am-spy-FOO
  foo
  $ make am-spy-BAZ
  
  $

And then use something like

  $(MAKE) am-spy-OBJECTS | xargs rm -f

Of course this means yet-another $(MAKE), which might
be very unwelcome.  

Obviously if the variable's value is long enough to break
the command line, then am-spy-% target could be specialized.

am-spy-OBJECTS:
        @echo foo1.o
        …
        @echo foo9999999.o

or maybe find a means to have Make work for us. $(info $($*))
would avoid the issue, but then use make -q, otherwise you
get:

  .PHONY: am-spy-%
  am-spy-%:
        $(info $($*))


  $ make am-spy-FOO
  foo
  make: `am-spy-FOO' is up to date.

Another way to enslave Make would be

  $ make -qpn nothing | sed -n '/FOO = /{s///;p;q;}'
  foo

with "nothing:;", but for a large Makefile it might be
prohibitive (we're not far from autom4te's use of m4
traces :).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]