automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, ng/master, updated. v1.12-3


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, ng/master, updated. v1.12-361-g763cf97
Date: Sat, 02 Jun 2012 07:18:32 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=763cf97ba788c950389aedc9818322761ef7c40a

The branch, ng/master has been updated
       via  763cf97ba788c950389aedc9818322761ef7c40a (commit)
       via  f9bbd463c37dc58ba7497f2f37ba7a6f516b8a79 (commit)
       via  8839a22ac61d728d6b381346f2f529a8e364bdc6 (commit)
       via  6175558fe19b623b6d45d7b152c2a876203a2acb (commit)
       via  717290ae67bb74a7deb589da77272aa5000cbd87 (commit)
       via  877e7f542439fa71627f2030ba37f0ad494571fd (commit)
       via  037f7e43b6a9da6d0555449bb0db128944c24f9c (commit)
       via  3860029104551a6b5a40041b5fd05f176b37d8ba (commit)
       via  87508438b9e3d80046c890e3e5168138d61eb269 (commit)
       via  620d1508bb9a008c236d25be822e5fc2d4a0eaca (commit)
       via  cec1b21efba4556267776609e0c308181426387c (commit)
       via  59ed7bff3f897cfc8dcc8c60abd2dbbacbdd56c4 (commit)
       via  a80391f1d4f5567fec70d1b0e89ea94536ebbd1d (commit)
       via  0972c83ad04845009bc19323c15db34e1ce5926a (commit)
       via  4efbfa15dda63d276bbef26ba652a673e7d9a4cb (commit)
       via  95692e07524f8aee27446846d66429f8db635c18 (commit)
      from  042e1321b539cb1f474bd1bee2238c16e2a463a4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 763cf97ba788c950389aedc9818322761ef7c40a
Author: Stefano Lattarini <address@hidden>
Date:   Thu May 31 17:52:51 2012 +0200

    [ng] vars: recognize escaped '#' correctly in a variable definition
    
    Regression revealed by a failure in test 't/backslash-tricks.sh', and
    caused by the recent merge of the 'ng/var-simplify' branch.
    
    It is worth noting that this change has a collateral effect: comments
    placed after the variable definition *must* now be separated with one
    or more spaces from said definition:
    
       # This won't work, and will produce a subtly broken Makefile
       foo = val# comment
       foo += val2
    
       # Please do this instead
       foo = val # comment
       foo += val2
    
    We believe that supporting the use of escaped '#' characters in variable
    definitions is more important than supporting the fringe case above.
    
    * lib/Automake/VarDef.pm (raw_value): Fix processing of stored value
    to account for escaped '#' characters.
    (value): Add a FIXME comment about a statement that is not strictly
    true anymore now that we assume GNU make.
    * t/backslash-tricks.sh: Extend a bit.
    * t/comment8.sh: Relax a bit, by placing spaces between the variable's
    definitions and the comments on the same line.  Extend in another
    respect, to watch against a regression introduced by the first draft of
    this commit.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit f9bbd463c37dc58ba7497f2f37ba7a6f516b8a79
Merge: 042e132 8839a22
Author: Stefano Lattarini <address@hidden>
Date:   Thu May 31 10:53:20 2012 +0200

    Merge branch 'ng/var-simplify' into ng/master
    
    * ng/var-simplify:
      [ng] cosmetics: avoid redundant use of '&' in subroutine calls
      [ng] rename: define_pretty_variable -> define_cond_variable()
      [ng] cleanup: prefer 'define_variable' over 'define_pretty_variable'
      [ng] refactor: change signature of 'define_variable()'
      [ng] vars: get rid of VAR_ASIS / VAR_PRETTY distinction
      [ng] vars: keep track of conditionals in appended values and comments
      [ng] vars: simplify logic for appending conditionally
      [ng] VarDef: store comments and values as a perl array
      [ng] refactor: support comments only for VarDef, not for ItemDef too
      [ng] tests: Automake should let us append to undefined variables (someday)
      [ng] tests: spy behaviour of '+=' with GNU make
      [ng] vars: get rid of VAR_SILENT type
      [ng] vars: get rid of VAR_SORTED type
      [ng] cleanup: remove unused private variables in Automake::Variable
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 8839a22ac61d728d6b381346f2f529a8e364bdc6
Author: Stefano Lattarini <address@hidden>
Date:   Sun May 20 00:27:10 2012 +0200

    [ng] cosmetics: avoid redundant use of '&' in subroutine calls
    
    * automake.in: Avoid redundant '&' in calls to the subroutines
    'push_dist_common', 'define_variable' and 'define_verbose_tagvar'.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 6175558fe19b623b6d45d7b152c2a876203a2acb
Author: Stefano Lattarini <address@hidden>
Date:   Sat May 19 23:06:27 2012 +0200

    [ng] rename: define_pretty_variable -> define_cond_variable()
    
    The new name is more appropriate, now that there is no more
    distinction between variables "pretty printed" and "printed
    as is".
    
    * automake.in (define_pretty_variable): Rename ...
    (define_cond_variable): ... to this.
    (handle_ltlibraries): Adjust (yes, this was the only caller!)
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 717290ae67bb74a7deb589da77272aa5000cbd87
Author: Stefano Lattarini <address@hidden>
Date:   Sat May 19 22:49:36 2012 +0200

    [ng] cleanup: prefer 'define_variable' over 'define_pretty_variable'
    
    No semantic change is intended.
    
    * automake.in: Any call to 'define_pretty_variable' where the condition
    argument is 'TRUE' can be simplified to a call to 'define_variable'.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 877e7f542439fa71627f2030ba37f0ad494571fd
Author: Stefano Lattarini <address@hidden>
Date:   Sat May 19 22:38:38 2012 +0200

    [ng] refactor: change signature of 'define_variable()'
    
    Change signature from:
        define_variable ($VAR, $VALUE, $WHERE)
    to:
        define_variable ($VAR, $WHERE, @VALUE)
    
    This makes the signature more consistent with the one of
    'define_pretty_variable()'.
    
    * automake.in (define_variable): Change signature.
    All callers adjusted.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 037f7e43b6a9da6d0555449bb0db128944c24f9c
Author: Stefano Lattarini <address@hidden>
Date:   Sat May 19 19:34:06 2012 +0200

    [ng] vars: get rid of VAR_ASIS / VAR_PRETTY distinction
    
    It doesn't offer us any real advantage (apart from some eye-candy
    in the generated makefile), and complicates the code and the
    internal APIs.
    
    * automake.in (define_verbose_var, define_configure_variable,
    file_contents_internal): Adjust the 'Automake::Variable::define'
    call to drop the VAR_ASIS parameter.
    (define_pretty_variable): Likewise.  Also, adjust the function
    description not to state that the value of a variable defined by
    it is "pretty printed in the output file".
    (handle_subdirs): Don't try to prettify the RECURSIVE_TARGETS
    variable anymore.
    (read_am_file): Adjust the 'Automake::Variable::define' calls
    to drop the VAR_ASIS parameter.  Also, don't "prettify" the
    definition of variables whose value is more than 1000 characters
    long.  That is now done directly ...
    * lib/Automake/Variable.pm (output): ... in here.
    (define): Drop the '$pretty' parameter, and adjust implementation
    details accordingly.  Now output variable definitions are only
    prettified when needed, i.e., when their value is more than 1000
    characters long.  And the only reason this prettification is done
    is to ensure the generated Makefile.in won't have lines so long
    that could confuse tools (like sed and awk) processing it into a
    Makefile at config.status runtime.
    (Pod Documentation): Adjust.
    (_has_line_too_long): New internal function.
    (transform_variable_recursively): Drop '$pretty' parameter in a
    call to 'define'.
    * lib/Automake/VarDef.pm (VAR_ASIS, VAR_PRETTY): Delete.
    (@EXPORT): Don't advertise them.
    (new): Don't take nor store the '$pretty' parameter anymore.
    (pretty): Remove this accessor method.
    (Pod Documentation): Adjust.
    * t/check2.sh: Adjust.
    * t/distcom-subdir.sh: Likewise.
    * t/distcom2.sh: Likewise.
    * t/longline.sh: Likewise.
    * t/pluseq3.sh: Likewise.
    * t/subdir4.sh: Likewise.
    * t/subst-no-trailing-empty-line.sh: Remove as obsolete.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 3860029104551a6b5a40041b5fd05f176b37d8ba
Author: Stefano Lattarini <address@hidden>
Date:   Thu May 3 15:08:39 2012 +0200

    [ng] vars: keep track of conditionals in appended values and comments
    
    This is a refactoring only needed by later changes.
    
    * lib/Automake/VarDef.pm: Updated methods and constructor.
    * lib/Automake/Variable.pm: Callers adjusted.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 87508438b9e3d80046c890e3e5168138d61eb269
Author: Stefano Lattarini <address@hidden>
Date:   Thu May 3 12:00:35 2012 +0200

    [ng] vars: simplify logic for appending conditionally
    
    This will make the generated Makefiles more bloated, but that should
    be OK, since eventually further refactorings will change the format used
    to output conditional variables extending, and the resulting Makefiles
    will once again be smaller and cleaner.
    
    * lib/Automake/Variable.pm (define): When appending to an existing
    variable *defined in another condition*, don't bother to avoid the
    creation of intermediate internal variables when that's not really
    needed; just create them unconditionally.
    (_new): Don't reset $self->{'last-append'} anymore, it has been
    removed (it was only used in the 'define' function).
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 620d1508bb9a008c236d25be822e5fc2d4a0eaca
Author: Stefano Lattarini <address@hidden>
Date:   Thu May 3 10:14:38 2012 +0200

    [ng] VarDef: store comments and values as a perl array
    
    This is a preparatory refactoring in view of a planned change to
    how the definitions of make variables augmented with '+=' are
    output in the generated Makefiles.
    
    * t/comments-in-var-def.sh: New xfailing test, shows an example of the
    improved semantic for variable definitions/additions we want to reach
    eventually.
    * Makefile.am (XFAIL_TESTS): Add it.
    * lib/Automake/VarDef.pm (new): Store values and comments for the
    variable in array references, not in scalars.
    (append): Just append the passed value and comment to those arrays,
    without preprocessing.  The existing preprocessing has been moved ...
    (raw_value): ... to this accessor function.
    (comment, dump): Adjust.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit cec1b21efba4556267776609e0c308181426387c
