[+cc bug-automake, so that we won't forget about the issue]
[future replies should drop the automake list]

On 01/22/2013 02:22 AM, Miles Bader wrote:
> Stefano Lattarini <stefano.lattar...@gmail.com> writes:
>> The best solution is on the user-side IMHO: fix the build system to
>> use less (ideally none) make recursion.  Both the parallel and serial
>> testsuite harness should support that setup OOTB.
> 
> It would be nice if automake had some more features for that...
>
Indeed (albeit the present situation is already mostly good enough
for most medium-sized packages).

> E.g., if I have a directory "foo" that has sources etc, and builds
> some specific targets, then I can isolate the automake stuff for foo
> by using an include file "foo/Makefile.am.inc" or something, and then
> putting an appropriate include in the top-level Makefile.am.
> 
> But it's a bit annoying, in that AFAICT, all filenames, etc, in foo's
> Makefile fragment must explicitly include the directory name.
>
Yes, and this issue has come up several times already.  Nobody has
been bothered enough to attempt a patch, though, at least so far.

> E.g., if it builds a library, "foo/Makefile.am.inc" might look like:
> 
>    libfoo_a_SOURCES = foo/oink.c foo/barf.c foo/barf.h ...
> 
> For longish directory names, this can really bloat things up...
>
Someone (probably Eric Blake, but I'm not 100% sure) once noted that this
issue could be mitigated with simple indirections with usual make macros:

  d1 = wow/a/very/very/insanely/long/directory/name

  wow_a_very_very_insanely_long_directory_name_prog_SOURCES = \
   $(d1)/a.c $(d1)/b.c ... $(d1)/z.c

> It would be really cool if there was some way of telling automake
> "hey, for every filename mentioned in this file, try to use a prefix
> of ..."
>
This is probably too automatic; but Bob Friesenhahn suggested Automake
could recognize special substitutions, like %CURDIR% and %XCURDIR%, so
that you could simply use in

    %XCURDIR%_prog_SOURCES = %CURDIR%/a.c %CURDIR%/b.c ... %CURDIR%/z.c

in 'wow/a/very/very/insanely/long/directory/name/local,.mk', include this
'.mk' fragment from the top-level Makefile.am, and have DTRT.  I think
that could be implemented in a simple pre-processing step, before
Automake even parses the Makefile contents (this too was Bob's suggestion,
IIRC); in which case, the change would probably be unobtrusive and mostly
safe.  Patches (even WIP) are welcome.

> I dunno whether that would be associated with the include
> directive, with the makefile fragment, or what, but... anyway.
> 
> Does automake have some feature like this that I've missed?
>
Unfortunately no.

> Or has anybody thought about it?
>
They did (see above :-)

Thanks,
  Stefano

Reply via email to