+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
* `#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.
@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
@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
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
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%
-@set UPDATED 16 November 2001
+@set UPDATED 26 November 2001
@set UPDATED-MONTH November 2001
@set EDITION 1.5a
@set VERSION 1.5a
-@set UPDATED 16 November 2001
+@set UPDATED 26 November 2001
@set UPDATED-MONTH November 2001
@set EDITION 1.5a
@set VERSION 1.5a