Author: Stefano Lattarini <address@hidden>
Date:   Thu May 3 01:08:29 2012 +0200

    [ng] refactor: support comments only for VarDef, not for ItemDef too
    
    Comments are actually handled and used for variable definitions only,
    so no point in handling it also for rule definitions.  And this will
    simplify our next step where we change how variable definitions (and
    related comments) are stored and displayed.
    
    * lib/Automake/ItemDef.pm (new): Don't take a $comment argument
    anymore, and don't set a $self->{comment} field in the returned
    object.
    (comment): Remove this accessor method.
    (Pod documentation): Adjusted.
    * lib/Automake/Rule.pm (define): Don't pass a $comment argument
    to the Automake::RuleDef constructor anymore.  No real loss here,
    since we were unconditionally passing an empty comment anyway.
    * lib/Automake/RuleDef.pm (new): Don't take a $comment argument
    anymore, and don't pass it to the Automake::ItemDef constructor.
    (Pod documentation): Adjusted.
    * lib/Automake/VarDef.pm (new): Directly store the $comment
    argument in the $self->{comment} field.  Don't pass the
    Automake::ItemDef constructor anymore.
    (comment): New accessor method (it is no more inherited from
    Automake::ItemDef anymore).
    
    Signed-off-by: Stefano Lattarini <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 Makefile.am                                       |    2 +
 automake.in                                       |  196 +++++++++------------
 lib/Automake/ItemDef.pm                           |   17 +--
 lib/Automake/Rule.pm                              |    4 +-
 lib/Automake/RuleDef.pm                           |   13 +-
 lib/Automake/VarDef.pm                            |  105 +++++-------
 lib/Automake/Variable.pm                          |  169 ++++++-------------
 t/backslash-tricks.sh                             |    6 +
 t/check2.sh                                       |    3 +-
 t/cond38.sh                                       |    3 -
 t/distcom-subdir.sh                               |   28 +++-
 t/distcom2.sh                                     |   19 +--
 t/longline.sh                                     |   19 ++-
 t/pluseq3.sh                                      |    2 +-
 t/{spy-trailing-backlash.sh => spy-var-append.sh} |   79 ++++-----
 t/subdir4.sh                                      |    9 +-
 t/subst-no-trailing-empty-line.sh                 |   97 ----------
 t/var-undef-append.sh                             |  100 +++++++++++
 18 files changed, 362 insertions(+), 509 deletions(-)
 copy t/{spy-trailing-backlash.sh => spy-var-append.sh} (53%)
 delete mode 100755 t/subst-no-trailing-empty-line.sh
 create mode 100755 t/var-undef-append.sh

diff --git a/Makefile.am b/Makefile.am
index 51fb414..c7b7686 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -333,6 +333,7 @@ XFAIL_TESTS = \
   t/all.sh \
   t/yacc-bison-skeleton-cxx.sh \
   t/yacc-bison-skeleton.sh \
+  t/comments-in-var-def.sh \
   t/cond17.sh \
   t/dist-srcdir2.sh \
   t/gcj6.sh \
@@ -347,6 +348,7 @@ XFAIL_TESTS = \
   t/remake-am-pr10111.sh \
   t/remake-m4-pr10111.sh \
   t/txinfo5.sh \
+  t/var-undef-append.sh \
   $(perl_fake_XFAIL_TESTS)
 
 # Some testsuite-influential variables should be overridable from the
diff --git a/automake.in b/automake.in
index 27bec18..1bf6a24 100644
--- a/automake.in
+++ b/automake.in
@@ -1144,16 +1144,14 @@ sub define_verbose_var ($$)
     my $var = verbose_var ($name);
     my $pvar = verbose_private_var ($name);
     my $silent_var = $pvar . '_0';
-    define_variable ($var,
-                     '$(' . $pvar . '_$(V))',
-                     INTERNAL);
-    define_variable ($pvar . '_',
-                     '$(' . $pvar . '_$(AM_DEFAULT_VERBOSITY))',
-                     INTERNAL);
+    define_variable ($var, INTERNAL,
+                     '$(' . $pvar . '_$(V))');
+    define_variable ($pvar . '_', INTERNAL,
+                     '$(' . $pvar . '_$(AM_DEFAULT_VERBOSITY))');
     if (! vardef ($silent_var, TRUE))
       {
         Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE,
-                                    $val, '', INTERNAL, VAR_ASIS);
+                                    $val, '', INTERNAL);
       }
 }
 
@@ -1261,7 +1259,7 @@ sub shadow_unconditionally ($$)
     {
       $varname = "am__${varname}_DIST";
       my @files = uniq ($var->value_as_list_recursive);
-      define_pretty_variable ($varname, TRUE, $where, @files);
+      define_variable ($varname, $where, @files);
     }
   return "\$($varname)"
 }
@@ -1302,9 +1300,8 @@ sub handle_languages
        if (&saw_sources_p (0) && keys %dep_files)
        {
            # Set location of depcomp.
-           &define_variable ('depcomp',
-                             '$(SHELL) $(am__config_aux_dir)/depcomp',
-                             INTERNAL);
+            define_variable ('depcomp', INTERNAL,
+                              '$(SHELL) $(am__config_aux_dir)/depcomp');
 
            require_conf_file ("$am_file.am", FOREIGN, 'depcomp');
 
@@ -1328,7 +1325,7 @@ sub handle_languages
     }
     else
     {
-       &define_variable ('depcomp', '', INTERNAL);
+       define_variable ('depcomp', INTERNAL, '');
     }
 
     my %done;
@@ -1859,7 +1856,7 @@ sub handle_single_transform ($$$$$%)
            unshift (@files, $object);
            # Distribute derived sources unless the source they are
            # derived from is not.
-           &push_dist_common ($object)
+           push_dist_common ($object)
              unless ($topparent =~ /^(?:nobase_)?nodist_/);
            next;
          }
@@ -2028,7 +2025,7 @@ sub handle_source_transform ($$$$%)
        msg_var ('unsupported', $ext_var, $ext_var->name . " can assume at most 
one value")
          if $default_source_ext =~ /[\t ]/;
        (my $default_source = $unxformed) =~ 
s,(\.[^./\\]*)?$,$default_source_ext,;
-       &define_variable ($one_file . "_SOURCES", $default_source, $where);
+       define_variable ($one_file . "_SOURCES", $where, $default_source);
        push (@sources, $default_source);
        push (@dist_sources, $default_source);
 
@@ -2039,12 +2036,12 @@ sub handle_source_transform ($$$$%)
                                   $one_file, $obj,
                                   $default_source, %transform);
        $linker ||= &resolve_linker (%linkers_used);
-       define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @result);
+       define_variable ($one_file . '_OBJECTS', $where, @result);
     }
     else
     {
        @keys = map { '$(' . $_ . $one_file . '_OBJECTS)' } @keys;
-       define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @keys);
+       define_variable ($one_file . '_OBJECTS', $where, @keys);
     }
 
     # If we want to use 'LINK' we must make sure it is defined.
@@ -2164,7 +2161,7 @@ sub handle_LIBOBJS_or_ALLOCA ($)
          # dependencies.
          $dir = "$config_libobj_dir/" if $config_libobj_dir ne '.';
          $dir = "$topsrcdir/$dir" if $relative_dir ne '.';
-         define_variable ('LIBOBJDIR', "$dir", INTERNAL);
+         define_variable ('LIBOBJDIR', INTERNAL, $dir);
          $clean_files{"\$($var)"} = MOSTLY_CLEAN;
          # If LTLIBOBJS is used, we must also clear LIBOBJS (which might
          # be created by libtool as a side-effect of creating LTLIBOBJS).
@@ -2364,7 +2361,7 @@ sub handle_programs
       else
        {
          # User didn't define prog_LDADD override.  So do it.
-         &define_variable ($xname . '_LDADD', '$(LDADD)', $where);
+         define_variable ($xname . '_LDADD', $where, '$(LDADD)');
 
          # This does a bit too much work.  But we need it to
          # generate _DEPENDENCIES when appropriate.
@@ -2427,9 +2424,9 @@ sub handle_libraries
       $var->requires_variables ('library used', 'RANLIB');
     }
 
-  &define_variable ('AR', 'ar', INTERNAL);
-  &define_variable ('ARFLAGS', 'cru', INTERNAL);
-  &define_verbose_tagvar ('AR');
+  define_variable ('AR', INTERNAL, 'ar');
+  define_variable ('ARFLAGS', INTERNAL, 'cru');
+  define_verbose_tagvar ('AR');
 
   foreach my $pair (@liblist)
     {
@@ -2462,7 +2459,7 @@ sub handle_libraries
 
       if (! var ($xlib . '_AR'))
        {
-         &define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where);
+         define_variable ($xlib . '_AR', $where, '$(AR) $(ARFLAGS)');
        }
 
       # Generate support for conditional object inclusion in
