@cindex make distcheck
@cindex make distcleancheck
@vindex distcleancheck_listfiles
+@cindex make distuninstallcheck
+@vindex distuninstallcheck_listfiles
Automake also generates a @code{distcheck} target which can be of help
to ensure that a given distribution will actually work.
build the file; or if the required tool is built by your package,
consider the cross-compilation case where it can't be run.)
+@code{distcheck} also checks that the @code{uninstall} target works
+properly, both for ordinary and @samp{DESTDIR} builds. It does this
+by invoking @code{make uninstall}, and then it checks the install tree
+to see if any files are left over. This check will make sure that you
+correctly coded your @code{uninstall}-related targets.
+
+By default, the checking is done by the @code{distuninstallcheck} target,
+and the list of files in the install tree is generated by
+@code{$(distuninstallcheck_listfiles}) (this is a variable whose value is
+a shell command to run that prints the list of files to stdout).
+
+Either of these can be overridden to modify the behavior of
+@code{distcheck}. For instance, to disable this check completely, you
+would write:
+
+@example
+distuninstallcheck:
+ @@:
+@end example
+
@section The types of distributions
@trindex dist-gzip
## create this directory under $dc_install_base, because it would
## create very long directory names.
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+## Build the directory, so we can cd into it even if `make install'
+## didn't create it.
+ && $(mkinstalldirs) $$dc_destdir \
?DISTCHECK-HOOK? && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \
&& cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
-## We use -le 1 because the `dir' file might still exist after uninstall.
- && (test `find "$$dc_install_base" -type f -print | wc -l` -le 1 \
- || { echo "ERROR: files left after uninstall:" ; \
- find $$dc_install_base -type f -print ; \
- exit 1; } >&2 ) \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
## Make sure the package has proper DESTDIR support (we could not test this
## in the previous install/installcheck/uninstall test, because it's reasonable
-## for installcheck to fails in a DESTDIR install).
+## for installcheck to fail in a DESTDIR install).
## We make the `$dc_install_base' read-only because this is where files
## with missing DESTDIR support are likely to be installed.
&& chmod -R a-w "$$dc_install_base" \
-## The logic here is quire convoluted because we must clean $dc_destdir
+## The logic here is quite convoluted because we must clean $dc_destdir
## whatever happens (it won't be erased by the next run of distcheck like
-## $(dirstir) is).
+## $(distdir) is).
&& ({ $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
- && (test `find "$$dc_destdir" -type f -print | wc -l` -le 1 \
- || { echo "ERROR: files left after uninstall (check DESTDIR support):" ; \
- find "$$dc_destdir" -type f -print ; \
- exit 1; } >&2 ); \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
@echo "$(distdir).tar.gz is ready for distribution" | \
sed 'h;s/./=/g;p;x;p;x'
+## Define distuninstallcheck_listfiles and distuninstallcheck separately
+## from distcheck, so that they can be overridden by the user.
+.PHONY: distuninstallcheck
+distuninstallcheck_listfiles = find . -type f -print
+distuninstallcheck:
+## We use -le 1 because the `dir' file might still exist after
+## uninstall.
+ cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+
## Define distcleancheck_listfiles and distcleancheck separately
-## from distcheck, so that they can be overriden by the user.
+## from distcheck, so that they can be overridden by the user.
.PHONY: distcleancheck
distcleancheck_listfiles = find . -type f -print
distcleancheck: distclean