1 # Most of this is probably too coreutils-centric to be useful to other packages.
5 write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
8 t=$(TMPDIR)/$(PACKAGE)/test
11 # More than once, tainted build and source directory names would
12 # have caused at least one "make check" test to apply "chmod 700"
13 # to all directories under $HOME. Make sure it doesn't happen again.
14 tp := $(shell echo "$(TMPDIR)/$(PACKAGE)-$$$$")
16 t_taint = '$(t_prefix) b'
17 fake_home = $(tp)/home
19 # Disable this test, since libtool-generated scripts
20 # can't deal with a space-tainted srcdir.
21 ALL_RECURSIVE_TARGETS += taint-distcheck
22 .PHONY: taint-distcheck
25 # Verify that a twisted use of --program-transform-name=PROGRAM works.
26 define install-transform-check
27 echo running install-transform-check \
29 && $(MAKE) program_transform_name='s/.*/zyx/' \
30 prefix=$(pfx) install \
31 && test "$$(echo $(pfx)/sbin/*)" = "$(pfx)/sbin/zyx" \
32 && test "$$(find $(pfx)/share/man -type f|sed 's,.*/,,;s,\..*,,')" = "zyx"
35 # Install, then verify that all binaries and man pages are in place.
36 # Note that neither the binary, ginstall, nor the ].1 man page is installed.
38 $(MAKE) prefix=$(pfx) install \
39 && test ! -f $(pfx)/bin/ginstall \
41 for i in $(built_programs); do \
42 test "$$i" = ginstall && i=install; \
43 for j in "$(pfx)/bin/$$i" \
44 "$(pfx)/share/man/man1/$$i.1"; do \
45 case $$j in *'[.1') continue;; esac; \
47 || { echo "$$j not installed"; fail=1; }; \
50 test $$fail = 1 && exit 1 || :; \
54 define coreutils-path-check
56 if test -f $(srcdir)/src/true.c; then \
59 && ($(write_loser)) > $(bin)/loser \
60 && chmod a+x $(bin)/loser \
61 && for i in $(built_programs); do \
63 rm|expr|basename|echo|sort|ls|tr);; \
64 cat|dirname|mv|wc);; \
65 *) ln $(bin)/loser $(bin)/$$i;; \
68 && ln -sf ../src/true $(bin)/false \
69 && PATH=`pwd`/$(bin)$(PATH_SEPARATOR)$$PATH \
70 $(MAKE) -C tests check \
71 && { test -d gnulib-tests \
72 && $(MAKE) -C gnulib-tests check \
79 test $$fail = 1 && exit 1 || :; \
83 # Use -Wformat -Werror to detect format-string/arg-list mismatches.
84 # Also, check for shadowing problems with -Wshadow, and for pointer
85 # arithmetic problems with -Wpointer-arith.
86 # These CFLAGS are pretty strict. If you build this target, you probably
87 # have to have a recent version of gcc and glibc headers.
88 # The hard-linking for-loop below ensures that there is a bin/ directory
89 # full of all of the programs under test (except the ones that are required
90 # for basic Makefile rules), all symlinked to the just-built "false" program.
91 # This is to ensure that if ever a test neglects to make PATH include
92 # the build srcdir, these always-failing programs will run.
93 # Otherwise, it is too easy to test the wrong programs.
94 # Note that "false" itself is a symlink to true, so it too will malfunction.
95 ALL_RECURSIVE_TARGETS += my-distcheck
96 my-distcheck: $(DIST_ARCHIVES) $(local-check)
101 GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
103 && ./configure --enable-gcc-warnings --disable-nls \
104 && $(MAKE) AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
106 && $(install-transform-check) \
108 && $(coreutils-path-check) \
110 (cd $(t) && mv $(distdir) $(distdir).old \
111 && $(AMTAR) -zxf - ) < $(distdir).tar.gz
112 diff -ur $(t)/$(distdir).old $(t)/$(distdir)
114 @echo "========================"; \
115 echo "$(distdir).tar.gz is ready for distribution"; \
116 echo "========================"