@@ -2476,7 +2473,7 @@ sub handle_libraries
        }
       else
        {
-         &define_variable ($xlib . "_LIBADD", '', $where);
+         define_variable ($xlib . "_LIBADD", $where, '');
        }
 
       reject_var ($xlib . '_LDADD',
@@ -2673,7 +2670,7 @@ sub handle_ltlibraries
        }
       else
        {
-         &define_variable ($xlib . "_LIBADD", '', $where);
+         define_variable ($xlib . "_LIBADD", $where, '');
        }
 
       reject_var ("${xlib}_LDADD",
@@ -2717,7 +2714,7 @@ sub handle_ltlibraries
            }
          else
            {
-             define_pretty_variable ($rpathvar, $rcond, INTERNAL, $val);
+             define_cond_variable ($rpathvar, $rcond, INTERNAL, $val);
            }
        }
 
@@ -3205,7 +3202,7 @@ sub handle_texinfo_helper ($)
   elsif ($config_aux_dir_set_in_configure_ac)
     {
       $texinfodir = '$(am__config_aux_dir)';
-      define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL);
+      define_variable ('TEXINFO_TEX', INTERNAL, "$texinfodir/texinfo.tex");
       $need_texi_file = 2; # so that we require_conf_file later
     }
   else
@@ -3213,7 +3210,7 @@ sub handle_texinfo_helper ($)
       $texinfodir = '$(srcdir)';
       $need_texi_file = 1;
     }
-  define_variable ('am__TEXINFO_TEX_DIR', $texinfodir, INTERNAL);
+  define_variable ('am__TEXINFO_TEX_DIR', INTERNAL, $texinfodir);
 
   push (@dist_targets, 'dist-info');
 
@@ -3233,7 +3230,7 @@ sub handle_texinfo_helper ($)
   # This next isn't strictly needed now -- the places that look here
   # could easily be changed to look in info_TEXINFOS.  But this is
   # probably better, in case noinst_TEXINFOS is ever supported.
-  define_variable ("TEXINFOS", variable_value ('info_TEXINFOS'), INTERNAL);
+  define_variable ("TEXINFOS", INTERNAL, variable_value ('info_TEXINFOS'));
 
   # Do some error checking.  Note that this file is not required
   # when in Cygnus mode; instead we defined TEXINFO_TEX explicitly
@@ -3324,7 +3321,7 @@ sub handle_man_pages
                      $trans_sect_vars{$varname} = 1;
                    }
 
-                 &push_dist_common ($varname)
+                 push_dist_common ($varname)
                    if $pfx eq 'dist_';
                }
            }
@@ -3359,7 +3356,7 @@ sub handle_man_pages
                {
                  $trans_vars{$varname} = 1;
                }
-             &push_dist_common ($varname)
+             push_dist_common ($varname)
                if $pfx eq 'dist_';
            }
        }
@@ -3571,16 +3568,14 @@ sub handle_dist ()
        }
       elsif ($subdirs->has_conditional_contents)
        {
-         define_pretty_variable
-           ('DIST_SUBDIRS', TRUE, INTERNAL,
-            uniq ($subdirs->value_as_list_recursive));
+         define_variable ('DIST_SUBDIRS', INTERNAL,
+                          uniq ($subdirs->value_as_list_recursive));
        }
       else
        {
          # We always define this because that is what 'distclean'
          # wants.
-         define_pretty_variable ('DIST_SUBDIRS', TRUE, INTERNAL,
-                                 '$(SUBDIRS)');
+         define_variable ('DIST_SUBDIRS', INTERNAL, '$(SUBDIRS)');
        }
     }
 
@@ -3617,14 +3612,14 @@ sub handle_dist ()
          # The file might be absent, but if it can be built it's ok.
          || rule $cfile)
        {
-         &push_dist_common ($cfile);
+         push_dist_common ($cfile);
        }
 
       # Don't use 'elsif' here because a file might meaningfully
       # appear in both directories.
       if ($check_aux && dir_has_case_matching_file ($config_aux_dir, $cfile))
        {
-         &push_dist_common ("$config_aux_dir/$cfile")
+         push_dist_common ("$config_aux_dir/$cfile")
        }
     }
 
@@ -3733,7 +3728,6 @@ sub handle_subdirs ()
     if $dsubdirs;
 
   $output_rules .= &file_contents ('subdirs', new Automake::Location);
-  rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross!
 }
 
 
@@ -3748,7 +3742,7 @@ sub scan_aclocal_m4 ()
 
   if (-f 'aclocal.m4')
     {
-      &define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL);
+      define_variable ("ACLOCAL_M4", INTERNAL, '$(top_srcdir)/aclocal.m4');
 
       my $aclocal = new Automake::XFile "< aclocal.m4";
       my $line = $aclocal->getline;
@@ -3876,12 +3870,11 @@ sub handle_configure ($$$@)
   $colon_infile = '' if $colon_infile eq ":$makefile.in";
   my @rewritten = rewrite_inputs_into_dependencies ($makefile, @inputs);
   my $regen_aclocal_m4 = scan_aclocal_m4;
-  define_pretty_variable ('am__aclocal_m4_deps', TRUE, INTERNAL,
-                         @configure_deps, '$(top_srcdir)/' . $configure_ac);
+  define_variable ('am__aclocal_m4_deps', INTERNAL,
+                   @configure_deps, '$(top_srcdir)/' . $configure_ac);
   my @configuredeps = ('$(am__aclocal_m4_deps)', '$(CONFIGURE_DEPENDENCIES)');
   push @configuredeps, '$(ACLOCAL_M4)' if -f 'aclocal.m4';
-  define_pretty_variable ('am__configure_deps', TRUE, INTERNAL,
-                         @configuredeps);
+  define_variable ('am__configure_deps', INTERNAL, @configuredeps);
 
   my $automake_options = '--' . $strictness_name .
                         (global_option 'no-dependencies' ? ' --ignore-deps' : 
'');
@@ -3975,7 +3968,7 @@ sub handle_configure ($$$@)
          push @config_h, "\$(top_builddir)/$out";
        }
     }
-  define_variable ("AM_CONFIG_HEADERS", "@config_h", INTERNAL)
+  define_variable ("AM_CONFIG_HEADERS", INTERNAL, @config_h)
     if @config_h;
 
   # Now look for other files in this directory which must be remade
@@ -4108,10 +4101,10 @@ sub handle_configure ($$$@)
     }
 
   # These files get removed by "make distclean".
-  define_pretty_variable ('CONFIG_CLEAN_FILES', TRUE, INTERNAL,
-                         @actual_other_files);
-  define_pretty_variable ('CONFIG_CLEAN_VPATH_FILES', TRUE, INTERNAL,
-                         @actual_other_vpath_files);
+  define_variable ('CONFIG_CLEAN_FILES', INTERNAL,
+                   @actual_other_files);
+  define_variable ('CONFIG_CLEAN_VPATH_FILES',INTERNAL,
+                   @actual_other_vpath_files);
 }
 
 # Handle C headers.
@@ -4497,7 +4490,7 @@ sub handle_tests
         }
       else
         {
-         define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL);
+         define_variable ('TEST_SUITE_LOG', INTERNAL, 'test-suite.log');
           require_conf_file ("parallel-tests", FOREIGN, 'test-driver');
           $output_rules .=
             file_contents ('parallel-tests', new Automake::Location,
@@ -4518,19 +4511,17 @@ sub handle_emacs_lisp
 
   return if ! @elfiles;
 
-  define_pretty_variable ('am__ELFILES', TRUE, INTERNAL,
-                         map { $_->[1] } @elfiles);
-  define_pretty_variable ('am__ELCFILES', TRUE, INTERNAL,
-                         '$(am__ELFILES:.el=.elc)');
+  define_variable ('am__ELFILES', INTERNAL, map { $_->[1] } @elfiles);
+  define_variable ('am__ELCFILES', INTERNAL, '$(am__ELFILES:.el=.elc)');
   # This one can be overridden by users.
-  define_pretty_variable ('ELCFILES', TRUE, INTERNAL, '$(LISP:.el=.elc)');
+  define_variable ('ELCFILES', INTERNAL, '$(LISP:.el=.elc)');
 
   push @all, '$(ELCFILES)';
 
   require_variables ($elfiles[0][0], "Emacs Lisp sources seen", TRUE,
                     'EMACS', 'lispdir');
   require_conf_file ($elfiles[0][0], FOREIGN, 'elisp-comp');
-  &define_variable ('elisp_comp', '$(am__config_aux_dir)/elisp-comp', 
INTERNAL);
+  define_variable ('elisp_comp', INTERNAL, '$(am__config_aux_dir)/elisp-comp');
 }
 
 # Handle Python
@@ -4542,7 +4533,7 @@ sub handle_python
 
   require_variables ($pyfiles[0][0], "Python sources seen", TRUE, 'PYTHON');
   require_conf_file ($pyfiles[0][0], FOREIGN, 'py-compile');
-  &define_variable ('py_compile', '$(am__config_aux_dir)/py-compile', 
INTERNAL);
+  define_variable ('py_compile', INTERNAL, '$(am__config_aux_dir)/py-compile');
 }
 
 # Handle Java.
@@ -4576,8 +4567,7 @@ sub handle_java
        $dir = $curs;
       }
 
