* distdir.am (distdir): New file, extracted from...
authorAkim Demaille <akim@epita.fr>
Sun, 4 Feb 2001 15:10:23 +0000 (15:10 +0000)
committerAkim Demaille <akim@epita.fr>
Sun, 4 Feb 2001 15:10:23 +0000 (15:10 +0000)
* automake.in (handle_dist_worker): here.
Adjust.

ChangeLog
Makefile.am
Makefile.in
automake.in
lib/am/Makefile.am
m4/Makefile.in
tests/Makefile.in

index a218626..51eb608 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2001-02-04  Akim Demaille  <akim@epita.fr>
 
+       * distdir.am (distdir): New file, extracted from...
+       * automake.in (handle_dist_worker): here.
+       Adjust.
+
+2001-02-04  Akim Demaille  <akim@epita.fr>
+
        * automake.in (@clean): Remove, replaced by...
        ($dependencies{'clean'}): this.
        Use `&depend' instead of push'ing into @clean.
index d577485..d417b31 100644 (file)
@@ -12,9 +12,9 @@ info_TEXINFOS = automake.texi
 
 amfiles = check.am clean-hdr.am clean-kr.am clean.am comp-vars.am \
 compile.am data-clean.am data.am dejagnu.am depend.am depend2.am \
-dist.am dist-vars.am footer.am header-vars.am header.am java-clean.am \
-java.am kr-extra.am library.am libs-clean.am libs.am libtool.am \
-lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \
+dist.am distdir.am dist-vars.am footer.am header-vars.am header.am \
+java-clean.am java.am kr-extra.am library.am libs-clean.am libs.am \
+libtool.am lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \
 mans-vars.am mans.am multilib.am program.am progs-clean.am progs.am \
 python.am python-clean.am remake-hdr.am remake.am scripts.am \
 subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am
index f14e504..9863740 100644 (file)
@@ -79,9 +79,9 @@ info_TEXINFOS = automake.texi
 
 amfiles = check.am clean-hdr.am clean-kr.am clean.am comp-vars.am \
 compile.am data-clean.am data.am dejagnu.am depend.am depend2.am \
-dist.am dist-vars.am footer.am header-vars.am header.am java-clean.am \
-java.am kr-extra.am library.am libs-clean.am libs.am libtool.am \
-lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \
+dist.am distdir.am dist-vars.am footer.am header-vars.am header.am \
+java-clean.am java.am kr-extra.am library.am libs-clean.am libs.am \
+libtool.am lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \
 mans-vars.am mans.am multilib.am program.am progs-clean.am progs.am \
 python.am python-clean.am remake-hdr.am remake.am scripts.am \
 subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am
@@ -504,6 +504,7 @@ dist-all: distdir
        || chmod -R a+r $(distdir)
        $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz
        -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+
 distdir: $(DISTFILES)
        @if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" > /dev/null; then :; else \
          echo "NEWS not updated; not releasing" 1>&2; \
@@ -527,7 +528,8 @@ distdir: $(DISTFILES)
            test -d $(distdir)/$$subdir \
            || mkdir $(distdir)/$$subdir \
            || exit 1; \
-           (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+           (cd $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
              || exit 1; \
          fi; \
        done
index d95df1c..f2ad07a 100755 (executable)
@@ -2613,28 +2613,26 @@ sub handle_multilib
 # Worker for handle_dist.
 sub handle_dist_worker
 {
-    local ($makefile) = @_;
-
-    $output_rules .= 'distdir: $(DISTFILES)' . "\n";
+    my ($makefile) = @_;
+    my $xform = '';
 
     # Initialization; only at top level.
     if ($relative_dir eq '.')
     {
-       if (defined $options{'check-news'})
-       {
-           # For Gnits users, this is pretty handy.  Look at 15 lines
-           # in case some explanatory text is desirable.
-           $output_rules .= '  @if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" > /dev/null; then :; else \\
-         echo "NEWS not updated; not releasing" 1>&2; \\
-         exit 1; \\
-       fi
-';
-       }
-
+        $xform .= 's/\@TOPDIR\@//g;';
+    }
+    else
+    {
+        $xform .= 's/\@TOPDIR\@.*//g;';
+    }
 
-       # Create dist directory.
-       $output_rules .= ("\t-chmod -R a+w \$(distdir) > /dev/null 2>&1; rm -rf \$(distdir)\n"
-                         . "\tmkdir \$(distdir)\n");
+    if (defined $options{'check-news'})
+    {
+        $xform .= 's/\@CK-NEWS\@//g;';
+    }
+    else
+    {
+        $xform .= 's/\@CK-NEWS\@.*//g;';
     }
 
     # Scan EXTRA_DIST to see if we need to distribute anything from a
@@ -2672,8 +2670,11 @@ sub handle_dist_worker
        # Prepend $(distdir) to each directory given.  Doing it via a
        # hash lets us ensure that each directory is used only once.
        grep ($dist_dirs{'$(distdir)/' . $_} = 1, keys %dist_dirs);
-       $output_rules .= "\t";
-       &pretty_print_rule ('$(mkinstalldirs)', "\t   ", sort keys %dist_dirs);
+       $xform .= &transform ('DISTDIRS', join (' ', sort keys %dist_dirs));
+    }
+    else
+    {
+        $xform .= 's/.*\@DISTDIRS\@.*//g;';
     }
 
     # In loop, test for file existence because sometimes a file gets
@@ -2686,25 +2687,14 @@ sub handle_dist_worker
     $output_rules .= "\t\@for file in \$(DISTFILES); do \\\n";
     if ($cygnus_mode)
     {
-       $output_rules .= "\t  if test -f \$\$file; then d=.; else d=\$(srcdir); fi; \\\n";
+       $xform .= 's/\@CYGNUS\@\t*/\t/g;';
+        $xform .= 's/.*\@NCYGNUS\@.*//g;';
     }
     else
     {
-       $output_rules .= "\t  d=\$(srcdir); \\\n";
-    }
-    $output_rules .= ("\t  if test -d \$\$d/\$\$file; then \\\n"
-                     # Don't mention $$file in destination argument,
-                     # since this fails if destination directory
-                     # already exists.  Also, use `-R' and not `-r'.
-                     # `-r' is almost always incorrect.
-                     . "\t    cp -pR \$\$d/\$\$file \$(distdir) \\\n"
-                     . "\t    || exit 1; \\\n"
-                     . "\t  else \\\n"
-                     . "\t    test -f \$(distdir)/\$\$file \\\n"
-                     . "\t    || cp -p \$\$d/\$\$file \$(distdir)/\$\$file \\\n"
-                     . "\t    || exit 1; \\\n"
-                     . "\t  fi; \\\n"
-                     . "\tdone\n");
+       $xform .= 's/\@NCYGNUS\@\t*/\t/g;';
+        $xform .= 's/.*\@CYGNUS\@.*//g;';
+    }
 
     # If we have SUBDIRS, create all dist subdirectories and do
     # recursive build.
