automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

distcleancheck.patch


From: Alexandre Duret-Lutz
Subject: distcleancheck.patch
Date: 23 Nov 2001 13:59:48 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Bruce & Karl, would the following be enough for you?

Index: ChangeLog
--- ChangeLog
+++ ChangeLog
@@ -1,1 +1,9 @@
+2001-11-23  Alexandre Duret-Lutz  <address@hidden>
+
+       * lib/am/distdir.am (distcheck): Call distcleancheck.
+       (distcleancheck_listfiles, distcleancheck): New, extracted from
+       distcheck.
+       * automake.texi (Checking the distribution): Document
+       distcleancheck_listfiles and distcleancheck.
+

Index: automake.texi
===================================================================
RCS file: /home/adl/CVSROOT/automake-20011123-1047/automake.texi,v
retrieving revision 1.1
diff -u -r1.1 automake.texi
--- automake.texi 23 Nov 2001 09:47:58 -0000 1.1
+++ automake.texi 23 Nov 2001 12:53:01 -0000
@@ -3582,7 +3582,6 @@
 @section Basics of distribution
 
 @cindex make dist
address@hidden 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 @@
 
 @section Checking the distribution
 
address@hidden make distcheck
address@hidden make distcleancheck
address@hidden 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
@@ -3689,6 +3692,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
address@hidden 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
address@hidden(distcleancheck_listfiles)} variable.  For instance to disable
address@hidden completely, add the following rule to your
+top-level @file{Makefile.am}:
+
address@hidden
+distcleancheck:
+        @@:
address@hidden 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:
+
address@hidden
+distcleancheck_listfiles = \
+  find -type f -exec sh -c 'test -f $(scrdir)/@address@hidden || echo 
@address@hidden'
address@hidden 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
 
Index: lib/am/distdir.am
===================================================================
RCS file: /home/adl/CVSROOT/automake-20011123-1047/lib/am/distdir.am,v
retrieving revision 1.1
diff -u -r1.1 distdir.am
--- lib/am/distdir.am 23 Nov 2001 09:48:00 -0000 1.1
+++ lib/am/distdir.am 23 Nov 2001 12:48:55 -0000
@@ -273,15 +273,25 @@
                   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%

-- 
Alexandre Duret-Lutz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]