-    define_pretty_variable ('am__java_sources', TRUE, INTERNAL,
-                            "@java_sources");
+    define_variable ('am__java_sources', INTERNAL, @java_sources);
 
     if ($dir eq 'check')
       {
@@ -5496,7 +5486,7 @@ sub lang_yacc_target_hook
        # Distribute the generated file, unless its .y source was
        # listed in a nodist_ variable.  (&handle_source_transform
        # will set DIST_SOURCE.)
-       &push_dist_common ($header)
+       push_dist_common ($header)
          if $transform{'DIST_SOURCE'};
 
        # The GNU rules say that yacc/lex output files should be removed
@@ -5529,7 +5519,7 @@ sub yacc_lex_finish_helper
 
   # FIXME: for now, no line number.
   require_conf_file ($configure_ac, FOREIGN, 'ylwrap');
-  &define_variable ('YLWRAP', '$(am__config_aux_dir)/ylwrap', INTERNAL);
+  define_variable ('YLWRAP', INTERNAL, '$(am__config_aux_dir)/ylwrap');
 }
 
 sub lang_yacc_finish
@@ -5826,35 +5816,34 @@ sub cond_stack_endif ($$$)
 ## ------------------------ ##
 
 
-# &define_pretty_variable ($VAR, $COND, $WHERE, @VALUE)
+# &define_cond_variable ($VAR, $COND, $WHERE, @VALUE)
 # -----------------------------------------------------
 # Like define_variable, but the value is a list, and the variable may
 # be defined conditionally.  The second argument is the condition
 # under which the value should be defined; this should be the empty
 # string to define the variable unconditionally.  The third argument
-# is a list holding the values to use for the variable.  The value is
-# pretty printed in the output file.
-sub define_pretty_variable ($$$@)
+# is a list holding the values to use for the variable.
+sub define_cond_variable ($$$@)
 {
     my ($var, $cond, $where, @value) = @_;
 
     if (! vardef ($var, $cond))
     {
        Automake::Variable::define ($var, VAR_AUTOMAKE, '', $cond, "@value",
-                                   '', $where, VAR_PRETTY);
+                                   '', $where);
        rvar ($var)->rdef ($cond)->set_seen;
     }
 }
 
 
-# define_variable ($VAR, $VALUE, $WHERE)
+# define_variable ($VAR, $WHERE, @VALUE)
 # --------------------------------------
 # Define a new Automake Makefile variable VAR to VALUE, but only if
 # not already defined.
-sub define_variable ($$$)
+sub define_variable ($$@)
 {
-    my ($var, $value, $where) = @_;
-    define_pretty_variable ($var, TRUE, $where, $value);
+    my ($var, $where, @value) = @_;
+    define_cond_variable ($var, TRUE, $where, @value);
 }
 
 
@@ -5865,9 +5854,8 @@ sub define_variable ($$$)
 sub define_files_variable (address@hidden)
 {
   my ($var, $basename, $extension, $where) = @_;
-  define_variable ($var,
-                  join (' ', map { "$_.$extension" } @$basename),
-                  $where);
+  define_variable ($var, $where,
+                  join (' ', map { "$_.$extension" } @$basename));
 }
 
 
@@ -5879,9 +5867,9 @@ sub define_configure_variable ($)
   # Some variables we do not want to output.  For instance it
   # would be a bad idea to output `U = @address@hidden when address@hidden@` 
can be
   # substituted as `\`.
-  my $pretty = exists $ignored_configure_vars{$var} ? VAR_SILENT : VAR_ASIS;
+  return if exists $ignored_configure_vars{$var};
   Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst $var,
-                             '', $configure_vars{$var}, $pretty);
+                             '', $configure_vars{$var});
 }
 
 
@@ -5897,14 +5885,13 @@ sub define_compiler_variable ($)
     my $libtool_tag = '';
     $libtool_tag = '--tag=' . $lang->libtool_tag . ' '
       if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
-    &define_variable ($var, $value, INTERNAL);
+    &define_variable ($var, INTERNAL, $value);
     if (var ('LIBTOOL'))
       {
        my $verbose = define_verbose_libtool ();
-       &define_variable ("LT$var",
+       &define_variable ("LT$var", INTERNAL,
                          "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) 
"
-                         . "\$(LIBTOOLFLAGS) --mode=compile $value",
-                         INTERNAL);
+                         . "\$(LIBTOOLFLAGS) --mode=compile $value");
       }
     define_verbose_tagvar ($lang->ccer || 'GEN');
 }
@@ -5921,7 +5908,7 @@ sub define_linker_variable ($)
     $libtool_tag = '--tag=' . $lang->libtool_tag . ' '
       if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
     # CCLD = $(CC).
-    &define_variable ($lang->lder, $lang->ld, INTERNAL);
+    &define_variable ($lang->lder, INTERNAL, $lang->ld);
     # CCLINK = $(CCLD) blah blah...
     my $link = '';
     if (var ('LIBTOOL'))
@@ -5930,9 +5917,9 @@ sub define_linker_variable ($)
        $link = "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) "
                . "\$(LIBTOOLFLAGS) --mode=link ";
       }
-    &define_variable ($lang->linker, $link . $lang->link, INTERNAL);
-    &define_variable ($lang->compiler,  $lang);
-    &define_verbose_tagvar ($lang->lder || 'GEN');
+    define_variable ($lang->linker, INTERNAL, $link . $lang->link);
+    define_variable ($lang->compiler, INTERNAL, $lang);
+    define_verbose_tagvar ($lang->lder || 'GEN');
 }
 
 sub define_per_target_linker_variable ($$)
@@ -5979,7 +5966,7 @@ sub define_per_target_linker_variable ($$)
   return ($lang->linker, $lang->lder)
     if $link_command eq $orig_command;
 
-  &define_variable ("${target}_LINK", $link_command, INTERNAL);
+  define_variable ("${target}_LINK", INTERNAL, $link_command);
   return ("${target}_LINK", $lang->lder);
 }
 
@@ -6026,7 +6013,6 @@ sub read_am_file ($$)
     my $comment = '';
     my $blank = 0;
     my $saw_bk = 0;
-    my $var_look = VAR_ASIS;
 
     use constant IN_VAR_DEF => 0;
     use constant IN_RULE_DEF => 1;
@@ -6130,7 +6116,7 @@ sub read_am_file ($$)
                  Automake::Variable::define ($last_var_name, VAR_MAKEFILE,
                                              $last_var_type, $cond,
                                              $last_var_value, $comment,
-                                             $last_where, VAR_ASIS)
+                                             $last_where)
                    if $cond != FALSE;
                  $comment = $spacing = '';
                }
@@ -6192,29 +6178,15 @@ sub read_am_file ($$)
                # 'sed's.
                $last_var_value = $3 . "\n";
              }
-           # Normally we try to output variable definitions in the
-           # same format they were input.  However, POSIX compliant
-           # systems are not required to support lines longer than
-           # 2048 bytes (most notably, some sed implementation are
-           # limited to 4000 bytes, and sed is used by config.status
-           # to rewrite Makefile.in into Makefile).  Moreover nobody
-           # would really write such long lines by hand since it is
-           # hardly maintainable.  So if a line is longer that 1000
-           # bytes (an arbitrary limit), assume it has been
-           # automatically generated by some tools, and flatten the
-           # variable definition.  Otherwise, keep the variable as it
-           # as been input.
-           $var_look = VAR_PRETTY if length ($last_var_value) >= 1000;
 
            if (!/\\$/)
              {
                Automake::Variable::define ($last_var_name, VAR_MAKEFILE,
                                            $last_var_type, $cond,
                                            $last_var_value, $comment,
-                                           $last_where, $var_look)
+                                           $last_where)
                  if $cond != FALSE;
                $comment = $spacing = '';
-               $var_look = VAR_ASIS;
              }
        }
        elsif (/$INCLUDE_PATTERN/o)
@@ -6687,8 +6659,7 @@ sub file_contents_internal ($$$%)
 
            Automake::Variable::define ($var,
                                        $is_am ? VAR_AUTOMAKE : VAR_MAKEFILE,
-                                       $type, $cond, $val, $comment, $where,
-                                       VAR_ASIS)
+                                       $type, $cond, $val, $comment, $where)
              if $cond != FALSE;
 
            $comment = $spacing = '';
@@ -6993,7 +6964,7 @@ sub am_install_var
   if (@used && $primary ne 'JAVA' && $primary ne 'PYTHON')
     {
       # Define it.
-      define_pretty_variable ($primary, TRUE, INTERNAL, @used);
+      define_variable ($primary, INTERNAL, @used);
       $output_vars .= "\n";
     }
 
@@ -7413,7 +7384,6 @@ sub require_conf_file_with_macro ($$$@)
 
 ################################################################
 
-
 # Push a list of files onto dist_common.
 sub push_dist_common
 {
@@ -7482,12 +7452,12 @@ sub generate_makefile ($$)
     }
 
   # Must do this after reading .am file.
-  define_variable ('subdir', $relative_dir, INTERNAL);
-  define_variable ('am__config_aux_dir', $am_config_aux_dir, INTERNAL);
+  define_variable ('subdir', INTERNAL, $relative_dir);
+  define_variable ('am__config_aux_dir', INTERNAL, $am_config_aux_dir);
 
   # If DIST_SUBDIRS is defined, make sure SUBDIRS is, so that
   # recursive rules are enabled.
-  define_pretty_variable ('SUBDIRS', TRUE, INTERNAL, '')
+  define_variable ('SUBDIRS', INTERNAL, '')
     if var 'DIST_SUBDIRS' && ! var 'SUBDIRS';
 
   # Check first, because we might modify some state.
@@ -7509,12 +7479,9 @@ sub generate_makefile ($$)
   handle_libtool;
 
   # Variables used by distdir.am and tags.am.
-  define_pretty_variable ('SOURCES', TRUE, INTERNAL, @sources);
-  if (! option 'no-dist')
-    {
-      define_pretty_variable ('am__dist_sources', TRUE, INTERNAL,
-                              @dist_sources);
-    }
+  define_variable ('SOURCES', INTERNAL, @sources);
+  define_variable ('am__dist_sources', INTERNAL, @dist_sources)
+    unless option 'no-dist';
 
   handle_texinfo;
   handle_emacs_lisp;
