* lib/am/distdir.am (distcheck): Call distcleancheck.
authorAlexandre Duret-Lutz <adl@gnu.org>
Mon, 26 Nov 2001 09:02:58 +0000 (09:02 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Mon, 26 Nov 2001 09:02:58 +0000 (09:02 +0000)
(distcleancheck_listfiles, distcleancheck): New, extracted from
distcheck.
* automake.texi (Checking the distribution): Document
distcleancheck_listfiles and distcleancheck.

ChangeLog
NEWS
automake.texi
lib/am/distdir.am
stamp-vti
version.texi

index 0941aa9..5a7aa3b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-11-26  Alexandre Duret-Lutz  <duret_g@epita.fr>
+
+       * lib/am/distdir.am (distcheck): Call distcleancheck.
+       (distcleancheck_listfiles, distcleancheck): New, extracted from
+       distcheck.
+       * automake.texi (Checking the distribution): Document
+       distcleancheck_listfiles and distcleancheck.
+
 2001-11-25  Alexandre Duret-Lutz  <duret_g@epita.fr>
 
        * automake.in (scan_one_autoconf_file): Parenthesize qw// in
diff --git a/NEWS b/NEWS
index 455c3ce..9bf3952 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,9 @@ New in 1.5a:
 * `#line' of Lex and Yacc files are properly set.
 * EXTRA_DIST can contain generated directories.
 * Support for dot-less extensions in suffix rules.
+* The part of the distcheck target that checks whether distclean actually
+  cleans all built files has been moved in a separate target, distcleancheck,
+  so it can be overridden easily.
 * Fixed CDPATH portability problems, in particular for MacOS X.
 * Fixed handling of nobase_ targets.
 * Fixed support of implicit rules leading to .lo objects.
index 5924169..99cf830 100644 (file)
@@ -3582,7 +3582,6 @@ We recommend that you follow this same set of heuristics in your
 @section Basics of distribution
 
 @cindex make dist
-@cindex make distcheck
 
 The @code{dist} target in the generated @file{Makefile.in} can be used
 to generate a gzip'd @code{tar} file and other flavors of archive for
@@ -3676,6 +3675,10 @@ dist-hook:
 
 @section Checking the distribution
 
+@cindex make distcheck
+@cindex make distcleancheck
+@vindex distcleancheck_listfiles
+
 Automake also generates a @code{distcheck} target which can be of help
 to ensure that a given distribution will actually work.
 @code{distcheck} makes a distribution, and then tries to do a
@@ -3690,6 +3693,42 @@ anything, though as always caution is advised.  Generally this hook is
 used to check for potential distribution errors not caught by the
 standard mechanism.
 
+Speaking about potential distribution errors, @code{distcheck} will also
+ensure that the @code{distclean} target actually removes all built
+files.  This is done by running @code{make distcleancheck} at the end of
+the @code{VPATH} build.  By default, @code{distcleancheck} will run
+@code{distclean} and then make sure the build tree has been emptied by
+running @code{$(distcleancheck_listfiles)}.  Usually this check will
+find generated files that you forgot to add to the @code{DISTCLEANFILES}
+variable (@pxref{Clean}).
+
+The @code{distcleancheck} behaviour should be ok for most packages,
+otherwise you have the possibility to override the definitition of
+either the @code{distcleancheck} target, or the
+@code{$(distcleancheck_listfiles)} variable.  For instance to disable
+@code{distcleancheck} completely, add the following rule to your
+top-level @file{Makefile.am}:
+
+@example
+distcleancheck:
+        @@:
+@end example
+
+If you want @code{distcleancheck} to ignore built files which have not
+been cleaned because they are also part of the distribution, add the
+following definition instead:
+
+@example
+distcleancheck_listfiles = \
+  find -type f -exec sh -c 'test -f $(scrdir)/@{@} || echo @{@}'
+@end example
+
+The above definition is not the default because it's usually an error if
+your Makefiles cause some distributed files to be rebuilt when the user
+build the package.  (Think about the user missing the tool required to
+build the file; or if the required tool is built by your package,
+consider the cross-compilation case where it can't be run.)
+
 @section The types of distributions
 
 @trindex dist-gzip
index 24183b6..f578f49 100644 (file)
@@ -273,15 +273,25 @@ distcheck: dist
                   find $$dc_install_base -type f -print ; \
                   exit 1; } >&2 ) \
          && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
-         && $(MAKE) $(AM_MAKEFLAGS) distclean \
 ## Make sure to remove the dist file we created in the test build
 ## directory.
          && rm -f $(distdir).tar.gz \
-         && (test `find . -type f -print | wc -l` -eq 0 \
-             || { echo "ERROR: files left after distclean:" ; \
-                  find . -type f -print ; \
-                  exit 1; } >&2 )
+         && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
        $(am__remove_distdir)
        @echo "$(distdir).tar.gz is ready for distribution" | \
          sed 'h;s/./=/g;p;x;p;x'
+
+## Define distcleancheck_listfiles and distcleancheck separately
+## from distcheck, so that they can be overriden by the user.
+.PHONY: distcleancheck
+distcleancheck_listfiles = "find . -type f -print"
+distcleancheck: distclean
+       if test '$(srcdir)' = . ; then \
+         echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+         exit 1 ; \
+       fi
+       test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+         || { echo "ERROR: files left after distclean:" ; \
+              $(distcleancheck_listfiles) ; \
+              exit 1; } >&2
 endif %?TOPDIR_P%
index 5e4318c..fff80e8 100644 (file)
--- a/stamp-vti
+++ b/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 16 November 2001
+@set UPDATED 26 November 2001
 @set UPDATED-MONTH November 2001
 @set EDITION 1.5a
 @set VERSION 1.5a
index 5e4318c..fff80e8 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 16 November 2001
+@set UPDATED 26 November 2001
 @set UPDATED-MONTH November 2001
 @set EDITION 1.5a
 @set VERSION 1.5a