am: do not quote `like this', as per GCS recommendation
[platform/upstream/automake.git] / lib / am / distdir.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 2001-2012 Free Software Foundation, Inc.
3
4 ## This program is free software; you can redistribute it and/or modify
5 ## it under the terms of the GNU General Public License as published by
6 ## the Free Software Foundation; either version 2, or (at your option)
7 ## any later version.
8
9 ## This program is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 ## GNU General Public License for more details.
13
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 ## DIST_COMMON comes first so that README can be the very first file.
18 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
19
20 if %?TOPDIR_P%
21 distdir = $(PACKAGE)-$(VERSION)
22 top_distdir = $(distdir)
23
24 am__remove_distdir = \
25   if test -d "$(distdir)"; then \
26     find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
27       && rm -rf "$(distdir)" \
28 ## On MSYS (1.0.17) it is not possible to remove a directory that is in
29 ## use; so, if the first rm fails, we sleep some seconds and retry, to
30 ## give pending processes some time to exit and "release" the directory
31 ## before we remove it.  The value of "some seconds" is 5 for the moment,
32 ## which is mostly an arbitrary value, but seems high enough in practice.
33 ## See automake bug#10470.
34       || { sleep 5 && rm -rf "$(distdir)"; }; \
35   else :; fi
36 am__post_remove_distdir = $(am__remove_distdir)
37 endif %?TOPDIR_P%
38
39 if %?SUBDIRS%
40 ## computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
41 ## Input:
42 ## - DIR1            relative pathname, relative to the current directory
43 ## - DIR2            relative pathname, relative to the current directory
44 ## Output:
45 ## - reldir          relative pathname of DIR2, relative to DIR1
46 am__relativize = \
47   dir0=`pwd`; \
48   sed_first='s,^\([^/]*\)/.*$$,\1,'; \
49   sed_rest='s,^[^/]*/*,,'; \
50   sed_last='s,^.*/\([^/]*\)$$,\1,'; \
51   sed_butlast='s,/*[^/]*$$,,'; \
52   while test -n "$$dir1"; do \
53     first=`echo "$$dir1" | sed -e "$$sed_first"`; \
54     if test "$$first" != "."; then \
55       if test "$$first" = ".."; then \
56         dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
57         dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
58       else \
59         first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
60         if test "$$first2" = "$$first"; then \
61           dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
62         else \
63           dir2="../$$dir2"; \
64         fi; \
65         dir0="$$dir0"/"$$first"; \
66       fi; \
67     fi; \
68     dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
69   done; \
70   reldir="$$dir2"
71 endif %?SUBDIRS%
72
73 .PHONY: distdir
74 if %?SUBDIRS%
75 AM_RECURSIVE_TARGETS += distdir
76 endif %?SUBDIRS%
77
78 distdir: $(DISTFILES)
79 ##
80 ## For Gnits users, this is pretty handy.  Look at 15 lines
81 ## in case some explanatory text is desirable.
82 ##
83 if %?TOPDIR_P%
84 if  %?CK-NEWS%
85         @case `sed 15q $(srcdir)/NEWS` in \
86         *"$(VERSION)"*) : ;; \
87         *) \
88           echo "NEWS not updated; not releasing" 1>&2; \
89           exit 1;; \
90         esac
91 endif  %?CK-NEWS%
92 endif %?TOPDIR_P%
93 ##
94 ## 'missing help2man' may have created some bogus man pages.  Ensure they
95 ## are not distributed.
96 ##
97 if %?INSTALL-MAN%
98 if %?HAVE-MANS%
99         @list='$(MANS)'; if test -n "$$list"; then \
100           list=`for p in $$list; do \
101             if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
102 ## Note that we check existing man pages here only.  If there are man pages
103 ## which are not distributed, and may be generated only conditionally, then
104 ## we should not error out because of them.  This could be refined to take
105 ## into account only dist_*_MANS, but then we'd be missing out on those
106 ## the user distributes with EXTRA_DIST.
107             if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
108           if test -n "$$list" && \
109             grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
110             echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \
111             grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/         /' >&2; \
112             echo "       to fix them, install help2man, remove and regenerate the man pages;" >&2; \
113             echo "       typically 'make maintainer-clean' will remove them" >&2; \
114             exit 1; \
115           else :; fi; \
116         else :; fi
117 endif %?HAVE-MANS%
118 endif %?INSTALL-MAN%
119 ##
120 ## Only for the top dir.
121 ##
122 if %?TOPDIR_P%
123         $(am__remove_distdir)
124         test -d "$(distdir)" || mkdir "$(distdir)"
125 endif %?TOPDIR_P%
126 ##
127 ##
128         @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
129         topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
130 ##
131 ## Yet another hack to support SUN make.
132 ##
133 ## Let's assume 'foo' appears in DISTFILES and is not a built file.
134 ## When building with VPATH=$(srcdir), SUN make and OSF1/Tru64 will
135 ## rewrite 'foo' as '$(srcdir)/foo'.  An attempt to install the file
136 ## with
137 ##    cp $file $(distdir)/$file
138 ## will thus install $(srcdir)/foo as $(distdir)/$(srcdir)/foo
139 ## instead of $(distdir)/foo.
140 ##
141 ## So let's strip this leading $(srcdir)/ when it exists.  (As far we
142 ## know, only SUN make and OSF1/Tru64 make add it.)  Searching whether
143 ## the file is to be found in the source or build directory will be
144 ## done later.
145 ##
146 ## In case we are _not_ using SUN or OSF1/Tru64 make, how can we be sure
147 ## we are not stripping a legitimate filename that starts with the
148 ## same pattern as $(srcdir)?
149 ## Well, it can't happen without the Makefile author distributing
150 ## something out of the distribution (which is bad).  As an example,
151 ## consider "EXTRA_DIST = ../bar".  This is an issue if $srcdir is
152 ## '..', however getting this value for srcdir is impossible:
153 ## "EXTRA_DIST = ../bar" implies we are in a subdirectory (so '../bar'
154 ## is within the package), hence '$srcdir' is something like
155 ## '../../subdir'.
156 ##
157 ## There is more to say about files which are above the current directory,
158 ## like '../bar' in the previous example.  The OSF1/Tru64 make
159 ## implementation can simplify filenames resulting from a VPATH lookup.
160 ## For instance if "VPATH = ../../subdir" and '../bar' is found in that
161 ## VPATH directory, then occurrences of '../bar' will be replaced by
162 ## '../../bar' (instead of '../../subdir/../bar').  This obviously defeats
163 ## any attempt to strip a leading $srcdir.  Presently we have no workaround
164 ## for this.  We avoid this issue by writing "EXTRA_DIST = $(srcdir)/../bar"
165 ## instead of "EXTRA_DIST = ../bar".  This prefixing is needed only for files
166 ## above the current directory.  Fortunately, apart from auxdir files which
167 ## can be located in .. or ../.., this situation hardly occurs in practice.
168 ##
169 ## Also rewrite $(top_srcdir) (which sometimes appears in DISTFILES, and can
170 ## be absolute) by $(top_builddir) (which is always relative).  $(srcdir) will
171 ## be prepended later.
172         list='$(DISTFILES)'; \
173           dist_files=`for file in $$list; do echo $$file; done | \
174           sed -e "s|^$$srcdirstrip/||;t" \
175               -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
176 ## (The second 't' command clears the flag for the next round.)
177 ##
178 ## Make the subdirectories for the files.
179 ##
180         case $$dist_files in \
181           */*) $(MKDIR_P) `echo "$$dist_files" | \
182                            sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
183                            sort -u` ;; \
184         esac; \
185 ##
186 ##
187         for file in $$dist_files; do \
188 ##
189 ## Always look for the file in the build directory first.  That way
190 ## for something like yacc output we will correctly pick up the latest
191 ## version.  Also check for directories in the build directory first,
192 ## so one can ship generated directories.
193 ##
194           if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
195 ##
196 ## Use cp, not ln.  There are situations in which "ln" can fail.  For
197 ## instance a file to distribute could actually be a cross-filesystem
198 ## symlink -- this can easily happen if "gettextize" was run on the
199 ## distribution.
200 ##
201           if test -d $$d/$$file; then \
202 ## Don't mention $$file in the destination argument, since this fails if
203 ## the destination directory already exists.  Also, use '-R' and not '-r'.
204 ## '-r' is almost always incorrect.
205 ##
206 ## If a directory exists both in '.' and $(srcdir), then we copy the
207 ## files from $(srcdir) first and then install those from '.'.  This
208 ## can help people who distribute directories made of source files
209 ## *and* generated files.  It is also important when the directory
210 ## exists only in $(srcdir), because some vendor Make (such as Tru64)
211 ## will magically create an empty directory in '.'.
212             dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
213 ## If the destination directory already exists, it may contain read-only
214 ## files, e.g., during "make distcheck".
215             if test -d "$(distdir)/$$file"; then \
216               find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
217             fi; \
218             if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
219               cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
220               find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
221             fi; \
222             cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
223           else \
224 ## Test for file existence because sometimes a file gets included in
225 ## DISTFILES twice.  For example this happens when a single source
226 ## file is used in building more than one program.
227 ## See also test 'dist-repeated.test'.
228             test -f "$(distdir)/$$file" \
229             || cp -p $$d/$$file "$(distdir)/$$file" \
230             || exit 1; \
231           fi; \
232         done
233 ##
234 ## Test for directory existence here because previous automake
235 ## invocation might have created some directories.  Note that we
236 ## explicitly set distdir for the subdir make; that lets us mix-n-match
237 ## many automake-using packages into one large package, and have "dist"
238 ## at the top level do the right thing.  If we're in the topmost
239 ## directory, then we use 'distdir' instead of 'top_distdir'; this lets
240 ## us work correctly with an enclosing package.
241 if %?SUBDIRS%
242         @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
243           if test "$$subdir" = .; then :; else \
244             $(am__make_dryrun) \
245               || test -d "$(distdir)/$$subdir" \
246               || $(MKDIR_P) "$(distdir)/$$subdir" \
247               || exit 1; \
248             dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
249             $(am__relativize); \
250             new_distdir=$$reldir; \
251             dir1=$$subdir; dir2="$(top_distdir)"; \
252             $(am__relativize); \
253             new_top_distdir=$$reldir; \
254             echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
255             echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
256             ($(am__cd) $$subdir && \
257               $(MAKE) $(AM_MAKEFLAGS) \
258                 top_distdir="$$new_top_distdir" \
259                 distdir="$$new_distdir" \
260 ## Disable am__remove_distdir so that sub-packages do not clear a
261 ## directory we have already cleared and might even have populated
262 ## (e.g. shared AUX dir in the sub-package).
263                 am__remove_distdir=: \
264 ## Disable filename length check:
265                 am__skip_length_check=: \
266 ## No need to fix modes more than once:
267                 am__skip_mode_fix=: \
268                 distdir) \
269               || exit 1; \
270           fi; \
271         done
272 endif %?SUBDIRS%
273 ##
274 ## We might have to perform some last second updates, such as updating
275 ## info files.
276 ## We must explicitly set distdir and top_distdir for these sub-makes.
277 ##
278 if %?DIST-TARGETS%
279         $(MAKE) $(AM_MAKEFLAGS) \
280           top_distdir="$(top_distdir)" distdir="$(distdir)" \
281           %DIST-TARGETS%
282 endif %?DIST-TARGETS%
283 ##
284 ## This complex find command will try to avoid changing the modes of
285 ## links into the source tree, in case they're hard-linked.
286 ##
287 ## Ignore return result from chmod, because it might give an error
288 ## if we chmod a symlink.
289 ##
290 ## Another nastiness: if the file is unreadable by us, we make it
291 ## readable regardless of the number of links to it.  This only
292 ## happens in perverse cases.
293 ##
294 ## We use $(install_sh) because that is a known-portable way to modify
295 ## the file in place in the source tree.
296 ##
297 ## If we are being invoked recursively, then there is no need to walk
298 ## the whole subtree again.  This is a complexity reduction for a deep
299 ## hierarchy of subpackages.
300 ##
301 if %?TOPDIR_P%
302         -test -n "$(am__skip_mode_fix)" \
303         || find "$(distdir)" -type d ! -perm -755 \
304                 -exec chmod u+rwx,go+rx {} \; -o \
305           ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
306           ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
307           ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
308         || chmod -R a+r "$(distdir)"
309 if %?FILENAME_FILTER%
310         @if test -z "$(am__skip_length_check)" && find "$(distdir)" -type f -print | \
311           grep '^%FILENAME_FILTER%' 1>&2; then \
312           echo 'error: the above filenames are too long' 1>&2; \
313           exit 1; \
314         else :; fi
315 endif %?FILENAME_FILTER%
316 endif %?TOPDIR_P%
317
318
319
320 ## --------------------------------------- ##
321 ## Building various distribution flavors.  ##
322 ## --------------------------------------- ##
323
324 ## Note that we don't use GNU tar's '-z' option.  One reason (but not
325 ## the only reason) is that some versions of tar (e.g., OSF1)
326 ## interpret '-z' differently.
327 ##
328 ## The -o option of GNU tar used to exclude empty directories.  This
329 ## behavior was fixed in tar 1.12 (released on 1997-04-25).  But older
330 ## versions of tar are still used (for instance NetBSD 1.6.1 ships
331 ## with tar 1.11.2).  We do not do anything specific w.r.t. this
332 ## incompatibility since packages where empty directories need to be
333 ## present in the archive are really unusual.
334 ##
335 ## We order DIST_TARGETS by expected duration of the compressors,
336 ## slowest first, for better parallelism in "make dist".  Do not
337 ## reorder DIST_ARCHIVES, users may expect gzip to be first.
338
339 if %?TOPDIR_P%
340
341 ?GZIP?DIST_ARCHIVES += $(distdir).tar.gz
342 GZIP_ENV = --best
343 .PHONY: dist-gzip
344 dist-gzip: distdir
345         tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
346         $(am__post_remove_distdir)
347
348 ?BZIP2?DIST_ARCHIVES += $(distdir).tar.bz2
349 .PHONY: dist-bzip2
350 dist-bzip2: distdir
351         tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
352         $(am__post_remove_distdir)
353
354 ?LZIP?DIST_ARCHIVES += $(distdir).tar.lz
355 .PHONY: dist-lzip
356 dist-lzip: distdir
357         tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
358         $(am__post_remove_distdir)
359
360 ?XZ?DIST_ARCHIVES += $(distdir).tar.xz
361 .PHONY: dist-xz
362 dist-xz: distdir
363         tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
364         $(am__post_remove_distdir)
365
366 ?COMPRESS?DIST_ARCHIVES += $(distdir).tar.Z
367 .PHONY: dist-tarZ
368 dist-tarZ: distdir
369         tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
370         $(am__post_remove_distdir)
371
372 ?SHAR?DIST_ARCHIVES += $(distdir).shar.gz
373 .PHONY: dist-shar
374 dist-shar: distdir
375         shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
376         $(am__post_remove_distdir)
377
378 ?ZIP?DIST_ARCHIVES += $(distdir).zip
379 .PHONY: dist-zip
380 dist-zip: distdir
381         -rm -f $(distdir).zip
382         zip -rq $(distdir).zip $(distdir)
383         $(am__post_remove_distdir)
384
385 ?LZIP?DIST_TARGETS += dist-lzip
386 ?XZ?DIST_TARGETS += dist-xz
387 ?SHAR?DIST_TARGETS += dist-shar
388 ?BZIP2?DIST_TARGETS += dist-bzip2
389 ?GZIP?DIST_TARGETS += dist-gzip
390 ?ZIP?DIST_TARGETS += dist-zip
391 ?COMPRESS?DIST_TARGETS += dist-tarZ
392
393 endif %?TOPDIR_P%
394
395
396
397 ## ------------------------------------------------- ##
398 ## Building all the requested distribution flavors.  ##
399 ## ------------------------------------------------- ##
400
401 ## Currently we cannot use if/endif inside a rule.  The file_contents
402 ## parser needs work.
403
404 if %?TOPDIR_P%
405
406 .PHONY: dist dist-all
407 if %?SUBDIRS%
408 AM_RECURSIVE_TARGETS += dist dist-all
409 endif %?SUBDIRS%
410
411 dist dist-all:
412         $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
413         $(am__post_remove_distdir)
414
415 endif %?TOPDIR_P%
416
417
418 ## ------------------------- ##
419 ## Checking a distribution.  ##
420 ## ------------------------- ##
421
422
423 if %?TOPDIR_P%
424 if %?SUBDIRS%
425 AM_RECURSIVE_TARGETS += distcheck
426 endif %?SUBDIRS%
427
428 # This target untars the dist file and tries a VPATH configuration.  Then
429 # it guarantees that the distribution is self-contained by making another
430 # tarfile.
431 .PHONY: distcheck
432 distcheck: dist
433         case '$(DIST_ARCHIVES)' in \
434         *.tar.gz*) \
435           GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
436         *.tar.bz2*) \
437           bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
438         *.tar.lz*) \
439           lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
440         *.tar.xz*) \
441           xz -dc $(distdir).tar.xz | $(am__untar) ;;\
442         *.tar.Z*) \
443           uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
444         *.shar.gz*) \
445           GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
446         *.zip*) \
447           unzip $(distdir).zip ;;\
448         esac
449 ## Make the new source tree read-only.  Distributions ought to work in
450 ## this case.  However, make the top-level directory writable so we
451 ## can make our new subdirs.
452         chmod -R a-w $(distdir); chmod a+w $(distdir)
453         mkdir $(distdir)/_build
454         mkdir $(distdir)/_inst
455 ## Undo the write access.
456         chmod a-w $(distdir)
457 ## With GNU make, the following command will be executed even with "make -n",
458 ## due to the presence of '$(MAKE)'.  That is normally all well (and '$(MAKE)'
459 ## is necessary for things like parallel distcheck), but here we don't want
460 ## execution.  To avoid MAKEFLAGS parsing hassles, use a witness file that a
461 ## non-'-n' run would have just created.
462         test -d $(distdir)/_build || exit 0; \
463 ## Compute the absolute path of '_inst'.  Strip any leading DOS drive
464 ## to allow DESTDIR installations.  Otherwise "$(DESTDIR)$(prefix)" would
465 ## expand to "c:/temp/am-dc-5668/c:/src/package/package-1.0/_inst".
466         dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
467 ## We will attempt a DESTDIR install in $dc_destdir.  We don't
468 ## create this directory under $dc_install_base, because it would
469 ## create very long directory names.
470           && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
471 ?DISTCHECK-HOOK?          && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \
472 ## Parallel BSD make may not start a new shell for each command in a recipe,
473 ## so be sure to 'cd' back to the original directory after this.
474           && am__cwd=`pwd` \
475           && $(am__cd) $(distdir)/_build \
476           && ../configure --srcdir=.. --prefix="$$dc_install_base" \
477 ?GETTEXT?           --with-included-gettext \
478 ## Additional flags for configure.  Keep this last in the configure
479 ## invocation so the developer and user can override previous options,
480 ## and let the user's flags take precedence over the developer's ones.
481             $(AM_DISTCHECK_CONFIGURE_FLAGS) \
482             $(DISTCHECK_CONFIGURE_FLAGS) \
483           && $(MAKE) $(AM_MAKEFLAGS) \
484           && $(MAKE) $(AM_MAKEFLAGS) dvi \
485           && $(MAKE) $(AM_MAKEFLAGS) check \
486           && $(MAKE) $(AM_MAKEFLAGS) install \
487           && $(MAKE) $(AM_MAKEFLAGS) installcheck \
488           && $(MAKE) $(AM_MAKEFLAGS) uninstall \
489           && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
490                 distuninstallcheck \
491 ## Make sure the package has proper DESTDIR support (we could not test this
492 ## in the previous install/installcheck/uninstall test, because it's reasonable
493 ## for installcheck to fail in a DESTDIR install).
494 ## We make the '$dc_install_base' read-only because this is where files
495 ## with missing DESTDIR support are likely to be installed.
496           && chmod -R a-w "$$dc_install_base" \
497 ## The logic here is quite convoluted because we must clean $dc_destdir
498 ## whatever happens (it won't be erased by the next run of distcheck like
499 ## $(distdir) is).
500           && ({ \
501 ## Build the directory, so we can cd into it even if "make install"
502 ## didn't create it.  Use mkdir, not $(MKDIR_P) because we want to
503 ## fail if the directory already exists (PR/413).
504                (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
505                && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
506                && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
507                && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
508                     distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
509               } || { rm -rf "$$dc_destdir"; exit 1; }) \
510           && rm -rf "$$dc_destdir" \
511           && $(MAKE) $(AM_MAKEFLAGS) dist \
512 ## Make sure to remove the dists we created in the test build directory.
513           && rm -rf $(DIST_ARCHIVES) \
514           && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
515 ## Cater to parallel BSD make (see above).
516           && cd "$$am__cwd" \
517           || exit 1
518         $(am__post_remove_distdir)
519         @(echo "$(distdir) archives ready for distribution: "; \
520           list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
521           sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
522
523 ## Define distuninstallcheck_listfiles and distuninstallcheck separately
524 ## from distcheck, so that they can be overridden by the user.
525 .PHONY: distuninstallcheck
526 distuninstallcheck_listfiles = find . -type f -print
527 ## The 'dir' file (created by install-info) might still exist after
528 ## uninstall, so we must be prepared to account for it.  The following
529 ## check is not 100% strict, but is definitely good enough, and even
530 ## accounts for overridden $(infodir).
531 am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
532   | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
533 distuninstallcheck:
534         @test -n '$(distuninstallcheck_dir)' || { \
535           echo 'ERROR: trying to run $@ with an empty' \
536                '$$(distuninstallcheck_dir)' >&2; \
537           exit 1; \
538         }; \
539         $(am__cd) '$(distuninstallcheck_dir)' || { \
540           echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
541           exit 1; \
542         }; \
543         test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
544            || { echo "ERROR: files left after uninstall:" ; \
545                 if test -n "$(DESTDIR)"; then \
546                   echo "  (check DESTDIR support)"; \
547                 fi ; \
548                 $(distuninstallcheck_listfiles) ; \
549                 exit 1; } >&2
550
551 ## Define distcleancheck_listfiles and distcleancheck separately
552 ## from distcheck, so that they can be overridden by the user.
553 .PHONY: distcleancheck
554 distcleancheck_listfiles = find . -type f -print
555 distcleancheck: distclean
556         @if test '$(srcdir)' = . ; then \
557           echo "ERROR: distcleancheck can only run from a VPATH build" ; \
558           exit 1 ; \
559         fi
560         @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
561           || { echo "ERROR: files left in build directory after distclean:" ; \
562                $(distcleancheck_listfiles) ; \
563                exit 1; } >&2
564 endif %?TOPDIR_P%