2
0

distdir.am 22 KB

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