"Fossies" - the Fresh Open Source Software Archive

Member "automake-1.16.3/lib/am/distdir.am" (19 Nov 2020, 22698 Bytes) of package /linux/misc/automake-1.16.3.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "distdir.am": 1.16.2_vs_1.16.3.

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