[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Split long lines of variables generated by '+='?
From: |
Alexandre Duret-Lutz |
Subject: |
Re: Split long lines of variables generated by '+='? |
Date: |
Sat, 24 Apr 2004 16:18:35 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
>>> "Simon" == Simon Josefsson <address@hidden> writes:
Simon> I have a generated Automake makefile snippet that does something like:
Simon> gdoc_TEXINFOS += texi/ap.c.texi
Simon> gdoc_TEXINFOS += texi/shishi_ap.texi
Simon> gdoc_MANS += man/shishi_ap.3
Simon> gdoc_TEXINFOS += texi/shishi_ap_etype.texi
Simon> gdoc_MANS += man/shishi_ap_etype.3
Simon> gdoc_TEXINFOS += texi/shishi_ap_nosubkey.texi
Simon> ...
Simon> I believe automake tries to put all names on the same line:
Simon> gdoc_TEXINFOS = texi/ap.c.texi texi/shishi_ap.texi ...
Simon> gdoc_MANS = man/shishi_ap.3 man/shishi_ap_etype.3 ...
Simon> Now, these lines get rather long (about 20KB). Some make
Simon> implementations (alphaev67-dec-osf5.1, alphaev68-dec-osf5.1) cannot
Simon> handle this and crashes.
Thanks for the report. I'm installing the following patch on HEAD.
[...]
2004-04-24 Alexandre Duret-Lutz <address@hidden>
* lib/Automake/VarDef.pm (append): Turn VAR_ASIS variables into
VAR_PRETTY variables to work around make implementation with
limited line length, such as OSF1/Tru64 make.
* tests/longline.test: New file.
* tests/Makefile.am (TESTS): Add it.
* tests/pluseq3.test, tests/pluseq8.test: Adjust.
Report from Simon Josefsson.
Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.269
diff -u -r1.269 NEWS
--- NEWS 23 Apr 2004 21:57:42 -0000 1.269
+++ NEWS 24 Apr 2004 14:14:15 -0000
@@ -46,7 +46,21 @@
* Tar format can be chosen with the new options tar-v7, tar-ustar, and
tar-pax. The new option filename-length-max=99 helps diagnosing
- filenames that are too long for tar-v7.
+ filenames that are too long for tar-v7. (PR/414)
+
+* Variables aumented with `+=' are now automatically flattened (i.e.,
+ trailing backslashes removed) and then wrapped around 80 colummns
+ (adding trailing backslashes). In previous versions, a long series
+ of
+ VAR += value1
+ VAR += value2
+ VAR += value3
+ ...
+ would result in a single-line definition of VAR that could possibly
+ exceed the maximum line length of some make implementations.
+
+ Non-augmented variables are still output as they are defined in
+ the Makefile.am.
New in 1.8:
Index: lib/Automake/VarDef.pm
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/VarDef.pm,v
retrieving revision 1.4
diff -u -r1.4 VarDef.pm
--- lib/Automake/VarDef.pm 29 Nov 2003 18:02:40 -0000 1.4
+++ lib/Automake/VarDef.pm 24 Apr 2004 14:16:37 -0000
@@ -189,6 +189,9 @@
$val .= ' ';
}
$self->{'value'} = $val . $value;
+ # Turn ASIS appended variables into PRETTY variables. This is to
+ # cope with `make' implementation that cannot read very long lines.
+ $self->{'pretty'} = VAR_PRETTY if $self->{'pretty'} == VAR_ASIS;
}
=item C<$def-E<gt>value>
Index: tests/longline.test
===================================================================
RCS file: tests/longline.test
diff -N tests/longline.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/longline.test 24 Apr 2004 14:16:38 -0000
@@ -0,0 +1,36 @@
+#! /bin/sh
+# Copyright (C) 2004 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Long lines of += should be wrapped.
+# Report from Simon Josefsson.
+
+. ./defs || exit 1
+
+set -e
+
+(echo DUMMY = some_long_filename_1;
+for i in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20;
+do
+ echo DUMMY += some_long_filename_$i
+done) > Makefile.am
+
+$ACLOCAL
+$AUTOMAKE
+test 80 -ge `grep DUMMY Makefile.in | wc -c`
Index: tests/pluseq3.test
===================================================================
RCS file: /cvs/automake/automake/tests/pluseq3.test,v
retrieving revision 1.7
diff -u -r1.7 pluseq3.test
--- tests/pluseq3.test 14 Nov 2003 21:25:59 -0000 1.7
+++ tests/pluseq3.test 24 Apr 2004 14:16:38 -0000
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1998, 1999, 2001, 2002, 2004 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
@@ -27,7 +27,7 @@
cat > Makefile.am << 'END'
if CHECK
-data_DATA = zar
+data_DATA = zarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
else
data_DATA =
endif
@@ -50,8 +50,8 @@
$ACLOCAL || exit 1
$AUTOMAKE
-grep 'address@hidden@data_DATA = zar \\$' Makefile.in
-grep 'address@hidden@ doz$' Makefile.in
+grep 'address@hidden@data_DATA =
zarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr \\$'
Makefile.in
+grep 'address@hidden@ doz$' Makefile.in
grep 'address@hidden@data_DATA = dog$' Makefile.in
Index: tests/pluseq8.test
===================================================================
RCS file: /cvs/automake/automake/tests/pluseq8.test,v
retrieving revision 1.4
diff -u -r1.4 pluseq8.test
--- tests/pluseq8.test 14 Nov 2003 21:25:59 -0000 1.4
+++ tests/pluseq8.test 24 Apr 2004 14:16:38 -0000
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2004 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
@@ -32,7 +32,7 @@
$ACLOCAL || exit 1
$AUTOMAKE || exit 1
-sed -n -e '/^VAR =.*\\$/ {
+sed -n -e '/^VAR =/ {
:loop
p
n
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.558
diff -u -r1.558 Makefile.am
--- tests/Makefile.am 23 Apr 2004 21:57:43 -0000 1.558
+++ tests/Makefile.am 24 Apr 2004 14:17:27 -0000
@@ -306,6 +306,7 @@
lisp6.test \
listval.test \
location.test \
+longline.test \
ltcond.test \
ltcond2.test \
ltconv.test \
--
Alexandre Duret-Lutz
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Split long lines of variables generated by '+='?,
Alexandre Duret-Lutz <=