]> sourceware.org Git - automake.git/commitdiff
Pretty-print variable definitions.
authorTom Tromey <tromey@redhat.com>
Tue, 12 Dec 1995 18:15:39 +0000 (18:15 +0000)
committerTom Tromey <tromey@redhat.com>
Tue, 12 Dec 1995 18:15:39 +0000 (18:15 +0000)
Deal with comments more sensibly.
Other minor cleanups

ChangeLog
Makefile.am
Makefile.in
NEWS
TODO
automake.in
automake.texi
lib/am/Makefile.am
libprograms.am [deleted file]
texi-clean.am
version.texi

index 7ccd877a605ee2977ec84585ae718cdf70d2cba5..86f65ac67f7c38d17c427708112a1edc53a6bf3d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+Tue Dec 12 10:06:28 1995  Tom Tromey  <tromey@cambric.colorado.edu>
+
+       * Makefile.am (pkgdata_DATA): Removed libprograms.am.
+
+       * automake.in (do_one_merge_target): Never generate trailing
+       whitespace.
+       (pretty_print): New function.
+       (handle_footer): Prettyprint definitions.
+       (am_install_var): Ditto.
+       (handle_source_transform): Ditto.
+       (handle_dist): Ditto.
+       (handle_libraries): Ditto.
+       (read_am_file): Put comments nearer appropriate code.
+
+       * texi-clean.am (mostlyclean-info): Use continued lines, not
+       multiple rm's.  From Jim Meyering.
+
 Sun Dec 10 11:59:33 1995  Tom Tromey  <tromey@cambric.colorado.edu>
 
        * Makefile.am (pkgdata_DATA): Cause INSTALL, install-sh, mdate-sh,
@@ -228,7 +245,7 @@ Sat Dec  2 21:39:56 1995  Tom Tromey  <tromey@cambric.colorado.edu>
 
        * automake.in (handle_tags): Generate TAGS rule for every
        directory.
-       
+
        * subdirs.am (RECURSIVE): Include installcheck-recursive.
        * automake.in (installcheck): New variable.
        (generate_makefile): Initialize it.
@@ -842,7 +859,7 @@ Sun Nov 12 23:59:08 1995  Tom Tromey  <tromey@cambric>
        * automake.in: Special-case when amdir=.
 
        * Makefile.am (DIST_OTHER): Removed auto-detected files.
-       
+
        * automake.in:
        Search for commonly-used files and auto-include them in distribution
 
index eccfe0b4f25716ca8a868702cd5dcdb0ec4d1594..8b7fc14f3956649d387fda571bae0f94c66ee2cd 100644 (file)
@@ -6,7 +6,7 @@ TEXINFOS = automake.texi
 pkgdata_DATA = clean-kr.am clean.am compile-kr.am compile-vars.am \
 compile.am data.am depend.am dist-subd-top.am \
 dist-subd.am dist-vars.am dist.am footer.am header-vars.am \
-kr-vars.am libprograms.am libraries-vars.am \
+kr-vars.am libraries-vars.am \
 libraries.am library.am mans-vars.am \
 program.am programs.am remake-hdr.am \
 remake-subd.am remake.am scripts.am subdirs.am tags.am tags-subd.am \
index edb4291c19ccf689013729c3c71bf99dfbc2e598..4fbfa01a1708ae8f007e56ef06d9983fa0941be9 100644 (file)
@@ -49,11 +49,13 @@ transform = @program_transform_name@
 
 bin_SCRIPTS = automake
 TEXINFOS = automake.texi
+# SUBDIRS = intl po
+# CONFIG_HEADER = config.h
 
 pkgdata_DATA = clean-kr.am clean.am compile-kr.am compile-vars.am \
 compile.am data.am depend.am dist-subd-top.am \
 dist-subd.am dist-vars.am dist.am footer.am header-vars.am \
-kr-vars.am libprograms.am libraries-vars.am \
+kr-vars.am libraries-vars.am \
 libraries.am library.am mans-vars.am \
 program.am programs.am remake-hdr.am \
 remake-subd.am remake.am scripts.am subdirs.am tags.am tags-subd.am \
@@ -64,13 +66,15 @@ INSTALL install-sh mdate-sh mkinstalldirs texinfo.tex
 
 DIST_OTHER = automake.in
 
