Re: Getting long SOURCES lines with subdirs shorter

2023-12-01 Thread Mike Frysinger
On 01 Dec 2023 17:39, Nick Bowler wrote:
> On 2023-12-01 15:37, Jan Engelhardt wrote:
> > On Friday 2023-12-01 21:13, Mike Frysinger wrote:
> >> On 17 Jul 2023 16:51, Karl Berry wrote:
> >>> Hi Jan,
> >>>
> >>> Current automake likely won't have anything in store already,
> >>>
> >>> Not that I know of.
> >>>
> >>> a_SOURCES = $(addprefix aprog/,main.c foo.c bar.c baz.c)
> >>>
> >>> I've often wanted this myself. I'd certainly welcome a patch for it.
> >>>
> >>> Please work from automake trunk. None of the various branches are kept
> >>> to date. (Sad but that's the reality.)
> >>
> >> prob stating the obvious, but $(addprefix) is a GNUism, so if we wanted to
> >> use it, it'd required feature probing at configure time, and that always
> >> complicates things :(
> > 
> > No-no, the idea was to make $(addprefix) an automakeism that is resolved 
> > before
> > GNU make (or any other make) is ever invoked.
> 
> I suggest inventing a new syntax if this approach is taken, one that
> doesn't overload real-world make syntax, since some people do use
> Automake with GNU-make-specific rules and whatnot.  We already have
> things like %reldir% which are expanded by Automake so maybe using
> percent signs as a marker for "things expanded by automake" would
> be a good starting point for this.
> 
> I do sometimes wish Automake had more built-in macro facilities.
> One can do things like generate includeable snippets or preprocess
> Makefile.am with, say, m4, but that adds a bunch of additional
> complexity which is not always worthwhile.

we're already blurring the lines by processing things like `if`.
it also has the benefit of not having to learn more automake-only
DSLs like the %var% syntax.  imo it's ok to preprocess things that
can be statically done like $(addprefix).
-mike


signature.asc
Description: PGP signature


Re: Getting long SOURCES lines with subdirs shorter

2023-12-01 Thread Mike Frysinger
On 01 Dec 2023 21:37, Jan Engelhardt wrote:
> On Friday 2023-12-01 21:13, Mike Frysinger wrote:
> >On 17 Jul 2023 16:51, Karl Berry wrote:
> >> Hi Jan,
> >> 
> >> Current automake likely won't have anything in store already,
> >> 
> >> Not that I know of.
> >> 
> >> a_SOURCES = $(addprefix aprog/,main.c foo.c bar.c baz.c)
> >> 
> >> I've often wanted this myself. I'd certainly welcome a patch for it.
> >> 
> >> Please work from automake trunk. None of the various branches are kept
> >> to date. (Sad but that's the reality.)
> >
> >prob stating the obvious, but $(addprefix) is a GNUism, so if we wanted to
> >use it, it'd required feature probing at configure time, and that always
> >complicates things :(
> 
> No-no, the idea was to make $(addprefix) an automakeism that is resolved 
> before
> GNU make (or any other make) is ever invoked.

i thought your concern was about Makefile.in noise.  Makefile.am is somewhat
mitigated via modules & %D%/ prefixes already.  not that i'm anti expanding
things statically when feasible.
-mike


signature.asc
Description: PGP signature


Re: Getting long SOURCES lines with subdirs shorter

2023-12-01 Thread Nick Bowler
On 2023-12-01 15:37, Jan Engelhardt wrote:
> On Friday 2023-12-01 21:13, Mike Frysinger wrote:
>> On 17 Jul 2023 16:51, Karl Berry wrote:
>>> Hi Jan,
>>>
>>> Current automake likely won't have anything in store already,
>>>
>>> Not that I know of.
>>>
>>> a_SOURCES = $(addprefix aprog/,main.c foo.c bar.c baz.c)
>>>
>>> I've often wanted this myself. I'd certainly welcome a patch for it.
>>>
>>> Please work from automake trunk. None of the various branches are kept
>>> to date. (Sad but that's the reality.)
>>
>> prob stating the obvious, but $(addprefix) is a GNUism, so if we wanted to
>> use it, it'd required feature probing at configure time, and that always
>> complicates things :(
> 
> No-no, the idea was to make $(addprefix) an automakeism that is resolved 
> before
> GNU make (or any other make) is ever invoked.

I suggest inventing a new syntax if this approach is taken, one that
doesn't overload real-world make syntax, since some people do use
Automake with GNU-make-specific rules and whatnot.  We already have
things like %reldir% which are expanded by Automake so maybe using
percent signs as a marker for "things expanded by automake" would
be a good starting point for this.

I do sometimes wish Automake had more built-in macro facilities.
One can do things like generate includeable snippets or preprocess
Makefile.am with, say, m4, but that adds a bunch of additional
complexity which is not always worthwhile.

Cheers,
  Nick



Re: Getting long SOURCES lines with subdirs shorter

2023-12-01 Thread Mike Frysinger
On 17 Jul 2023 16:51, Karl Berry wrote:
> Hi Jan,
> 
> Current automake likely won't have anything in store already,
> 
> Not that I know of.
> 
> a_SOURCES = $(addprefix aprog/,main.c foo.c bar.c baz.c)
> 
> I've often wanted this myself. I'd certainly welcome a patch for it.
> 
> Please work from automake trunk. None of the various branches are kept
> to date. (Sad but that's the reality.)

prob stating the obvious, but $(addprefix) is a GNUism, so if we wanted to
use it, it'd required feature probing at configure time, and that always
complicates things :(
-mike


signature.asc
Description: PGP signature


Re: Getting long SOURCES lines with subdirs shorter

2023-12-01 Thread Jan Engelhardt


On Friday 2023-12-01 21:13, Mike Frysinger wrote:
>On 17 Jul 2023 16:51, Karl Berry wrote:
>> Hi Jan,
>> 
>> Current automake likely won't have anything in store already,
>> 
>> Not that I know of.
>> 
>> a_SOURCES = $(addprefix aprog/,main.c foo.c bar.c baz.c)
>> 
>> I've often wanted this myself. I'd certainly welcome a patch for it.
>> 
>> Please work from automake trunk. None of the various branches are kept
>> to date. (Sad but that's the reality.)
>
>prob stating the obvious, but $(addprefix) is a GNUism, so if we wanted to
>use it, it'd required feature probing at configure time, and that always
>complicates things :(

No-no, the idea was to make $(addprefix) an automakeism that is resolved before
GNU make (or any other make) is ever invoked.



Re: Getting long SOURCES lines with subdirs shorter

2023-07-17 Thread Karl Berry
Hi Jan,

Current automake likely won't have anything in store already,

Not that I know of.

a_SOURCES = $(addprefix aprog/,main.c foo.c bar.c baz.c)

I've often wanted this myself. I'd certainly welcome a patch for it.

Please work from automake trunk. None of the various branches are kept
to date. (Sad but that's the reality.)

Happy hacking,
Karl



Re: Getting long SOURCES lines with subdirs shorter

2023-07-17 Thread Václav Haisman

On 17. 07. 23 18:27, Václav Haisman wrote:

On 17. 07. 23 0:55, Jan Engelhardt wrote:

Given

a_SOURCES = aprog/main.c aprog/foo.c aprog/bar.c aprog/baz.c ...

The more source files there are to be listed, the longer that line gets,
the bigger the Makefile.am fragment becomes, etc. I am thinking about
how to cut that repetition down. Current automake likely won't have
anything in store already, so I'm thinking of editing automake and
targeting a future automake release.

The syntax would need to be understood by automake and expanded at the
right time; Makefile.in should have the expanded list already. How
about recognizing the gmake function syntax?

a_SOURCES = $(addprefix aprog/,main.c foo.c bar.c baz.c)



You can use the %D% placeholder for the directory of the Makefile.am 
relative to the source directory. I can't find where I found out about 
it but it works. E.g., 
https://github.com/log4cplus/log4cplus/blob/master/src/Makefile.am. You 
can also generate the Makefile.am from a template using AutoGen to make 
things even easier.




Found the docs: 
https://www.gnu.org/software/automake/manual/html_node/Include.html


--
VH



Re: Getting long SOURCES lines with subdirs shorter

2023-07-17 Thread Václav Haisman

On 17. 07. 23 0:55, Jan Engelhardt wrote:

Given

a_SOURCES = aprog/main.c aprog/foo.c aprog/bar.c aprog/baz.c ...

The more source files there are to be listed, the longer that line gets,
the bigger the Makefile.am fragment becomes, etc. I am thinking about
how to cut that repetition down. Current automake likely won't have
anything in store already, so I'm thinking of editing automake and
targeting a future automake release.

The syntax would need to be understood by automake and expanded at the
right time; Makefile.in should have the expanded list already. How
about recognizing the gmake function syntax?

a_SOURCES = $(addprefix aprog/,main.c foo.c bar.c baz.c)



You can use the %D% placeholder for the directory of the Makefile.am 
relative to the source directory. I can't find where I found out about 
it but it works. E.g., 
https://github.com/log4cplus/log4cplus/blob/master/src/Makefile.am. You 
can also generate the Makefile.am from a template using AutoGen to make 
things even easier.


--
VH




Re: Getting long SOURCES lines with subdirs shorter

2023-07-17 Thread Jan Engelhardt
On Monday 2023-07-17 06:55, John Darrington wrote:

>Why not just write it as:
>
>a_SOURCES = aprog/main.c \
>   aprog/foo.c \
>   aprog/bar.c \
>   aprog/baz.c ...

You're missing the point.

If you have a hundred, two hundred source files, all the aprog/ prefixes 
(and it's rarely *that* short) add up to the filesize of Makefile.am.



Re: Getting long SOURCES lines with subdirs shorter

2023-07-17 Thread John Darrington
Why not just write it as:


a_SOURCES = aprog/main.c \
   aprog/foo.c \
   aprog/bar.c \
   aprog/baz.c ...



??


On Mon, Jul 17, 2023 at 12:55:59AM +0200, Jan Engelhardt wrote:
> Given
> 
>   a_SOURCES = aprog/main.c aprog/foo.c aprog/bar.c aprog/baz.c ...
> 
> The more source files there are to be listed, the longer that line gets, 
> the bigger the Makefile.am fragment becomes, etc. I am thinking about 
> how to cut that repetition down. Current automake likely won't have 
> anything in store already, so I'm thinking of editing automake and 
> targeting a future automake release.
> 
> The syntax would need to be understood by automake and expanded at the 
> right time; Makefile.in should have the expanded list already. How 
> about recognizing the gmake function syntax?
> 
> a_SOURCES = $(addprefix aprog/,main.c foo.c bar.c baz.c)



Re: Getting long SOURCES lines with subdirs shorter

2023-07-16 Thread Jacob Bachmeyer

Jan Engelhardt wrote:

Given

a_SOURCES = aprog/main.c aprog/foo.c aprog/bar.c aprog/baz.c ...

The more source files there are to be listed, the longer that line gets, 
the bigger the Makefile.am fragment becomes, etc. I am thinking about 
how to cut that repetition down. Current automake likely won't have 
anything in store already, so I'm thinking of editing automake and 
targeting a future automake release.
  


While this does not reduce the repetition, Automake allows 
backslash-continuation on these lines.  DejaGnu uses it to list files 
one per line in some places; see 
http://git.savannah.gnu.org/cgit/dejagnu.git/tree/Makefile.am>.


-- Jacob