Re: Use of really long lines in Makefile.in

From:

Alexandre Duret-Lutz

Subject:

Re: Use of really long lines in Makefile.in

Date:

Tue, 08 Feb 2005 23:49:40 +0100

User-agent:

Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

>>> "J" == J T Conklin <address@hidden> writes:
J> Albert Chin <address@hidden> writes:
>> So, should automake change lines like:
>> foo_SOURCES = [long list of sources]
>> to the following in Makefile.in:
>> foo_SOURCES = $(foo_SOURCES_1) $(foo_SOURCES_2) ...
>> foo_SOURCES_1 = [list of sources < 2048 chars]
>> foo_SOURCES_2 = [list of sources < 2048 chars]
>> ...
Regardless of what we decide for Automake, isn't the input
foo_SOURCES already >= 2048 chars? Shouldn't it be fixed too?
AFAIC I find it so much easier to edit and diff Makefile.am in
which sources files are listed vertically
foo_SOURCES = \
a.c \
a.h \
b.c \
...
that I hardly understand how one works with >2048-char lines.
J> automake's 1.9 NEWS entry includes:
J> - Variables aumented with `+=' are now automatically flattened (i.e.,
J> trailing backslashes removed) and then wrapped around 80 colummns
J> (adding trailing backslashes). In previous versions, a long series
J> of
J> VAR += value1
J> VAR += value2
J> VAR += value3
J> ...
J> would result in a single-line definition of VAR that could possibly
J> exceed the maximum line length of some make implementations.
Here "flattened" means that
| FOO = \
| asdkjaslkjdas \
| asldkjasldkj \
| a;sdlkas;lsdka; \
| a;sdjadksa \
| asdsa
| FOO += bar asldkasj laskjd alkj daslk j
becomes
| FOO = asdkjaslkjdas asldkjasldkj a;sdlkas;lsdka; a;sdjadksa \
| asdsa bar asldkasj laskjd alkj daslk j
J> Non-augmented variables are still output as they are defined in
J> the Makefile.am.
One reason I did this only for `+=' variables is that I was
really leery of changing the layout of the variables defined by
the user. Normally Automake tries to output definitions as
it reads them. Variables used with += are usually list of
files, and they were already output differently by Automake, so
such flattening didn't seem too harmful. For other variables I
was less sure (for instance I can imagine people grepping
Makefiles for some pattern they used in Makefile.ams).
J> flattening non-augmented variable assignments seems like a better
J> solution to the problem of too long lines.
Maybe Automake could do that if the variable appear to be longer
than some "human tolerance" threshold. Assume a generated file
list and flatten any variable definition with more that 500
characters in a line. This way ordinary variables are still
output exactly as defined.
(I feeling a bit paranoid here; the above scheme is likely to be
overkill.)
--
Alexandre Duret-Lutz