@@ -7528,8 +7495,7 @@ sub generate_makefile ($$)
   handle_minor_options;
 
   # Must come after handle_programs so that %known_programs is up-to-date.
-  define_variable ('am__all_progs', join(" ", keys %known_programs),
-                   INTERNAL);
+  define_variable ('am__all_progs', INTERNAL, keys %known_programs);
   handle_tests;
 
   # This must come after most other rules.
diff --git a/lib/Automake/ItemDef.pm b/lib/Automake/ItemDef.pm
index 8b64562..8f0a746 100644
--- a/lib/Automake/ItemDef.pm
+++ b/lib/Automake/ItemDef.pm
@@ -33,10 +33,6 @@ Automake::ItemDef - base class for Automake::VarDef and 
Automake::RuleDef
 
 Create a new Makefile-item definition.
 
-C<$comment> is any comment preceding the definition.  (Because
-Automake reorders items in the output, it also tries to carry comments
-around.)
-
 C<$location> is the place where the definition occurred, it should be
 an instance of L<Automake::Location>.
 
@@ -44,12 +40,11 @@ C<$owner> specifies who owns the rule.
 
 =cut
 
-sub new ($$$$)
+sub new ($$$)
 {
-  my ($class, $comment, $location, $owner) = @_;
+  my ($class, $location, $owner) = @_;
 
   my $self = {
-    comment => $comment,
     location => $location,
     owner => $owner,
   };
@@ -58,8 +53,6 @@ sub new ($$$$)
   return $self;
 }
 
-=item C<$def-E<gt>comment>
-
 =item C<$def-E<gt>location>
 
 =item C<$def-E<gt>owner>
@@ -69,12 +62,6 @@ documentation of C<new>'s arguments for a description of 
these.
 
 =cut
 
-sub comment ($)
-{
-  my ($self) = @_;
-  return $self->{'comment'};
-}
-
 sub location ($)
 {
   my ($self) = @_;
diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm
index e49e382..8e21ff9 100644
--- a/lib/Automake/Rule.pm
+++ b/lib/Automake/Rule.pm
@@ -620,8 +620,8 @@ sub define ($$$$$;$)
   # Finally define this rule.
   for my $c (@conds)
     {
-      my $def = new Automake::RuleDef ($target, '', $where->clone,
-                                      $owner, $source);
+      my $def = new Automake::RuleDef ($target, $where->clone, $owner,
+                                       $source);
       $rule->set ($c, $def);
     }
 
diff --git a/lib/Automake/RuleDef.pm b/lib/Automake/RuleDef.pm
index 571111c..9704f4a 100644
--- a/lib/Automake/RuleDef.pm
+++ b/lib/Automake/RuleDef.pm
@@ -59,19 +59,18 @@ use constant RULE_USER => 1;     # Rule defined in the 
user's Makefile.am.
 
 =over 4
 
-=item C<new Automake::RuleDef ($name, $comment, $location, $owner, $source)>
+=item C<new Automake::RuleDef ($name, $location, $owner, $source)>
 
-Create a new rule definition with target C<$name>, with associated comment
-C<$comment>, Location C<$location> and owner C<$owner>, defined in file
-C<$source>.
+Create a new rule definition with target C<$name>, Location C<$location>
+and owner C<$owner>, defined in file C<$source>.
 
 =cut
 
-sub new ($$$$$)
+sub new ($$$$)
 {
-  my ($class, $name, $comment, $location, $owner, $source) = @_;
+  my ($class, $name, $location, $owner, $source) = @_;
 
-  my $self = Automake::ItemDef::new ($class, $comment, $location, $owner);
+  my $self = Automake::ItemDef::new ($class, $location, $owner);
   $self->{'source'} = $source;
   $self->{'name'} = $name;
   return $self;
diff --git a/lib/Automake/VarDef.pm b/lib/Automake/VarDef.pm
index dde99ac..bc3ca82 100644
--- a/lib/Automake/VarDef.pm
+++ b/lib/Automake/VarDef.pm
@@ -24,8 +24,7 @@ use Automake::ItemDef;
 require Exporter;
 use vars '@ISA', '@EXPORT';
 @ISA = qw/Automake::ItemDef Exporter/;
address@hidden = qw (&VAR_AUTOMAKE &VAR_CONFIGURE &VAR_MAKEFILE
-             &VAR_ASIS &VAR_PRETTY &VAR_SILENT &VAR_SORTED);
address@hidden = qw (&VAR_AUTOMAKE &VAR_CONFIGURE &VAR_MAKEFILE);
 
 =head1 NAME
 
@@ -43,7 +42,7 @@ Automake::VarDef - a class for variable definitions
   my $loc = new Automake::Location 'Makefile.am:2';
   my $def = new Automake::VarDef ('foo', 'bar # more comment',
                                   '# any comment',
-                                  $loc, '', VAR_MAKEFILE, VAR_ASIS);
+                                  $loc, '', VAR_MAKEFILE);
 
   # Appending to a definition.
   $def->append ('value to append', 'comment to append');
@@ -56,7 +55,6 @@ Automake::VarDef - a class for variable definitions
   my $location = $def->location;
   my $type     = $def->type;
   my $owner    = $def->owner;
-  my $pretty   = $def->pretty;
 
   # Changing owner.
   $def->set_owner (VAR_CONFIGURE,
@@ -91,27 +89,6 @@ use constant VAR_AUTOMAKE => 0; # Variable defined by 
Automake.
 use constant VAR_CONFIGURE => 1;# Variable defined in configure.ac.
 use constant VAR_MAKEFILE => 2; # Variable defined in Makefile.am.
 
-=item C<VAR_ASIS>, C<VAR_PRETTY>, C<VAR_SILENT>, C<VAR_SORTED>
-
-Possible print styles.  C<VAR_ASIS> variables should be output as-is.
-C<VAR_PRETTY> variables are wrapped on multiple lines if they cannot
-fit on one.  C<VAR_SILENT> variables are not output at all.  Finally,
-C<VAR_SORTED> variables should be sorted and then handled as
-C<VAR_PRETTY> variables.
-
-C<VAR_SILENT> variables can also be overridden silently (unlike the
-other kinds of variables whose overriding may sometimes produce
-warnings).
-
-=cut
-
-# Possible values for pretty.
-use constant VAR_ASIS => 0;    # Output as-is.
-use constant VAR_PRETTY => 1;  # Pretty printed on output.
-use constant VAR_SILENT => 2;  # Not output.  (Can also be
-                               # overridden silently.)
-use constant VAR_SORTED => 3;  # Sorted and pretty-printed.
-
 =back
 
 =head2 Methods
@@ -121,7 +98,7 @@ from L<Automake::ItemDef>.
 
 =over 4
 
-=item C<my $def = new Automake::VarDef ($varname, $value, $comment, $location, 
$type, $owner, $pretty)>
+=item C<my $def = new Automake::VarDef ($varname, $value, $comment, $location, 
$type, $owner)>
 
 Create a new Makefile-variable definition.  C<$varname> is the name of
 the variable being defined and C<$value> its value.
@@ -140,15 +117,12 @@ C<$owner> specifies who owns the variables, it can be one 
of
 C<VAR_AUTOMAKE>, C<VAR_CONFIGURE>, or C<VAR_MAKEFILE> (see these
 definitions).
 
-Finally, C<$pretty> tells how the variable should be output, and can
-be one of C<VAR_ASIS>, C<VAR_PRETTY>, or C<VAR_SILENT>, or
-C<VAR_SORTED> (see these definitions).
-
 =cut
 
 sub new ($$$$$$$$)
 {
-  my ($class, $var, $value, $comment, $location, $type, $owner, $pretty) = @_;
+  my ($class, $var, $value, $comment, $cond, $location, $type,
+      $owner) = @_;
 
   # A user variable must be set by either '=' or ':=', and later
   # promoted to '+='.
@@ -157,42 +131,28 @@ sub new ($$$$$$$$)
       error $location, "$var must be set with '=' before using '+='";
     }
 
-  my $self = Automake::ItemDef::new ($class, $comment, $location, $owner);
-  $self->{'value'} = $value;
+  my $self = Automake::ItemDef::new ($class, $location, $owner);
+  $self->{'value_list'} = [ { value => $value, cond => $cond } ];
   $self->{'type'} = $type;
-  $self->{'pretty'} = $pretty;
   $self->{'seen'} = 0;
+  $self->{'comment_list'} = [ { text => $comment, cond => $cond } ];
   return $self;
 }
 
-=item C<$def-E<gt>append ($value, $comment)>
+=item C<$def-E<gt>append ($value, $comment, $cond)>
 
-Append C<$value> and <$comment> to the existing value and comment of
-C<$def>.  This is normally called on C<+=> definitions.
+Append C<$value> and C<$comment> to the existing value and comment of
+C<$def> in condition C<$cond>.  This is normally called on C<+=>
+definitions.
 
 =cut
 
 sub append ($$$)
 {
-  my ($self, $value, $comment) = @_;
-  $self->{'comment'} .= $comment;
-
-  my $val = $self->{'value'};
+  my ($self, $value, $comment, $cond) = @_;
 
-  # Strip comments from augmented variables.  This is so that
-  #   VAR = foo # com
-  #   VAR += bar
-  # does not become
-  #   VAR = foo # com bar
-  # Furthermore keeping '#' would not be portable if the variable is
-  # output on multiple lines.
-  $val =~ s/ ?#.*//;
-  # Insert a separator, if required.
-  $val .= ' ' if $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;
+  push @{$self->{'comment_list'}}, { text => $comment, cond => $cond };
+  push @{$self->{'value_list'}}, { value => $value, cond => $cond };
 }
 
 =item C<$def-E<gt>value>
@@ -201,8 +161,6 @@ sub append ($$$)
 
 =item C<$def-E<gt>type>
 
-=item C<$def-E<gt>pretty>
-
 Accessors to the various constituents of a C<VarDef>.  See the
 documentation of C<new>'s arguments for a description of these.
 
@@ -212,30 +170,48 @@ sub value ($)
 {
   my ($self) = @_;
   my $val = $self->raw_value;
+
   # Strip anything past '#'.  '#' characters cannot be escaped
   # in Makefiles, so we don't have to be smart.
+  # FIXME: Actually, '#' *can* be escaped in GNU make ...
+  # FIXME: Should we adapt our code?
   $val =~ s/#.*$//s;
   # Strip backslashes.
   $val =~ s/\\$/ /mg;
   return $val;
 }
 
-sub raw_value ($)
+sub comment ($)
 {
   my ($self) = @_;
-  return $self->{'value'};
+  return join ("", map { $_->{text} } @{$self->{'comment_list'}});
 }
 
-sub type ($)
+sub raw_value ($)
 {
   my ($self) = @_;
-  return $self->{'type'};
+  my @values = map { $_->{value} } @{$self->{'value_list'}};
+
+  # Strip comments from augmented variables.  This is so that
+  #   VAR = foo # com
+  #   VAR += bar
+  # does not become
+  #   VAR = foo # com bar
+  # Furthermore keeping '#' would not be portable if the variable is
+  # output on multiple lines.
+  # But we have to preserve escaped '#', so that a definition line:
+  #   hash = \#
+  # remains possible.  To make our life easier, we just assume that
+  # any tailed comment must be separated with whitespace from the
+  # actual variable value.
+  map { s/[ \t]+#.*// } @values;
+  return join (' ', @values);
 }
 
-sub pretty ($)
+sub type ($)
 {
   my ($self) = @_;
-  return $self->{'pretty'};
+  return $self->{'type'};
 }
 
 =item C<$def-E<gt>set_owner ($owner, $location)>
@@ -309,13 +285,12 @@ sub dump ($)
     }
 
   my $where = $self->location->dump;
-  my $comment = $self->comment;
   my $value = $self->raw_value;
   my $type = $self->type;
 
   return "{
       type: $type=
-      where: $where      comment: $comment
+      where: $where
       value: $value
       owner: $owner
     }\n";
diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm
index a1ef30f..50a4dad 100644
--- a/lib/Automake/Variable.pm
+++ b/lib/Automake/Variable.pm
@@ -55,7 +55,7 @@ Automake::Variable - support for variable definitions
   # Defining a variable.
   Automake::Variable::define($varname, $owner, $type,
                              $cond, $value, $comment,
-                             $where, $pretty)
+                             $where)
 
   # Looking up a variable.
   my $var = var $varname;
@@ -129,11 +129,6 @@ non-object).
 
 =cut
 
-my $_VARIABLE_CHARACTERS = 'address@hidden';
-my $_VARIABLE_PATTERN = '^' . $_VARIABLE_CHARACTERS . "\$";
-my $_VARIABLE_RECURSIVE_PATTERN =
-    '^(address@hidden|\$[({]' . $_VARIABLE_CHARACTERS . '[})]?)+' . "\$";
-
 # The order in which variables should be output.  (May contain
 # duplicates -- only the first occurrence matters.)
 my @_var_order;
@@ -427,7 +422,6 @@ sub _new ($$)
   my ($class, $name) = @_;
   my $self = Automake::Item::new ($class, $name);
   $self->{'scanned'} = 0;
-  $self->{'last-append'} = []; # helper variable for last conditional append.
   $_variable_dict{$name} = $self;
   if ($name =~ /_([[:alnum:]]+)$/)
     {
@@ -451,7 +445,7 @@ sub _check_ambiguous_condition ($$$)
   # We allow silent variables to be overridden silently,
   # by either silent or non-silent variables.
   my $def = $self->def ($ambig_cond);
-  if ($message && $def->pretty != VAR_SILENT)
+  if ($message)
     {
       msg 'syntax', $where, "$message ...", partial => 1;
       msg_var ('syntax', $var, "... '$var' previously defined here");
@@ -488,6 +482,16 @@ sub check_defined_unconditionally ($;$$)
     }
 }
 
+sub _has_line_too_long ($)
+{
+  my ($text) = @_;
+  foreach my $line (split "\n", $text)
+    {
+      return 1 if length ($line) >= 1000 ;
+    }
+  return 0;
+}
+
 =item C<$str = $var-E<gt>output (address@hidden)>
 
 Format all the definitions of C<$var> if C<@cond> is not specified,
@@ -512,48 +516,32 @@ sub output ($@)
                  . $self->name . "'")
        unless $def;
 
-      next
-       if $def->pretty == VAR_SILENT;
-
       $res .= $def->comment;
 
       my $val = $def->raw_value;
       my $equals = $def->type eq ':' ? ':=' : '=';
       my $str = $cond->subst_string;
-
-
-      if ($def->pretty == VAR_ASIS)
-       {
-         my $output_var = "$name $equals $val";
-         $output_var =~ s/^/$str/meg;
-         $res .= "$output_var\n";
-       }
-      elsif ($def->pretty == VAR_PRETTY)
-       {
-         # Suppress escaped new lines.  &makefile_wrap will
-         # add them back, maybe at other places.
-         $val =~ s/\\$//mg;
-         my $wrap = makefile_wrap ("$str$name $equals", "$str\t",
-                                   split (' ', $val));
-
-         # If the last line of the definition is made only of
-         # @substitutions@, append an empty variable to make sure it
-         # cannot be substituted as a blank line (that would confuse
-         # HP-UX Make).
-         $wrap = makefile_wrap ("$str$name $equals", "$str\t",
-                                split (' ', $val), '$(am__empty)')
-           if $wrap =~ /\n(address@hidden@)+\s*$/;
-
-         $res .= $wrap;
-       }
-      else # ($def->pretty == VAR_SORTED)
-       {
-         # Suppress escaped new lines.  &makefile_wrap will
-         # add them back, maybe at other places.
-         $val =~ s/\\$//mg;
-         $res .= makefile_wrap ("$str$name $equals", "$str\t",
-                                sort (split (' ' , $val)));
-       }
+      my $output_var;
+      # Definition of variables whose value contains unescaped newlines
+      # (likely as a result of a "+=" appending) cannot be output as-is;
+      # we need to wrap their definition.  We also wrap the definition if
+      # the length of any line is too big, since POSIX-compliant systems
+      # are not required to support lines longer than 2048 bytes (most
+      # notably, some sed implementation are limited to 4000 bytes, and
+      # sed is used by config.status to rewrite Makefile.in into Makefile).
+      if (_has_line_too_long ($val) or $val =~ /(:?\\\\)*[^\\]\n./)
+        {
+          $val =~ s/\\$//mg;
+          $output_var = makefile_wrap ("$str$name $equals", "$str\t",
+                                       split (' ', $val));
+        }
+      else
+        {
+          $val =~ s/^[ \t]*//;
+          $output_var = "$name $equals $val";
+          $output_var =~ s/^/$str/meg;
+        }
+      $res .= "$output_var\n";
     }
   return $res;
 }
@@ -707,7 +695,7 @@ sub dump ($)
 
 =over 4
 
-=item C<Automake::Variable::define($varname, $owner, $type, $cond, $value, 
$comment, $where, $pretty)>
+=item C<Automake::Variable::define($varname, $owner, $type, $cond, $value, 
$comment, $where)>
 
 Define or append to a new variable.
 
@@ -731,17 +719,11 @@ assignment.
 
 C<$where>: the C<Location> of the assignment.
 
-C<$pretty>: whether C<$value> should be pretty printed (one of
-C<VAR_ASIS>, C<VAR_PRETTY>, C<VAR_SILENT>, or C<VAR_SORTED>, defined
-by by L<Automake::VarDef>).  C<$pretty> applies only to real
-assignments.  I.e., it does not apply to a C<+=> assignment (except
-when part of it is being done as a conditional C<=> assignment).
-
 =cut
 
