From: Alexandre Duret-Lutz Date: Mon, 26 Nov 2001 09:02:54 +0000 (+0000) Subject: * lib/am/distdir.am (distcheck): Call distcleancheck. X-Git-Tag: Release-1-5b~16 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=c4dc93d3bd0cd2e391feddce388453e35bb5f795;p=automake.git * lib/am/distdir.am (distcheck): Call distcleancheck. (distcleancheck_listfiles, distcleancheck): New, extracted from distcheck. * automake.texi (Checking the distribution): Document distcleancheck_listfiles and distcleancheck. --- diff --git a/ChangeLog b/ChangeLog index 0941aa95..5a7aa3bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-11-26 Alexandre Duret-Lutz + + * 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 * automake.in (scan_one_autoconf_file): Parenthesize qw// in diff --git a/NEWS b/NEWS index 455c3ced..9bf39528 100644 --- 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. diff --git a/automake.texi b/automake.texi index 5924169f..99cf8309 100644 --- a/automake.texi +++ b/automake.texi @@ -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 diff --git a/lib/am/distdir.am b/lib/am/distdir.am index 24183b66..f578f491 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -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% diff --git a/stamp-vti b/stamp-vti index 5e4318c9..fff80e83 100644 --- 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 diff --git a/version.texi b/version.texi index 5e4318c9..fff80e83 100644 --- a/version.texi +++ b/version.texi @@ -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