[parted-devel] "make distcheck" works again

Jim Meyering jim at meyering.net
Thu May 29 12:40:36 UTC 2008


I've been generalizing coreutils' maint.mk recently,
and most of those changes work fine here and fix a new
"make distcheck" failure as well.

	* maint.mk: Update from coreutils.

---
 maint.mk |   60 ++++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 48 insertions(+), 12 deletions(-)

diff --git a/maint.mk b/maint.mk
index e8671bd..d89cd76 100644
--- a/maint.mk
+++ b/maint.mk
@@ -131,7 +131,7 @@ sc_prohibit_atoi_atof:

 # Use STREQ rather than comparing strcmp == 0, or != 0.
 sc_prohibit_strcmp:
-	@grep -nE '! *str''cmp \(|\<str''cmp \([^)]+\) *=='		\
+	@grep -nE '! *str''cmp *\(|\<str''cmp *\([^)]+\) *=='		\
 	    $$($(VC_LIST_EXCEPT)) &&					\
 	  { echo '$(ME): use STREQ in place of the above uses of str''cmp' \
 		1>&2; exit 1; } || :
@@ -622,38 +622,72 @@ null_AM_MAKEFLAGS = \
   AUTOHEADER=false \
   MAKEINFO=false

-built_programs = $$(cd src && MAKEFLAGS= $(MAKE) -s built_programs.list)
+built_programs = \
+  $$(cd src && echo '_spy:;@echo $$(sbin_PROGRAMS)' \
+     | MAKEFLAGS= $(MAKE) -s make -f Makefile -f - _spy)

 warn_cflags = -Dlint -O -Werror -Wall -Wformat -Wshadow -Wpointer-arith
 bin=bin-$$$$

 write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'

+TMPDIR ?= /tmp
+t=$(TMPDIR)/$(PACKAGE)/test
+pfx=$(t)/i
+
+# Verify that a twisted use of --program-transform-name=PROGRAM works.
+define install-transform-check
+  echo running install-transform-check			\
+    && rm -rf $(pfx)					\
+    && $(MAKE) program_transform_name='s/.*/zyx/'	\
+      prefix=$(pfx) install				\
+    && test "$$(echo $(pfx)/sbin/*)" = "$(pfx)/sbin/zyx"	\
+    && test "$$(echo $(pfx)/share/man/man1/*)" =	\
+                    "$(pfx)/share/man/man1/zyx.1"
+endef
+
+# Install, then verify that all binaries and man pages are in place.
+# Note that neither the binary, ginstall, nor the ].1 man page is installed.
+define my-instcheck
+  echo running my-instcheck				\
+    && $(MAKE) prefix=$(pfx) install			\
+    && test ! -f $(pfx)/bin/ginstall			\
+    && { fail=0;					\
+      for i in $(built_programs); do			\
+        test "$$i" = ginstall && i=install;		\
+        for j in "$(pfx)/bin/$$i"			\
+                 "$(pfx)/share/man/man1/$$i.1"; do	\
+          case $$j in *'[.1') continue;; esac;		\
+          test -f "$$j" && :				\
+            || { echo "$$j not installed"; fail=1; };	\
+        done;						\
+      done;						\
+      test $$fail = 1 && exit 1 || :;			\
+    }
+endef
+
 # Use -Wformat -Werror to detect format-string/arg-list mismatches.
 # Also, check for shadowing problems with -Wshadow, and for pointer
 # arithmetic problems with -Wpointer-arith.
 # These CFLAGS are pretty strict.  If you build this target, you probably
 # have to have a recent version of gcc and glibc headers.
-# The for-loop below ensures that there is a bin/ directory full of all
-# of the programs under test (except the few that are required for basic
-# Makefile rules), all symlinked to the just-built "false" program.
+# The hard-linking for-loop below ensures that there is a bin/ directory
+# full of all of the programs under test (except the ones that are required
+# for basic Makefile rules), all symlinked to the just-built "false" program.
 # This is to ensure that if ever a test neglects to make PATH include
 # the build srcdir, these always-failing programs will run.
 # Otherwise, it is too easy to test the wrong programs.
 # Note that "false" itself is a symlink to true, so it too will malfunction.
-TMPDIR ?= /tmp
-t=$(TMPDIR)/$(PACKAGE)/test
-my-distcheck: $(local-check) check
+my-distcheck: $(DIST_ARCHIVES) $(local-check) check
 	-rm -rf $(t)
 	mkdir -p $(t)
 	GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
 	cd $(t)/$(distdir)				\
-	  && ./configure --disable-nls --prefix=$(t)/i	\
+	  && ./configure --disable-nls			\
 	  && $(MAKE) CFLAGS='$(warn_cflags)'		\
 	      AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)'	\
 	  && $(MAKE) dvi				\
-	  && $(MAKE) install				\
-	  && test -f $(mandir)/man1/ls.1		\
+	  && $(my-instcheck)				\
 	  && mkdir $(bin)				\
 	  && ($(write_loser)) > $(bin)/loser            \
 	  && chmod a+x $(bin)/loser                     \
@@ -666,7 +700,9 @@ my-distcheck: $(local-check) check
 	     done					\
 	  && ln -sf ../src/true $(bin)/false		\
 	  && PATH=`pwd`/$(bin):$$PATH $(MAKE) -C tests check \
-	  && $(MAKE) -C gnulib-tests check		\
+	  && { test -d gnulib-tests			\
+	         && $(MAKE) -C gnulib-tests check	\
+	         || :; }				\
 	  && rm -rf $(bin)				\
 	  && $(MAKE) distclean
 	(cd $(t) && mv $(distdir) $(distdir).old	\
--
1.5.6.rc0.30.g51263



More information about the parted-devel mailing list