-sub define ($$$$$$$$)
+sub define ($$$$$$$)
 {
-  my ($var, $owner, $type, $cond, $value, $comment, $where, $pretty) = @_;
+  my ($var, $owner, $type, $cond, $value, $comment, $where) = @_;
 
   prog_error "$cond is not a reference"
     unless ref $cond;
@@ -749,12 +731,6 @@ sub define ($$$$$$$$)
   prog_error "$where is not a reference"
     unless ref $where;
 
-  prog_error "pretty argument missing"
-    unless defined $pretty && ($pretty == VAR_ASIS
-                              || $pretty == VAR_PRETTY
-                              || $pretty == VAR_SILENT
-                              || $pretty == VAR_SORTED);
-
   # If there's a comment, make sure it is \n-terminated.
   if ($comment)
     {
@@ -811,9 +787,7 @@ sub define ($$$$$$$$)
   # 1. append (+=) to a variable defined for current condition
   if ($type eq '+' && ! $new_var)
     {
-      $def->append ($value, $comment);
-      $self->{'last-append'} = [];
-
+      $def->append ($value, $comment, $cond);
       # Only increase owners.  A VAR_CONFIGURE variable augmented in a
       # Makefile.am becomes a VAR_MAKEFILE variable.
       $def->set_owner ($owner, $where->clone)
@@ -822,63 +796,24 @@ sub define ($$$$$$$$)
   # 2. append (+=) to a variable defined for *another* condition
   elsif ($type eq '+' && ! $self->conditions->false)
     {
-      # * Generally, $cond is not TRUE.  For instance:
+      # * If we have an input like:
       #     FOO = foo
       #     if COND
       #       FOO += bar
       #     endif
-      #   In this case, we declare an helper variable conditionally,
-      #   and append it to FOO:
+      #   we declare an helper variable conditionally, and append
+      #   it to FOO:
       #     FOO = foo $(am__append_1)
       #     @address@hidden = bar
       #   Of course if FOO is defined under several conditions, we add
       #   $(am__append_1) to each definitions.
-      #
-      # * If $cond is TRUE, we don't need the helper variable.  E.g., in
-      #     if COND1
-      #       FOO = foo1
-      #     else
-      #       FOO = foo2
-      #     endif
-      #     FOO += bar
-      #   we can add bar directly to all definition of FOO, and output
-      #     @address@hidden = foo1 bar
-      #     @address@hidden = foo2 bar
-
-      my $lastappend = [];
-      # Do we need an helper variable?
-      if ($cond != TRUE)
-        {
-         # Can we reuse the helper variable created for the previous
-         # append?  (We cannot reuse older helper variables because
-         # we must preserve the order of items appended to the
-         # variable.)
-         my $condstr = $cond->string;
-         my $key = "$var:$condstr";
-         my ($appendvar, $appendvarcond) = @{$self->{'last-append'}};
-         if ($appendvar && $condstr eq $appendvarcond)
-           {
-             # Yes, let's simply append to it.
-             $var = $appendvar;
-             $owner = VAR_AUTOMAKE;
-             $self = var ($var);
-             $def = $self->rdef ($cond);
-             $new_var = 0;
-           }
-         else
-           {
-             # No, create it.
-             my $num = ++$_appendvar;
-             my $hvar = "am__append_$num";
-             $lastappend = [$hvar, $condstr];
-             &define ($hvar, VAR_AUTOMAKE, '+',
-                      $cond, $value, $comment, $where, $pretty);
-
-             # Now HVAR is to be added to VAR.
-             $comment = '';
-             $value = "\$($hvar)";
-           }
-       }
+      my $num = ++$_appendvar;
+      my $hvar = "am__append_$num";
+      &define ($hvar, VAR_AUTOMAKE, '+',
+               $cond, $value, $comment, $where);
+      # Now HVAR is to be added to VAR.
+      $comment = '';
+      $value = "\$($hvar)";
 
       # Add VALUE to all definitions of SELF.
       foreach my $vcond ($self->conditions->conds)
@@ -904,11 +839,9 @@ sub define ($$$$$$$$)
            }
          else
            {
-             &define ($var, $owner, '+', $vcond, $value, $comment,
-                      $where, $pretty);
+             &define ($var, $owner, '+', $vcond, $value, $comment, $where);
            }
        }
-      $self->{'last-append'} = $lastappend;
     }
   # 3. first assignment (=, :=, or +=)
   else
@@ -928,8 +861,8 @@ sub define ($$$$$$$$)
       # Assignments to a macro set its location.  We don't adjust
       # locations for '+='.  Ideally I suppose we would associate
       # line numbers with random bits of text.
-      $def = new Automake::VarDef ($var, $value, $comment, $where->clone,
-                                  $type, $owner, $pretty);
+      $def = new Automake::VarDef ($var, $value, $comment, $cond,
+                                   $where->clone, $type, $owner);
       $self->set ($cond, $def);
       push @_var_order, $var;
     }
@@ -1542,7 +1475,7 @@ sub transform_variable_recursively ($$$$$&;%)
               foreach (@conds)
                 {
                   define ($varname, VAR_AUTOMAKE, '', $_, "@result",
-                          '', $where, VAR_PRETTY);
+                          '', $where);
                 }
             }
         }
diff --git a/t/backslash-tricks.sh b/t/backslash-tricks.sh
index dea9e39..e236183 100755
--- a/t/backslash-tricks.sh
+++ b/t/backslash-tricks.sh
@@ -48,6 +48,11 @@ var4 = $(var3)
 var5 = ok \
 # ko
 
+var6 = \# \
+\#\\\\\# seen # not seen
+
+var6 += \# \# # again not seen
+
 .PHONY: test
 test:
        test -z '$(var1)'
@@ -57,6 +62,7 @@ test:
        # Use '[', not 'test', here, so that spurious comments
        # are ensured to cause syntax errors.
        [ $(var5) = ok ]
+       test '$(var6)' = '# #\\# seen # #'
 
 # Yes, this file ends with a backslash-newline.  So what?
 \
diff --git a/t/check2.sh b/t/check2.sh
index 73eb0b7..66ea973 100755
--- a/t/check2.sh
+++ b/t/check2.sh
@@ -62,8 +62,7 @@ $EGREP '^check:.* check-recursive( |$)' Makefile.in
 $EGREP '^check:.* check-am( |$)' dir/Makefile.in
 
 # Make sure subrun.sh is still on its line as above.  This means Automake
-# hasn't rewritten the TESTS line unnecessarily (we can tell, because all
-# Automake variables are reformatted by VAR_PRETTY).
+# hasn't rewritten the TESTS line unnecessarily.
 grep '^  subrun\.sh$' Makefile.in
 
 :
diff --git a/t/cond38.sh b/t/cond38.sh
index 71ae69a..e63d8d1 100755
--- a/t/cond38.sh
+++ b/t/cond38.sh
@@ -59,9 +59,6 @@ $AUTOCONF
 $AUTOMAKE
 
 ./configure
-# Make sure no extra variable was created for the last 3 items.
-grep 'append.*=.* h iXYZ jZYX' Makefile
-# Check good ordering.
 $MAKE test
 
 :
diff --git a/t/distcom-subdir.sh b/t/distcom-subdir.sh
index 20aa8a5..ac1420f 100755
--- a/t/distcom-subdir.sh
+++ b/t/distcom-subdir.sh
@@ -17,6 +17,7 @@
 # Test to make sure that if an auxfile (here depcomp) is required
 # by a subdir Makefile.am, it is distributed by that Makefile.am.
 
+required=cc
 . ./defs || Exit 1
 
 cat >> configure.ac << 'END'
@@ -28,14 +29,18 @@ END
 
 cat > Makefile.am << 'END'
 SUBDIRS = subdir
+test-distdir: distdir
+       test -f $(distdir)/depcomp
+.PHONY: test-distdir
+check-local: test-distdir
 END
 
 rm -f depcomp
 mkdir subdir
 
 cat > subdir/Makefile.am << 'END'
-.PHONY: test-distcommon
-test-distcommon:
+.PHONY: test-distcom
+test-distcom:
        echo ' ' $(am__dist_common) ' ' | $(FGREP) ' $(top_srcdir)/depcomp '
 END
 
@@ -46,15 +51,26 @@ test ! -f depcomp
 
 cat >> subdir/Makefile.am << 'END'
 bin_PROGRAMS = foo
+.PHONY: test-distcom
+test-distcom:
+       echo ' ' $(am__dist_common) ' ' | $(FGREP) ' $(top_srcdir)/depcomp '
+check-local: test-distcom
 END
 
-: > subdir/foo.c
+cat > subdir/foo.c <<'END'
+int main (void)
+{
+  return 0;
+}
+END
 
 $AUTOMAKE -a subdir/Makefile
 test -f depcomp
+
 ./configure
-(cd subdir && $MAKE test-distcommon)
-$MAKE distdir
-test -f $distdir/depcomp
+(cd subdir && $MAKE test-distcom)
+$MAKE test-distdir
+
+$MAKE distcheck
 
 :
diff --git a/t/distcom2.sh b/t/distcom2.sh
index 76ded06..08d2679 100755
--- a/t/distcom2.sh
+++ b/t/distcom2.sh
@@ -50,23 +50,8 @@ for opt in '' --no-force; do
   test -f depcomp
 
   for dir in . subdir; do
-    # FIXME: the logic of this check and other similar ones in other
-    # FIXME: 'distcom*.test' files should be factored out in a common
-    # FIXME: subroutine in 'defs'...
-    sed -n -e "
-      /^am__dist_common =.*\\\\$/ {
-        :loop
-        p
-        n
-        t clear
-        :clear
-        s/\\\\$/\\\\/
-        t loop
-        s/$/ /
-        s/[$tab ][$tab ]*/ /g
-        p
-        n
-      }" $dir/Makefile.in > $dir/dc.txt
+    sed -n 's/^am__dist_common = *\(.*\)$/ \1 /p' \
+      <$dir/Makefile.in >$dir/dc.txt
   done
 
   cat dc.txt # For debugging.
diff --git a/t/longline.sh b/t/longline.sh
index dd5664d..4900da4 100755
--- a/t/longline.sh
+++ b/t/longline.sh
@@ -14,17 +14,24 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Long lines of += should be wrapped.
+# Long lines of = and += should be wrapped.
 # Report from Simon Josefsson.
 
 . ./defs || Exit 1
 
