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