doc: doubled words in source comments.
[automake.git] / lib / am / distdir.am
blobc85f6a325b8b550a094a74b6541560fdc8e1206a
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 2001-2024 Free Software Foundation, Inc.
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.
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.
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 DIST_COMMON += $(am__DIST_COMMON)
18 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
20 if %?TOPDIR_P%
21 distdir = $(PACKAGE)-$(VERSION)
22 top_distdir = $(distdir)
24 am__remove_distdir = \
25   if test -d "$(distdir)"; then \
26     find "$(distdir)" -type d ! -perm -700 -exec chmod u+rwx {} ';' \
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%
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%
73 .PHONY: distdir
74 if %?SUBDIRS%
75 AM_RECURSIVE_TARGETS += distdir distdir-am
76 endif %?SUBDIRS%
78 if %?DIST_BUILT_SOURCES%
79 distdir:
80         $(MAKE) $(AM_MAKEFLAGS) distdir-am
81 else !%?DIST_BUILT_SOURCES%
82 distdir: $(BUILT_SOURCES)
83         $(MAKE) $(AM_MAKEFLAGS) distdir-am
84 endif !%?DIST_BUILT_SOURCES%
86 distdir-am: $(DISTFILES)
88 ## For Gnits users, this is pretty handy.  Look at 15 lines
89 ## in case some explanatory text is desirable.
91 if %?TOPDIR_P%
92 if  %?CK-NEWS%
93         @case `sed 15q $(srcdir)/NEWS` in \
94         *"$(VERSION)"*) : ;; \
95         *) \
96           echo "NEWS not updated; not releasing" 1>&2; \
97           exit 1;; \
98         esac
99 endif  %?CK-NEWS%
100 endif %?TOPDIR_P%
102 ## Only for the top dir.
104 if %?TOPDIR_P%
105         $(am__remove_distdir)
106         $(AM_V_at)$(MKDIR_P) "$(distdir)"
107 endif %?TOPDIR_P%
110         @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
111         topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
113 ## Yet another hack to support SUN make.
115 ## Let's assume 'foo' appears in DISTFILES and is not a built file.
116 ## When building with VPATH=$(srcdir), SUN make and OSF1/Tru64 will
117 ## rewrite 'foo' as '$(srcdir)/foo'.  An attempt to install the file
118 ## with
119 ##    cp $file $(distdir)/$file
120 ## will thus install $(srcdir)/foo as $(distdir)/$(srcdir)/foo
121 ## instead of $(distdir)/foo.
123 ## So let's strip this leading $(srcdir)/ when it exists.  (As far we
124 ## know, only SUN make and OSF1/Tru64 make add it.)  Searching whether
125 ## the file is to be found in the source or build directory will be
126 ## done later.
128 ## In case we are _not_ using SUN or OSF1/Tru64 make, how can we be sure
129 ## we are not stripping a legitimate filename that starts with the
130 ## same pattern as $(srcdir)?
131 ## Well, it can't happen without the Makefile author distributing
132 ## something out of the distribution (which is bad).  As an example,
133 ## consider "EXTRA_DIST = ../bar".  This is an issue if $srcdir is
134 ## '..', however getting this value for srcdir is impossible:
135 ## "EXTRA_DIST = ../bar" implies we are in a subdirectory (so '../bar'
136 ## is within the package), hence '$srcdir' is something like
137 ## '../../subdir'.
139 ## There is more to say about files which are above the current directory,
140 ## like '../bar' in the previous example.  The OSF1/Tru64 make
141 ## implementation can simplify filenames resulting from a VPATH lookup.
142 ## For instance if "VPATH = ../../subdir" and '../bar' is found in that
143 ## VPATH directory, then occurrences of '../bar' will be replaced by
144 ## '../../bar' (instead of '../../subdir/../bar').  This obviously defeats
145 ## any attempt to strip a leading $srcdir.  Presently we have no workaround
146 ## for this.  We avoid this issue by writing "EXTRA_DIST = $(srcdir)/../bar"
147 ## instead of "EXTRA_DIST = ../bar".  This prefixing is needed only for files
148 ## above the current directory.  Fortunately, apart from auxdir files which
149 ## can be located in .. or ../.., this situation hardly occurs in practice.
151 ## Also rewrite $(top_srcdir) (which sometimes appears in DISTFILES, and can
152 ## be absolute) by $(top_builddir) (which is always relative).  $(srcdir) will
153 ## be prepended later.
154         list='$(DISTFILES)'; \
155           dist_files=`for file in $$list; do echo $$file; done | \
156           sed -e "s|^$$srcdirstrip/||;t" \
157               -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
158 ## (The second 't' command clears the flag for the next round.)
160 ## Make the subdirectories for the files.
162         case $$dist_files in \
163           */*) $(MKDIR_P) `echo "$$dist_files" | \
164                            sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
165                            sort -u` ;; \
166         esac; \
169         for file in $$dist_files; do \
171 ## Always look for the file in the build directory first.  That way
172 ## for something like yacc output we will correctly pick up the latest
173 ## version.  Also check for directories in the build directory first,
174 ## so one can ship generated directories.
176           if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
178 ## Use cp, not ln.  There are situations in which "ln" can fail.  For
179 ## instance a file to distribute could actually be a cross-filesystem
180 ## symlink -- this can easily happen if "gettextize" was run on the
181 ## distribution.
183           if test -d $$d/$$file; then \
184 ## Don't mention $$file in the destination argument, since this fails if
185 ## the destination directory already exists.  Also, use '-R' and not '-r'.
186 ## '-r' is almost always incorrect.
188 ## If a directory exists both in '.' and $(srcdir), then we copy the
189 ## files from $(srcdir) first and then install those from '.'.  This
190 ## can help people who distribute directories made of source files
191 ## *and* generated files.  It is also important when the directory
192 ## exists only in $(srcdir), because some vendor Make (such as Tru64)
193 ## will magically create an empty directory in '.'.
194             dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
195 ## If the destination directory already exists, it may contain read-only
196 ## files, e.g., during "make distcheck".
197             if test -d "$(distdir)/$$file"; then \
198               find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
199             fi; \
200             if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
201               cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
202               find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
203             fi; \
204             cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
205           else \
206 ## Test for file existence because sometimes a file gets included in
207 ## DISTFILES twice.  For example this happens when a single source
208 ## file is used in building more than one program.
209 ## See also test 'dist-repeated.sh'.
210             test -f "$(distdir)/$$file" \
211             || cp -p $$d/$$file "$(distdir)/$$file" \
212             || exit 1; \
213           fi; \
214         done
216 ## Test for directory existence here because a previous automake
217 ## invocation might have created some directories.  Note that we
218 ## explicitly set distdir for the subdir make; that lets us mix-n-match
219 ## many automake-using packages into one large package, and have "dist"
220 ## at the top level do the right thing.  If we're in the topmost
221 ## directory, then we use 'distdir' instead of 'top_distdir'; this lets
222 ## us work correctly with an enclosing package.
223 if %?SUBDIRS%
224         @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
225           if test "$$subdir" = .; then :; else \
226             $(am__make_dryrun) \
227               || test -d "$(distdir)/$$subdir" \
228               || $(MKDIR_P) "$(distdir)/$$subdir" \
229               || exit 1; \
230             dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
231             $(am__relativize); \
232             new_distdir=$$reldir; \
233             dir1=$$subdir; dir2="$(top_distdir)"; \
234             $(am__relativize); \
235             new_top_distdir=$$reldir; \
236             echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
237             echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
238             ($(am__cd) $$subdir && \
239               $(MAKE) $(AM_MAKEFLAGS) \
240                 top_distdir="$$new_top_distdir" \
241                 distdir="$$new_distdir" \
242 ## Disable am__remove_distdir so that sub-packages do not clear a
243 ## directory we have already cleared and might even have populated
244 ## (e.g. shared AUX dir in the sub-package).
245                 am__remove_distdir=: \
246 ## Disable filename length check:
247                 am__skip_length_check=: \
248 ## No need to fix modes more than once:
249                 am__skip_mode_fix=: \
250                 distdir) \
251               || exit 1; \
252           fi; \
253         done
254 endif %?SUBDIRS%
256 ## We might have to perform some last second updates, such as updating
257 ## info files.
258 ## We must explicitly set distdir and top_distdir for these sub-makes.
260 if %?DIST-TARGETS%
261         $(MAKE) $(AM_MAKEFLAGS) \
262           top_distdir="$(top_distdir)" distdir="$(distdir)" \
263           %DIST-TARGETS%
264 endif %?DIST-TARGETS%
266 ## This complex find command will try to avoid changing the modes of
267 ## links into the source tree, in case they're hard-linked.
269 ## Ignore return result from chmod, because it might give an error
270 ## if we chmod a symlink.
272 ## Another nastiness: if the file is unreadable by us, we make it
273 ## readable regardless of the number of links to it.  This only
274 ## happens in perverse cases.
276 ## We use $(install_sh) because that is a known-portable way to modify
277 ## the file in place in the source tree.
279 ## If we are being invoked recursively, then there is no need to walk
280 ## the whole subtree again.  This is a complexity reduction for a deep
281 ## hierarchy of subpackages.
283 if %?TOPDIR_P%
284         -test -n "$(am__skip_mode_fix)" \
285         || find "$(distdir)" -type d ! -perm -755 \
286                 -exec chmod u+rwx,go+rx {} \; -o \
287           ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
288           ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
289           ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
290         || chmod -R a+r "$(distdir)"
291 if %?FILENAME_FILTER%
292         @if test -z "$(am__skip_length_check)" && find "$(distdir)" -type f -print | \
293           grep '^%FILENAME_FILTER%' 1>&2; then \
294           echo 'error: the above filenames are too long' 1>&2; \
295           exit 1; \
296         else :; fi
297 endif %?FILENAME_FILTER%
298 endif %?TOPDIR_P%
302 ## --------------------------------------- ##
303 ## Building various distribution flavors.  ##
304 ## --------------------------------------- ##
306 ## Note that we don't use GNU tar's '-z' option.  One reason (but not
307 ## the only reason) is that some versions of tar (e.g., OSF1)
308 ## interpret '-z' differently.
310 ## The -o option of GNU tar used to exclude empty directories.  This
311 ## behavior was fixed in tar 1.12 (released on 1997-04-25).  But older
312 ## versions of tar are still used (for instance NetBSD 1.6.1 ships
313 ## with tar 1.11.2).  We do not do anything specific w.r.t. this
314 ## incompatibility since packages where empty directories need to be
315 ## present in the archive are really unusual.
317 ## We order DIST_TARGETS by expected duration of the compressors,
318 ## slowest first, for better parallelism in "make dist".  Do not
319 ## reorder DIST_ARCHIVES, users may expect gzip to be first.
321 ## Traditionally, gzip prepended the contents of the GZIP environment
322 ## variable to its arguments, and the commands below formerly used
323 ## this by invoking 'GZIP=$(GZIP_ENV) gzip'.  The GZIP environment
324 ## variable is now considered to be obsolescent, so the commands below
325 ## now use 'eval GZIP= gzip $(GZIP_ENV)' instead; this should work
326 ## with both older and newer gzip implementations.  The 'eval' is to
327 ## support makefile assignments like 'GZIP_ENV = "-9 -n"' that quote
328 ## the GZIP_ENV right-hand side because that was needed with the
329 ## former invocation pattern.
331 if %?TOPDIR_P%
333 ?GZIP?DIST_ARCHIVES += $(distdir).tar.gz
334 GZIP_ENV = -9
335 .PHONY: dist-gzip
336 dist-gzip: distdir
337         tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
338         $(am__post_remove_distdir)
340 ?BZIP2?DIST_ARCHIVES += $(distdir).tar.bz2
341 .PHONY: dist-bzip2
342 dist-bzip2: distdir
343         tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
344         $(am__post_remove_distdir)
346 ?LZIP?DIST_ARCHIVES += $(distdir).tar.lz
347 .PHONY: dist-lzip
348 dist-lzip: distdir
349         tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
350         $(am__post_remove_distdir)
352 ?XZ?DIST_ARCHIVES += $(distdir).tar.xz
353 .PHONY: dist-xz
354 dist-xz: distdir
355         tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
356         $(am__post_remove_distdir)
358 ?ZSTD?DIST_ARCHIVES += $(distdir).tar.zst
359 .PHONY: dist-zstd
360 dist-zstd: distdir
361         tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
362         $(am__post_remove_distdir)
364 ?COMPRESS?DIST_ARCHIVES += $(distdir).tar.Z
365 .PHONY: dist-tarZ
366 dist-tarZ: distdir
367         @echo WARNING: "Support for distribution archives compressed with" \
368                        "legacy program 'compress' is deprecated." >&2
369         @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
370         tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
371         $(am__post_remove_distdir)
373 ?SHAR?DIST_ARCHIVES += $(distdir).shar.gz
374 .PHONY: dist-shar
375 dist-shar: distdir
376         @echo WARNING: "Support for shar distribution archives is" \
377                        "deprecated." >&2
378         @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
379         shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
380         $(am__post_remove_distdir)
382 ?ZIP?DIST_ARCHIVES += $(distdir).zip
383 .PHONY: dist-zip
384 dist-zip: distdir
385         -rm -f $(distdir).zip
386         zip -rq $(distdir).zip $(distdir)
387         $(am__post_remove_distdir)
389 ?LZIP?DIST_TARGETS += dist-lzip
390 ?XZ?DIST_TARGETS += dist-xz
391 ?SHAR?DIST_TARGETS += dist-shar
392 ?BZIP2?DIST_TARGETS += dist-bzip2
393 ?GZIP?DIST_TARGETS += dist-gzip
394 ?ZIP?DIST_TARGETS += dist-zip
395 ?ZSTD?DIST_TARGETS += dist-zstd
396 ?COMPRESS?DIST_TARGETS += dist-tarZ
398 endif %?TOPDIR_P%
402 ## ------------------------------------------------- ##
403 ## Building all the requested distribution flavors.  ##
404 ## ------------------------------------------------- ##
406 ## Currently we cannot use if/endif inside a rule.  The file_contents
407 ## parser needs work.
409 if %?TOPDIR_P%
411 .PHONY: dist dist-all
412 if %?SUBDIRS%
413 AM_RECURSIVE_TARGETS += dist dist-all
414 endif %?SUBDIRS%
416 dist dist-all:
417         $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
418         $(am__post_remove_distdir)
420 endif %?TOPDIR_P%
423 ## ------------------------- ##
424 ## Checking a distribution.  ##
425 ## ------------------------- ##
428 if %?TOPDIR_P%
429 if %?SUBDIRS%
430 AM_RECURSIVE_TARGETS += distcheck
431 endif %?SUBDIRS%
433 # Exists only to be overridden by the user if desired.
434 AM_DISTCHECK_DVI_TARGET = dvi
436 # This target untars the dist file and tries a VPATH configuration.  Then
437 # it guarantees that the distribution is self-contained by making another
438 # tarfile.
439 .PHONY: distcheck
440 distcheck: dist
441         case '$(DIST_ARCHIVES)' in \
442         *.tar.gz*) \
443           eval GZIP= gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
444         *.tar.bz2*) \
445           bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
446         *.tar.lz*) \
447           lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
448         *.tar.xz*) \
449           xz -dc $(distdir).tar.xz | $(am__untar) ;;\
450         *.tar.Z*) \
451           uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
452         *.shar.gz*) \
453           eval GZIP= gzip -dc $(distdir).shar.gz | unshar ;;\
454         *.zip*) \
455           unzip $(distdir).zip ;;\
456         *.tar.zst*) \
457           zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
458         esac
459 ## Make the new source tree read-only.  Distributions ought to work in
460 ## this case.  However, make the top-level directory writable so we
461 ## can make our new subdirs.
462         chmod -R a-w $(distdir)
463         chmod u+w $(distdir)
464         mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
465 ## Undo the write access.
466         chmod a-w $(distdir)
467 ## With GNU make, the following command will be executed even with "make -n",
468 ## due to the presence of '$(MAKE)'.  That is normally all well (and '$(MAKE)'
469 ## is necessary for things like parallel distcheck), but here we don't want
470 ## execution.  To avoid MAKEFLAGS parsing hassles, use a witness file that a
471 ## non-'-n' run would have just created.
472         test -d $(distdir)/_build || exit 0; \
473 ## Compute the absolute path of '_inst'.  Strip any leading DOS drive
474 ## to allow DESTDIR installations.  Otherwise "$(DESTDIR)$(prefix)" would
475 ## expand to "c:/temp/am-dc-5668/c:/src/package/package-1.0/_inst".
476         dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
477 ## We will attempt a DESTDIR install in $dc_destdir.  We don't
478 ## create this directory under $dc_install_base, because it would
479 ## create very long directory names.
480           && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
481 ?DISTCHECK-HOOK?          && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \
482 ## Parallel BSD make may not start a new shell for each command in a recipe,
483 ## so be sure to 'cd' back to the original directory after this.
484           && am__cwd=`pwd` \
485 ## If we merely used '$(distdir)/_build' here, "make distcheck" could
486 ## sometimes fail to detect missing files in the distribution tarball,
487 ## especially in those cases where both the generated files and their
488 ## dependencies are explicitly in $(srcdir).  See automake bug#18286.
489           && $(am__cd) $(distdir)/_build/sub \
490           && ../../configure \
491 ?GETTEXT?           --with-included-gettext \
492 ## Additional flags for configure.
493             $(AM_DISTCHECK_CONFIGURE_FLAGS) \
494             $(DISTCHECK_CONFIGURE_FLAGS) \
495 ## At the moment, the code doesn't actually support changes in these --srcdir
496 ## and --prefix values, so don't allow them to be overridden by the user or
497 ## the developer.  That used to be allowed, and caused issues in practice
498 ## (in corner-case usages); see automake bug#14991.
499             --srcdir=../.. --prefix="$$dc_install_base" \
500           && $(MAKE) $(AM_MAKEFLAGS) \
501           && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \
502           && $(MAKE) $(AM_MAKEFLAGS) check \
503           && $(MAKE) $(AM_MAKEFLAGS) install \
504           && $(MAKE) $(AM_MAKEFLAGS) installcheck \
505           && $(MAKE) $(AM_MAKEFLAGS) uninstall \
506           && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
507                 distuninstallcheck \
508 ## Make sure the package has proper DESTDIR support (we could not test this
509 ## in the previous install/installcheck/uninstall test, because it's reasonable
510 ## for installcheck to fail in a DESTDIR install).
511 ## We make the '$dc_install_base' read-only because this is where files
512 ## with missing DESTDIR support are likely to be installed.
513           && chmod -R a-w "$$dc_install_base" \
514 ## The logic here is quite convoluted because we must clean $dc_destdir
515 ## whatever happens (it won't be erased by the next run of distcheck like
516 ## $(distdir) is).
517           && ({ \
518 ## Build the directory, so we can cd into it even if "make install"
519 ## didn't create it.  Use mkdir, not $(MKDIR_P) because we want to
520 ## fail if the directory already exists (PR/413).
521                (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
522                && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
523                && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
524                && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
525                     distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
526               } || { rm -rf "$$dc_destdir"; exit 1; }) \
527           && rm -rf "$$dc_destdir" \
528           && $(MAKE) $(AM_MAKEFLAGS) dist \
529 ## Make sure to remove the dists we created in the test build directory.
530           && rm -rf $(DIST_ARCHIVES) \
531           && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
532 ## Cater to parallel BSD make (see above).
533           && cd "$$am__cwd" \
534           || exit 1
535         $(am__post_remove_distdir)
536         @(echo "$(distdir) archives ready for distribution: "; \
537           list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
538           sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
540 ## Define distuninstallcheck_listfiles and distuninstallcheck separately
541 ## from distcheck, so that they can be overridden by the user.
542 .PHONY: distuninstallcheck
543 distuninstallcheck_listfiles = find . -type f -print
544 ## The 'dir' file (created by install-info) might still exist after
545 ## uninstall, so we must be prepared to account for it.  The following
546 ## check is not 100% strict, but is definitely good enough, and even
547 ## accounts for overridden $(infodir).
548 am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
549   | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
550 distuninstallcheck:
551         @test -n '$(distuninstallcheck_dir)' || { \
552           echo 'ERROR: trying to run $@ with an empty' \
553                '$$(distuninstallcheck_dir)' >&2; \
554           exit 1; \
555         }; \
556         $(am__cd) '$(distuninstallcheck_dir)' || { \
557           echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
558           exit 1; \
559         }; \
560         test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
561            || { echo "ERROR: files left after uninstall:" ; \
562                 if test -n "$(DESTDIR)"; then \
563                   echo "  (check DESTDIR support)"; \
564                 fi ; \
565                 $(distuninstallcheck_listfiles) ; \
566                 exit 1; } >&2
568 ## Define distcleancheck_listfiles and distcleancheck separately
569 ## from distcheck, so that they can be overridden by the user.
570 .PHONY: distcleancheck
571 distcleancheck_listfiles = \
572   find . \( -type f -a \! \
573             \( -name .nfs* -o -name .smb* -o -name .__afs* \) \) -print
574 distcleancheck: distclean
575         @if test '$(srcdir)' = . ; then \
576           echo "ERROR: distcleancheck can only run from a VPATH build" ; \
577           exit 1 ; \
578         fi
579         @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
580           || { echo "ERROR: files left in build directory after distclean:" ; \
581                $(distcleancheck_listfiles) ; \
582                exit 1; } >&2
583 endif %?TOPDIR_P%