-(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
+i=0
+while test $i -lt 30; do
+  echo some_very_very_long_variable_content_$i
+  i=$((i + 1))
+done > t
+
+{ echo "DUMMY =" && sed 's/^/DUMMY +=/' t; } > Makefile.am
+{ echo "ZARDOZ =" && cat t; } | tr '\012\015' '  ' >> Makefile.am
 
 $ACLOCAL
 $AUTOMAKE
+grep long_variable Makefile.in # For debugging.
 test 80 -ge `grep DUMMY Makefile.in | wc -c`
+test 80 -ge `grep ZARDOZ Makefile.in | wc -c`
+
+:
diff --git a/t/pluseq3.sh b/t/pluseq3.sh
index fc7a496..a5fdaca 100755
--- a/t/pluseq3.sh
+++ b/t/pluseq3.sh
@@ -43,7 +43,7 @@ $ACLOCAL
 $AUTOMAKE
 
 grep 'address@hidden@data_DATA = 
zarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr \\$' 
Makefile.in
-grep "address@hidden@${tab}doz$" Makefile.in
+grep "address@hidden@[ $tab]*doz$" Makefile.in
 
 grep 'address@hidden@data_DATA = dog$' Makefile.in
 
diff --git a/t/spy-trailing-backlash.sh b/t/spy-var-append.sh
similarity index 53%
copy from t/spy-trailing-backlash.sh
copy to t/spy-var-append.sh
index cc5d720..b7d614f 100755
--- a/t/spy-trailing-backlash.sh
+++ b/t/spy-var-append.sh
@@ -14,59 +14,44 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check that GNU make line-continuation with backslash-newline has the
-# semantic we expect.
+# GNU make allows us to append to undefined variables.
+# Also, if we override a variable definition from the command line,
+# any '+=' appending to it gets overridden as well.
 
 am_create_testdir=empty
 . ./defs || Exit 1
 
 cat > Makefile << 'END'
-default:
-
-hash = \#
-ok: ; true :--$(hash)--:
-
-var1 = \
-rule1:
-
-rule2: \
-; echo ok > sentinel
-
-# The backslash doesn't cause we to continue to read after
-# the fist blank line.
-rule3: \
-
-var2 = ok
-
-# Ditto.
-var3 = a \
-
-b:
-
-# The backslash will cause the next line to be a comment as well \
-$(error comment not continued)
-
-var4 = foo \
-# not seen
-
-.PHONY: test
-test:
-       test $(var1) = rule1:
-       test $(var2) = ok
-       test $(var3) = a
-       test $(var4) = foo
-       test -z '$(var5)'
-
-var5 = \
+var0 += foo
+
+var1 += bar
+var1 += baz
+
+var2 = a
+var2 += b
+
+var3 := x
+var3 += y
+
+.PHONY: test1 test2
+test1:
+       test x'$(var0)' = x'foo'
+       test x'$(var1)' = x'bar baz'
+       test x'$(var2)' = x'a b'
+       test x'$(var3)' = x'x y'
+test2:
+       test x'$(var0)' = x'mu'
+       test x'$(var1)' = x
+       test x'$(var2)' = x'two'
+       test x'$(var3)' = x'three'
 END
 
-$MAKE
-$MAKE ok
-$MAKE ok | grep ':--#--:'
-$MAKE rule1 && Exit 1
-$MAKE rule2
-test -f sentinel
-$MAKE rule3
-$MAKE test
+checkit ()
+{
+  $MAKE "$@" 2>stderr && test ! -s stderr || { cat stderr >&2; Exit 1; }
+}
+
+checkit test1
+checkit test2 var0=mu var1= var2=two var3=three
 
 :
diff --git a/t/subdir4.sh b/t/subdir4.sh
index 8bf5823..7c20a6a 100755
--- a/t/subdir4.sh
+++ b/t/subdir4.sh
@@ -48,7 +48,7 @@ libfoo_a_SOURCES = foo.c
 END
 
 cat > lib/foo.c << 'END'
-int foo () {}
+int foo (void) { return 0; }
 END
 
 cat > src/Makefile.am << 'END'
@@ -60,11 +60,4 @@ END
 $ACLOCAL
 $AUTOMAKE --gnu
 
-# Make sure that depcomp is *not* included in the definition
-# of am__dist_common in lib/Makefile.in.  If you change this test
-# so that more files are included in lib's am__dist_common definition,
-# then you must handle the case in which depcomp is listed on a
-# continued line.
-grep '^am__dist_common.*depcomp' lib/Makefile.in && Exit 1
-
 :
diff --git a/t/subst-no-trailing-empty-line.sh 
b/t/subst-no-trailing-empty-line.sh
deleted file mode 100755
index 82b4e55..0000000
--- a/t/subst-no-trailing-empty-line.sh
+++ /dev/null
@@ -1,97 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2003-2012 Free Software Foundation, Inc.
-#
-# This program 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.
-#
-# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# If the last line of a automake-rewritten definition is made only of
-# @substitutions@, automake should take care of appending an empty
-# variable to make sure that line cannot end up substituted as a blank
-# line (that would confuse HP-UX Make).
-# These checks have been introduced in commit 'Release-1-9-254-g9d0eaef'
-# into the former test 'subst2.test'.
-
-. ./defs || Exit 1
-
-# These are deliberately quite long, so that the xxx_PROGRAMS definition
-# in Makefile.am below will be split on multiple lines, with the last
-# line containing only @substituted@ stuff that expands to empty (this is
-# required to expose the bug we are testing).
-v1=ABCDEFGHIJKLMNOPQRSTUVWX
-v2=ABCDEFGHIJKLMNOPQRSTUVWXY
-v3=ABCDEFGHIJKLMNOPQRSTUVWXYZ
-
-# Literal backslash for use by grep.
-bs='\\'
-
-cat >> configure.ac <<END
-AC_SUBST([A], [''])
-AC_SUBST([$v1], [''])
-AC_SUBST([$v2], [''])
-AC_SUBST([$v3], [''])
-AC_OUTPUT
-END
-
-cat >Makefile.am <<END
-AUTOMAKE_OPTIONS = no-dependencies
-CC = false
-EXEEXT =
-
-## The "x" and "zardoz" strings and the use of '+=' are there to ensure
-## that these variables get rewritten by Automake.
-noinst_PROGRAMS = x @$v1@ @$v2@ @$v3@
-bin_PROGRAMS = @A@
-bin_PROGRAMS += @$v1@ @$v2@ @$v3@
-check_PROGRAMS = zardoz \$(noinst_PROGRAMS)
-
-## Required whenever there are @substituted@ values in the
-## PROGRAMS primary, otherwise automake will complain.
-EXTRA_PROGRAMS =
-
-print-programs:
-       @echo BEG1: \$(noinst_PROGRAMS) :END1
-       @echo BEG2: \$(bin_PROGRAMS) :END2
-       @echo BEG3: \$(check_PROGRAMS) :END3
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-# For debugging.
-$EGREP -n 'ABCD|am__empty' Makefile.in
-# Sanity check.
-test `$EGREP -c "^[ address@hidden@ @address@hidden $tab]*$bs?$" Makefile.in` 
-eq 3
-
-./configure
-{
-  sed -n '/^noinst_PROGRAMS *=/,/[^\\]$/p' Makefile
-  sed -n '/^bin_PROGRAMS *=/,/[^\\]$/p' Makefile
-  sed -n '/^check_PROGRAMS *=/,/[^\\]$/p' Makefile
-  sed -n '/^am__EXEEXT.*=/,/[^\\]$/p' Makefile
-} >t-programs
-cat t-programs
-grep '^ *$' t-programs && Exit 1
-
-$MAKE print-programs >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep '^BEG1: x :END1$' stdout
-grep '^BEG2: :END2$' stdout
-grep '^BEG3: zardoz x :END3$' stdout
-
-$MAKE am__empty=X print-programs >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep '^BEG1: x X :END1$' stdout
-grep '^BEG2: X :END2$' stdout
-grep '^BEG3: zardoz x X :END3$' stdout
-
-:
diff --git a/t/var-undef-append.sh b/t/var-undef-append.sh
new file mode 100755
index 0000000..f59bacc
--- /dev/null
+++ b/t/var-undef-append.sh
@@ -0,0 +1,100 @@
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program 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.
+#
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Automake should allow us top append to undefined variables, for
+# consistency with GNU make.  For the same reason, if we override
+# a variable definition from the command line, any '+=' appending
+# to it should get overridden as well.
+# See also "spy" test 'spy-var-append.sh'.
+
+. ./defs || Exit 1
+
+cat >> configure.ac << 'END'
+AM_CONDITIONAL([COND_NO], [false])
+AM_CONDITIONAL([COND_YES], [:])
+AM_CONDITIONAL([COND_YES2], [:])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+var0 += foo0
+
+if COND_NO
+var00 += foo00
+endif
+
+if COND_YES
+if COND_YES2
+var000 += foo000
+endif
+endif
+
+if COND_NO
+var1 = oops
+endif
+var1 += bar
+if COND_YES
+var1 += baz
+endif
+if COND_NO
+var1 += oops
+endif
+
+if COND_YES
+var2 = a
+endif
+var2 += b
+
+if COND_YES
+var3 := c
+endif
+var3 += d
+
+var4 = cuckoo
+var4 += nightingale
+
+.PHONY: test1 test2
+test1:
+       test x'$(var0)' = x'foo0'
+       test x'$(var00)' = x''
+       test x'$(var000)' = x'foo000'
+       test x'$(var1)' = x'bar baz'
+       test x'$(var2)' = x'a b'
+       test x'$(var3)' = x'c d'
+        test x'$(var4)' = x'cuckoo nightingale'
+test2:
+       test x'$(var0)' = x
+       test x'$(var1)' = x'one'
+       test x'$(var2)' = x'two'
+       test x'$(var3)' = x'three'
+       test x'$(var4)' = x''
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+checkit ()
+{
+  $MAKE "$@" 2>stderr && test ! -s stderr || { cat stderr >&2; Exit 1; }
+}
+
+checkit test1
+checkit test2 var0= var1=one var2=two var3=three var4=
+
+:


hooks/post-receive
-- 
GNU Automake



reply via email to

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