automake-patches
[Top][All Lists]
Advanced

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

VAR_SORTED


From: Akim Demaille
Subject: VAR_SORTED
Date: Sun, 6 Jul 2003 11:40:13 +0200 (CEST)

I like "more deterministic" outputs, as they make it even easier to
compare the result of patches.  So I'd like to suggest the appending
patch.  I thought that sorting them all would suffice, but actually
it ends with:

am/tests/testSubDir % diff Makefile.in ~/src/am/tests/testSubDir     10:22
remo
60,61c60,61
< COMPILE = $(AM_CFLAGS) $(AM_CPPFLAGS) $(CC) $(CFLAGS) $(CPPFLAGS) \
<       $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES)
---
> COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
>       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
63c63
< LINK = $(AM_CFLAGS) $(AM_LDFLAGS) $(CCLD) $(CFLAGS) $(LDFLAGS) $@ -o
---
> LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@

:) :) :)

We should probably "type" the variables: list of files etc.  This would
help for the implementation of the "file includes files" feature I
suggested.  Maybe we should use the fact that the content of a variable
appears within a dependency relation to mean "this is a list of targets"
(which is more what we need than simply "list of files" anyway).

So, OK to install?

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * lib/Automake/Variable.pm, lib/Automake/VarDef.pm (VAR_SORTED):
        New variable type.
        Handle it.
        * automake.in (&handle_subdirs): Prototype.
        Adjust callers.
        Make RECURSIVE_TARGETS a VAR_SORTED.

Index: Makefile.in
===================================================================
RCS file: /cvs/automake/automake/Makefile.in,v
retrieving revision 1.440
diff -u -u -r1.440 Makefile.in
--- Makefile.in 6 Jul 2003 07:42:35 -0000       1.440
+++ Makefile.in 6 Jul 2003 09:32:37 -0000
@@ -67,11 +67,12 @@
 TEXI2DVI = texi2dvi
 TEXI2PDF = $(TEXI2DVI) --pdf --batch
 DVIPS = dvips
-RECURSIVE_TARGETS = dvi-recursive html-recursive info-recursive \
-       pdf-recursive ps-recursive install-info-recursive \
-       uninstall-info-recursive all-recursive install-data-recursive \
-       install-exec-recursive installdirs-recursive install-recursive \
-       uninstall-recursive check-recursive installcheck-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-exec-recursive install-info-recursive \
+       install-recursive installcheck-recursive installdirs-recursive \
+       pdf-recursive ps-recursive uninstall-info-recursive \
+       uninstall-recursive
 ETAGS = etags
 ETAGSFLAGS =
 CTAGS = ctags
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1477
diff -u -u -r1.1477 automake.in
--- automake.in 6 Jul 2003 07:42:35 -0000       1.1477
+++ automake.in 6 Jul 2003 09:32:39 -0000
@@ -1278,7 +1278,7 @@
     &handle_man_pages;
     &handle_data;
     &handle_headers;
-    &handle_subdirs;
+    handle_subdirs ();
     &handle_tags;
     &handle_minor_options;
     &handle_tests;
@@ -3714,8 +3714,10 @@
 }


+# &handle_subdirs ()
+# ------------------
 # Handle subdirectories.
-sub handle_subdirs
+sub handle_subdirs ()
 {
   my $subdirs = var ('SUBDIRS');
   return
@@ -3768,7 +3770,7 @@
     }

   $output_rules .= &file_contents ('subdirs', new Automake::Location);
-  rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_PRETTY; # Gross!
+  rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross!
 }


Index: lib/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/lib/Makefile.in,v
retrieving revision 1.68
diff -u -u -r1.68 Makefile.in
--- lib/Makefile.in     6 Jul 2003 07:42:35 -0000       1.68
+++ lib/Makefile.in     6 Jul 2003 09:32:40 -0000
@@ -52,11 +52,12 @@
 CONFIG_CLEAN_FILES =
 SOURCES =
 DIST_SOURCES =
-RECURSIVE_TARGETS = dvi-recursive html-recursive info-recursive \
-       pdf-recursive ps-recursive install-info-recursive \
-       uninstall-info-recursive all-recursive install-data-recursive \
-       install-exec-recursive installdirs-recursive install-recursive \
-       uninstall-recursive check-recursive installcheck-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-exec-recursive install-info-recursive \
+       install-recursive installcheck-recursive installdirs-recursive \
+       pdf-recursive ps-recursive uninstall-info-recursive \
+       uninstall-recursive
 am__installdirs = $(DESTDIR)$(pkgvdatadir) $(DESTDIR)$(scriptdir)
 dist_pkgvdataDATA_INSTALL = $(INSTALL_DATA)
 dist_scriptDATA_INSTALL = $(INSTALL_DATA)