+# Gross.
 DIST_SUBDIRS = samples/cpio/*Makefile.am
 
+# The following requires a fixed version of the Emacs 19.30 etags.
 ETAGS_ARGS = automake.in --lang=none \
  --regex='/^@node[ \t]+\([^,]+\)/\1/' automake.texi
 
 
-SCRIPTS = $(bin_SCRIPTS)
+SCRIPTS= $(bin_SCRIPTS)
 
 MAKEINFO = makeinfo
 TEXI2DVI = texi2dvi
@@ -82,10 +86,12 @@ INFOS = automake.info*
 INFO_DEPS = automake.info
 DVIS = automake.dvi
 
-DATA = $(pkgdata_DATA)
+DATA= $(pkgdata_DATA)
 
 ACLOCAL = aclocal.m4
-DIST_COMMON = mkinstalldirs configure Makefile.in stamp-vti configure.in ChangeLog THANKS README version.texi mdate-sh TODO INSTALL Makefile.am NEWS aclocal.m4 install-sh
+DIST_COMMON = mkinstalldirs configure Makefile.in stamp-vti configure.in \
+ChangeLog THANKS README version.texi mdate-sh TODO INSTALL Makefile.am \
+texinfo.tex NEWS aclocal.m4 install-sh
 
 PACKAGE = @PACKAGE@
 VERSION = @VERSION@
@@ -166,9 +172,9 @@ uninstall-info:
        done
 
 mostlyclean-info:
-       rm -f automake.aux automake.cp automake.cps automake.dvi
-       rm -f automake.fn automake.fns automake.ky automake.log
-       rm -f automake.pg automake.toc automake.tp automake.vr automake.op
+       rm -f automake.aux automake.cp automake.cps automake.dvi \
+         automake.fn automake.fns automake.ky automake.log \
+         automake.pg automake.toc automake.tp automake.vr automake.op
 
 clean-info:
 
@@ -248,9 +254,9 @@ info: $(INFO_DEPS)
 
 dvi: $(DVIS)
 
-check: 
+check:
 
-installcheck: 
+installcheck:
 
 install-exec: install-binSCRIPTS
 
@@ -287,10 +293,6 @@ maintainer-clean: distclean maintainer-clean-binSCRIPTS maintainer-clean-vti mai
        @echo "This command is intended for maintainers to use;"
        @echo "it deletes files that may require special tools to rebuild."
 
-# SUBDIRS = intl po
-# CONFIG_HEADER = config.h
-# Gross.
-# The following requires a fixed version of the Emacs 19.30 etags.
 # Some simple checks:
 # * syntax check with perl4 and perl5.
 # * make sure the scripts don't use 'true'
diff --git a/NEWS b/NEWS
index 60acb217576cbe000993dfb3e0ba96cdcd543bbf..ac96f4782d89278bb8ffcb1769ea8f631aa297ff 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
 New in 0.26:
 * Added --install-missing option.
+* Pretty-prints generated macros
 \f
 New in 0.25:
 * Bug fixes.
diff --git a/TODO b/TODO
index a47c48551265e1796c1026f1af264eaa2442f32d..72eee6b18000c03a84071903dea25156cfb0816b 100644 (file)
--- a/TODO
+++ b/TODO
@@ -10,7 +10,7 @@ Clean up the output:
 * Ensure every line has a purpose.  Omit unused stuff
 * Eliminate extraneous rules when possible (eg 'install-am' stuff)
 * Make sure vertical spacing is correct
-* pretty-print targets, rules, etc.
+* pretty-print targets
 
 Need OTHER_SOURCES to hold sources whose objects end up in eg LIBOBJS.
 Dependency tracking should work here.  Maybe if it doesn't exist it
@@ -24,10 +24,6 @@ feel about this.
 Consider automatic support for ".y" files.  At the very least arrange
 to have the corresponding ".c" file be distributed. [last half is done]
 
-Implement better rule for copying through comments.  Rule should be
-that if comment immediately precedes rule or variable definition, then
-comment should be put there.  Else what happens now is ok.
-
 install-info doesn't have to look in build directory for info files;
 just don't support this mode.
 
@@ -94,7 +90,7 @@ For CONFIG_HEADER,
   automatically add its input file to the distribution.
 
 Don't hardcode the name of the configuration header.  Get it from
-configure.in (AC_CONFIG_HEADER).  
+configure.in (AC_CONFIG_HEADER).
 
 Get the list of Makefiles to create from configure.in AC_OUTPUT
 if none are given.
index c4212e78eeb0783b74410372705696961cd032bb..8c43f072d115dbe755e78500f90bc6f44ff2d2b0 100755 (executable)
@@ -349,8 +349,7 @@ sub handle_source_transform
                push (@result, $_);
            }
 
-           $output_vars .= ($one_file . "_OBJECTS = " . join (' ', @result)
-                            . "\n");
+           &pretty_print ($one_file . "_OBJECTS =", '', @result);
        }
        else
        {
@@ -427,8 +426,7 @@ sub handle_libraries
            {
                push (@outlist, 'lib' . $onelib . '.a');
            }
-           $output_vars .= ($onedir . '_LIBFILES = '
-                            . join (' ', @outlist) . "\n");
+           &pretty_print ($onedir . '_LIBFILES =', '', @outlist);
        }
     }
     push (@all, '$(LIBFILES)');
@@ -456,7 +454,7 @@ sub handle_libraries
 
     if (! defined $contents{'LIBFILES'})
     {
-       $output_vars .= 'LIBFILES = ' . join (' ', @liblist) . "\n";
+       &pretty_print ('LIBFILES = ', '', @liblist);
     }
     $output_vars .= &file_contents ('libraries-vars');
 }
@@ -518,8 +516,8 @@ sub handle_texinfo
     }
 
     # Some boilerplate.
-    $output_vars = $output_vars . &file_contents ('texinfos-vars');
-    $output_rules = $output_rules . &file_contents ('texinfos');
+    $output_vars .= &file_contents ('texinfos-vars');
+    $output_rules .= &file_contents ('texinfos');
 
     # How to clean.
     local ($crules) = &file_contents ('texi-clean');
@@ -654,8 +652,8 @@ sub handle_dist
        }
     }
 
-    $output_vars .= ("DIST_COMMON = " . join (' ', keys (%dist_common))
-                    . "\n\n");
+    &pretty_print ("DIST_COMMON =", '', keys (%dist_common));
+    $output_vars .= "\n";
 
     # Some boilerplate.
     $output_vars .= &file_contents ('dist-vars');
@@ -803,11 +801,11 @@ sub handle_footer
 {
     if ($contents{'SOURCES'})
     {
-       $output_vars .= "SOURCES = " . $contents{'SOURCES'} . "\n";
+       &pretty_print ('SOURCES =', '', split (/\s+/, $contents{'SOURCES'}));
     }
     if ($contents{'OBJECTS'})
     {
-       $output_vars .= "OBJECTS = " . $contents{'OBJECTS'} . "\n";
+       &pretty_print ('OBJECTS =', '', split (/\s+/, $contents{'OBJECTS'}));
     }
     if ($contents{'SOURCES'} || $contents{'OBJECTS'})
     {
@@ -947,7 +945,12 @@ sub do_one_merge_target
        push (@values, $name . '-local');
     }
 
-    $output_rules .= $name . ": " . join (' ', @values) . "\n\n";
+    $output_rules .= $name . ":";
+    if ($#values >= 0)
+    {
+       $output_rules .= ' ' . join (' ', @values);
+       }
+    $output_rules .= "\n\n";
 }
 
 # Handle all 'clean' targets.
@@ -1037,6 +1040,39 @@ sub check_gnits_standards
 {
 }
 
+################################################################
+
+# Pretty-print something.  HEAD is what should be printed at the
+# beginning of the first line, FILL is what should be printed at the
+# beginning of every subsequent line.
+sub pretty_print
+{
+    local ($head, $fill, @values) = @_;
+
+    local ($column) = length ($head);
+    $output_vars .= $head;
+
+    local ($bol) = 0;
+    foreach (@values)
+    {
+       # "71" because we also print a space.
+       if ($column + length ($_) > 71)
+       {
+           $output_vars .= " \\\n" . $fill;
+           $column = length ($fill);
+           $bol = 1;
+       }
+
+       $output_vars .= ' ' unless ($bol);
+       $output_vars .= $_;
+       $column += length ($_) + 1;
+       $bol = 0;
+    }
+
+    $output_vars .= "\n";
+}
+
+
 ################################################################
 
 # Read Makefile.am and set up %contents.  Simultaneously copy lines
@@ -1056,6 +1092,7 @@ sub read_am_file
     local ($saw_bk) = 0;
     local ($was_rule) = 0;
     local ($last_var_name) = '';
+    local ($saved_comments) = '';
 
     while (<AMFILE>)
     {
@@ -1081,6 +1118,12 @@ sub read_am_file
                }
            }
        }
+       elsif (/^\#/)
+       {
+           # Got a comment.  We save comments until we get a
+           # non-comment, and then we add the last comments.
+           $saved_comments .= $_ . "\n";
+       }
        elsif ($_ eq '@kr@')
        {
            # Special case: this means we want automatic
@@ -1094,7 +1137,8 @@ sub read_am_file
            # Value here doesn't matter; for targets we only note
            # existence.
            $contents{$1} = 1;
-           $output_trailer .= $_ . "\n";
+           $output_trailer .= $saved_comments . $_ . "\n";
+           $saved_comments = '';
        }
        elsif (m/^ *([A-Za-z][A-Za-z0-9_]*)[ \t]*=[ \t]*(.*)$/)
        {
@@ -1109,7 +1153,8 @@ sub read_am_file
            {
                $contents{$1} = $2;
            }
-           $output_vars .= $_ . "\n";
+           $output_vars .= $saved_comments . $_ . "\n";
+           $saved_comments = '';
        }
        elsif (m/^$/)
        {
@@ -1117,12 +1162,13 @@ sub read_am_file
            # whatever we saw last.
            if ($was_rule)
            {
-               $output_trailer .= "\n";
+               $output_trailer .= $saved_comments . "\n";
            }
            else
            {
-               $output_vars .= "\n";
+               $output_vars .= $saved_comments . "\n";
            }
+           $saved_comments = '';
        }
        else
        {
@@ -1134,6 +1180,9 @@ sub read_am_file
        $saw_bk = (substr ($_, -1) eq "\\");
     }
 
+    # Include trailing comments with variables for now.
+    $output_vars .= $saved_comments;
+
     # Include some space after user code.
     $output_vars .= "\n";
     $output_trailer .= "\n";
@@ -1384,7 +1433,8 @@ sub am_install_var
     if (! defined $contents{$primary} && $#used >= 0)
     {
        # Define it.
-       $output_vars .= $primary . " = " . join (' ', @used) . "\n\n";
+       &pretty_print ($primary . '=', '', @used);
+       $output_vars .= "\n";
     }
 
     # Push here because PRIMARY might be configure time determined.
index 955b379c04ba9f7fa52f5099c9587860008cb980..56d10edff8d127e9351e284445563b7465a9be9c 100644 (file)
@@ -591,7 +591,7 @@ do
   AC_TRY_COMPILE(
 [#if !defined(__STDC__) || __STDC__ != 1
 choke me
-#endif 
+#endif
 ], [int test (int i, double x);
 struct s1 @{int (*f) (int a);@};
 struct s2 @{int (*f) (double a);@};],
@@ -659,7 +659,7 @@ Still, sometimes there are files which must be distributed, but which
 are not covered in the automatic rules.  These files should be listed in
 the @samp{DIST_OTHER} variable.
 
-For instance, in the @code{automake} distribution, 
+For instance, in the @code{automake} distribution,
 @file{automake.in} (the source to
 @code{automake}) is not found automatically.  So in the
 @file{Makefile.am}, we have:
index eccfe0b4f25716ca8a868702cd5dcdb0ec4d1594..8b7fc14f3956649d387fda571bae0f94c66ee2cd 100644 (file)
@@ -6,7 +6,7 @@ TEXINFOS = automake.texi
 pkgdata_DATA = clean-kr.am clean.am compile-kr.am compile-vars.am \
 compile.am data.am depend.am dist-subd-top.am \
 dist-subd.am dist-vars.am dist.am footer.am header-vars.am \
-kr-vars.am libprograms.am libraries-vars.am \
+kr-vars.am libraries-vars.am \
 libraries.am library.am mans-vars.am \
 program.am programs.am remake-hdr.am \
 remake-subd.am remake.am scripts.am subdirs.am tags.am tags-subd.am \
diff --git a/libprograms.am b/libprograms.am
deleted file mode 100644 (file)
index 460ba4b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-install-libprograms: $(LIBPROGRAMS)
-       $(top_srcdir)/mkinstalldirs $(libexecdir)
-       for p in $(LIBPROGRAMS); do \
-         $(INSTALL_PROGRAM) $$p $(libexecdir)/`echo $$p|sed '$(transform)'`; \
-       done
-
-uninstall-libprograms:
-       for p in $(LIBPROGRAMS); do \
-         rm -f $(libexecdir)/`echo $$p|sed '$(transform)'`; \
-       done
-
-mostlyclean-libprograms:
-
-clean-libprograms:
-       rm -f $(LIBPROGRAMS)
-
-distclean-libprograms:
-
-maintainer-clean-libprograms:
-
index 4c22d7a89cdb5d945b14e8a7c22b1052c382f85e..4da749411c1d357daea87342e6d34abd6eb523ba 100644 (file)
@@ -2,9 +2,9 @@
 ## too many things could be removed.  In particular the ".log"
 ## extension might be used in other contexts by the user
 mostlyclean-info:
-       rm -f @TEXI@.aux @TEXI@.cp @TEXI@.cps @TEXI@.dvi
-       rm -f @TEXI@.fn @TEXI@.fns @TEXI@.ky @TEXI@.log
-       rm -f @TEXI@.pg @TEXI@.toc @TEXI@.tp @TEXI@.vr @TEXI@.op
+       rm -f @TEXI@.aux @TEXI@.cp @TEXI@.cps @TEXI@.dvi \
+         @TEXI@.fn @TEXI@.fns @TEXI@.ky @TEXI@.log \
+         @TEXI@.pg @TEXI@.toc @TEXI@.tp @TEXI@.vr @TEXI@.op
 
 clean-info:
 
index 1335b0013b08083a81ba731cfdf54e8a23c10b98..8ed3371f2eceaca429775f0ab311c08e44feebd4 100644 (file)
@@ -1,3 +1,3 @@
-@set UPDATED 9 December
+@set UPDATED 12 December
 @set EDITION 0.26
 @set VERSION 0.26
This page took 0.05175 seconds and 5 git commands to generate.