@@ -2742,29 +2732,20 @@ sub handle_dist_worker
            &define_pretty_variable ('DIST_SUBDIRS', '', '$(SUBDIRS)');
        }
 
-       # Test for directory existence here because previous automake
-       # invocation might have created some directories.  Note that
-       # we explicitly set distdir for the subdir make; that lets us
-       # mix-n-match many automake-using packages into one large
-       # package, and have "dist" at the top level do the right
-       # thing.  If we're in the topmost directory, then we use
-       # `distdir' instead of `top_distdir'; this lets us work
-       # correctly with an enclosing package.
-       $output_rules .=
-           ("\t" . 'for subdir in $(' . $dist_subdir_name . '); do ' . "\\\n"
-            . "\t" . '  if test "$$subdir" = .; then :; else ' . "\\\n"
-            . "\t" . '    test -d $(distdir)/$$subdir ' . "\\\n"
-            . "\t" . '    || mkdir $(distdir)/$$subdir ' . "\\\n"
-            . "\t" . '    || exit 1; ' . "\\\n"
-            . "\t" . '    (cd $$subdir'
-            . ' && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$('
-            . (($relative_dir eq '.') ? 'distdir' : 'top_distdir')
-            . ') distdir=../$(distdir)/$$subdir distdir) ' . "\\\n"
-            . "\t" . '      || exit 1; ' . "\\\n"
-            . "\t" . '  fi; ' . "\\\n"
-            . "\tdone\n");
+       $xform .= ('s/\@SUBDIRS\@//g;'
+                  . &transform ('DIST_SUBDIR_NAME'
+                                => $dist_subdir_name,
+                                'TOP_DISTDIR'
+                                => (($relative_dir eq '.')
+                                    ? 'distdir' : 'top_distdir')));
+    }
+    else
+    {
+       $xform .= 's/\@SUBDIRS\@.*//g;';
     }
 
+    $output_rules .= &file_contents ('distdir', $xform);
+
     # If the target `dist-hook' exists, make sure it is run.  This
     # allows users to do random weird things to the distribution
     # before it is packaged up.
@@ -2779,8 +2760,6 @@ sub handle_dist_worker
                          . " top_distdir=\"\$(top_distdir)\""
                          . " distdir=\"\$(distdir)\" $targ\n");
     }
-
-    &depend ('.PHONY', 'distdir');
 }
 
 # Handle 'dist' target.
@@ -2911,6 +2890,7 @@ sub handle_dist
            $xform .= 's/^GETTEXT.*$//;';
        }
 
+       # Arg, this file should have been named `distcheck'.
        $output_rules .= &file_contents ('dist', $xform);
 
        local ($dist_all) = ('dist-all: distdir' . "\n"
index d577485..d417b31 100644 (file)
@@ -12,9 +12,9 @@ info_TEXINFOS = automake.texi
 
 amfiles = check.am clean-hdr.am clean-kr.am clean.am comp-vars.am \
 compile.am data-clean.am data.am dejagnu.am depend.am depend2.am \
-dist.am dist-vars.am footer.am header-vars.am header.am java-clean.am \
-java.am kr-extra.am library.am libs-clean.am libs.am libtool.am \
-lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \
+dist.am distdir.am dist-vars.am footer.am header-vars.am header.am \
+java-clean.am java.am kr-extra.am library.am libs-clean.am libs.am \
+libtool.am lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \
 mans-vars.am mans.am multilib.am program.am progs-clean.am progs.am \
 python.am python-clean.am remake-hdr.am remake.am scripts.am \
 subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am
index 51acd9b..6e6c8b4 100644 (file)
@@ -125,6 +125,7 @@ TAGS:
 
 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
 
+
 distdir: $(DISTFILES)
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
index 862e691..e847f64 100644 (file)
@@ -420,6 +420,7 @@ check-TESTS: $(TESTS)
 
 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
 
+
 distdir: $(DISTFILES)
        @for file in $(DISTFILES); do \
          d=$(srcdir); \