Index: lib/Automake/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/Makefile.in,v
retrieving revision 1.75
diff -u -u -r1.75 Makefile.in
--- lib/Automake/Makefile.in    6 Jul 2003 07:42:36 -0000       1.75
+++ lib/Automake/Makefile.in    6 Jul 2003 09:32:42 -0000
@@ -49,11 +49,12 @@
 CONFIG_CLEAN_FILES =
 SOURCES =
 DIST_SOURCES =
-RECURSIVE_TARGETS = dvi-recursive html-recursive info-recursive \
-       pdf-recursive ps-recursive install-info-recursive \
-       uninstall-info-recursive all-recursive install-data-recursive \
-       install-exec-recursive installdirs-recursive install-recursive \
-       uninstall-recursive check-recursive installcheck-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-exec-recursive install-info-recursive \
+       install-recursive installcheck-recursive installdirs-recursive \
+       pdf-recursive ps-recursive uninstall-info-recursive \
+       uninstall-recursive
 am__installdirs = $(DESTDIR)$(perllibdir)
 dist_perllibDATA_INSTALL = $(INSTALL_DATA)
 DATA = $(dist_perllib_DATA)
Index: lib/Automake/VarDef.pm
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/VarDef.pm,v
retrieving revision 1.1
diff -u -u -r1.1 VarDef.pm
--- lib/Automake/VarDef.pm      25 May 2003 20:05:50 -0000      1.1
+++ lib/Automake/VarDef.pm      6 Jul 2003 09:32:42 -0000
@@ -24,7 +24,7 @@
 use vars '@ISA', '@EXPORT';
 @ISA = qw/Exporter/;
 @EXPORT = qw (&VAR_AUTOMAKE &VAR_CONFIGURE &VAR_MAKEFILE
-             &VAR_ASIS &VAR_PRETTY &VAR_SILENT);
+             &VAR_ASIS &VAR_PRETTY &VAR_SILENT &VAR_SORTED);

 =head1 NAME

@@ -87,11 +87,13 @@
 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>
+=item C<VAR_ASIS>, C<VAR_PRETTY>, C<VAR_SILENT>, C<VAR_SORTED>

 Possible print styles.  C<VAR_ASIS> variable should be output as-is.
 C<VAR_PRETTY> variable are wrapped on multiple lines if they cannot
-fit on one.  Finally, C<VAR_SILENT> variable are not output at all.
+fit on one.  C<VAR_SORTED> variable should be sorted and then handled
+as C<VAR_PRETTY> variables. Finally, C<VAR_SILENT> variable are not
+output at all.

 C<VAR_SILENT> variables can also be overridden silently (unlike the
 other kinds of variables whose overridding may sometimes produce
@@ -104,6 +106,7 @@
 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

@@ -131,8 +134,8 @@
 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> (see these
-definitions).
+be one of C<VAR_ASIS>, C<VAR_PRETTY>, or C<VAR_SILENT>, or
+C<VAR_SORTED> (see these definitions).

 =cut

Index: lib/Automake/Variable.pm
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/Variable.pm,v
retrieving revision 1.7
diff -u -u -r1.7 Variable.pm
--- lib/Automake/Variable.pm    2 Jul 2003 21:57:51 -0000       1.7
+++ lib/Automake/Variable.pm    6 Jul 2003 09:32:43 -0000
@@ -630,7 +630,14 @@
       my $equals = $def->type eq ':' ? ':=' : '=';
       my $str = $cond->subst_string;

-      if ($def->pretty == VAR_PRETTY)
+
+      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.
@@ -638,11 +645,13 @@
          $res .= makefile_wrap ("$str$name $equals", "$str\t",
                                 split (' ' , $val));
        }
-      else                     # VAR_ASIS
+      else # ($def->pretty == VAR_SORTED)
        {
-         my $output_var = "$name $equals $val";
-         $output_var =~ s/^/$str/meg;
-         $res .= "$output_var\n";
+         # 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)));
        }
     }
   return $res;
@@ -934,10 +943,10 @@
 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>, or C<VAR_SILENT>, defined by by
-L<Automake::VarDef>).  C<$pretty> applies only to real assignments.
-I.e., it doesn't apply to a C<+=> assignment (except when part of it
-is being done as a conditional C<=> assignment).
+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).

 This function will all run any hook registered with the C<hook>
 function.
@@ -955,9 +964,10 @@
     unless ref $where;

   prog_error "pretty argument missing"
-    unless defined $pretty && ($pretty == VAR_PRETTY
-                              || $pretty == VAR_ASIS
-                              || $pretty == VAR_SILENT);
+    unless defined $pretty && ($pretty == VAR_ASIS
+                              || $pretty == VAR_PRETTY
+                              || $pretty == VAR_SILENT
+                              || $pretty == VAR_SORTED);

   # We will adjust the owner of this variable unless told otherwise.
   my $adjust_owner = 1;







reply via email to

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