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