maint.mk 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. # Maintainer makefile rules for Automake.
  2. #
  3. # Copyright (C) 1995-2017 Free Software Foundation, Inc.
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2, or (at your option)
  8. # any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. # Avoid CDPATH issues.
  18. unexport CDPATH
  19. # Program to use to fetch files from the Net.
  20. WGET = wget
  21. # --------------------------------------------------------- #
  22. # Automatic generation of the ChangeLog from git history. #
  23. # --------------------------------------------------------- #
  24. gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
  25. gitlog_to_changelog_fixes = $(srcdir)/.git-log-fix
  26. gitlog_to_changelog_options = --amend=$(gitlog_to_changelog_fixes) \
  27. --since='2011-12-28 00:00:00' \
  28. --no-cluster --format '%s%n%n%b'
  29. EXTRA_DIST += lib/gitlog-to-changelog
  30. EXTRA_DIST += $(gitlog_to_changelog_fixes)
  31. # When executed from a git checkout, generate the ChangeLog from the git
  32. # history. When executed from an extracted distribution tarball, just
  33. # copy the distributed ChangeLog in the build directory (and if this
  34. # fails, or if no distributed ChangeLog file is present, complain and
  35. # give an error).
  36. #
  37. # The ChangeLog should be regenerated unconditionally when working from
  38. # checked-out sources; otherwise, if we're working from a distribution
  39. # tarball, we expect the ChangeLog to be distributed, so check that it
  40. # is indeed present in the source directory.
  41. ChangeLog:
  42. $(AM_V_GEN)set -e; set -u; \
  43. if test -d $(srcdir)/.git; then \
  44. rm -f $@-t \
  45. && $(gitlog_to_changelog_command) \
  46. $(gitlog_to_changelog_options) >$@-t \
  47. && chmod a-w $@-t \
  48. && mv -f $@-t $@ \
  49. || exit 1; \
  50. elif test ! -f $(srcdir)/$@; then \
  51. echo "Source tree is not a git checkout, and no pre-existent" \
  52. "$@ file has been found there" >&2; \
  53. exit 1; \
  54. fi
  55. .PHONY: ChangeLog
  56. # --------------------------- #
  57. # Perl coverage statistics. #
  58. # --------------------------- #
  59. PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
  60. PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
  61. PERL_COVER = cover
  62. check-coverage-run recheck-coverage-run: %-coverage-run: all
  63. $(MKDIR_P) $(PERL_COVERAGE_DB)
  64. PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
  65. WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
  66. $(MAKE) $*
  67. check-coverage-report:
  68. @if test ! -d "$(PERL_COVERAGE_DB)"; then \
  69. echo "No coverage database found in '$(PERL_COVERAGE_DB)'." >&2; \
  70. echo "Please run \"make check-coverage\" first" >&2; \
  71. exit 1; \
  72. fi
  73. $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
  74. # We don't use direct dependencies here because we'd like to be able
  75. # to invoke the report even after interrupted check-coverage.
  76. check-coverage: check-coverage-run
  77. $(MAKE) check-coverage-report
  78. recheck-coverage: recheck-coverage-run
  79. $(MAKE) check-coverage-report
  80. clean-coverage:
  81. rm -rf "$(PERL_COVERAGE_DB)"
  82. clean-local: clean-coverage
  83. .PHONY: check-coverage recheck-coverage check-coverage-run \
  84. recheck-coverage-run check-coverage-report clean-coverage
  85. # ---------------------------------------------------- #
  86. # Tagging and/or uploading stable and beta releases. #
  87. # ---------------------------------------------------- #
  88. GIT = git
  89. EXTRA_DIST += lib/gnupload
  90. # First component of a version number (mandatory).
  91. rx-0 = ^[1-9][0-9]*
  92. # Later components of a version number (optional).
  93. rx-1 = \.[0-9][0-9]*
  94. # Used in recipes to decide which kind of release we are.
  95. stable_major_version_rx = $(rx-0)\.0$$
  96. stable_minor_version_rx = $(rx-0)$(rx-1)$$
  97. stable_micro_version_rx = $(rx-0)$(rx-1)$(rx-1)$$
  98. beta_version_rx = $(rx-0)($(rx-1)){1,2}[bdfhjlnprtvxz]$$
  99. alpha_version_rx = $(rx-0)($(rx-1)){1,2}[acegikmoqsuwy]$$
  100. match_version = echo "$(VERSION)" | $(EGREP) >/dev/null
  101. # Check that we don't have uncommitted or unstaged changes.
  102. # TODO: Maybe the git suite already offers a shortcut to verify if the
  103. # TODO: working directory is "clean" or not? If yes, use that instead
  104. # TODO: of duplicating the logic here.
  105. git_must_have_clean_workdir = \
  106. $(GIT) rev-parse --verify HEAD >/dev/null \
  107. && $(GIT) update-index -q --refresh \
  108. && $(GIT) diff-files --quiet \
  109. && $(GIT) diff-index --quiet --cached HEAD \
  110. || { echo "$@: you have uncommitted or unstaged changes" >&2; exit 1; }
  111. determine_release_type = \
  112. if $(match_version) '$(stable_major_version_rx)'; then \
  113. release_type='Major release'; \
  114. announcement_type='major release'; \
  115. dest=ftp; \
  116. elif $(match_version) '$(stable_minor_version_rx)'; then \
  117. release_type='Minor release'; \
  118. announcement_type='minor release'; \
  119. dest=ftp; \
  120. elif $(match_version) '$(stable_micro_version_rx)'; then \
  121. release_type='Micro release'; \
  122. announcement_type='maintenance release'; \
  123. dest=ftp; \
  124. elif $(match_version) '$(beta_version_rx)'; then \
  125. release_type='Beta release'; \
  126. announcement_type='test release'; \
  127. dest=alpha; \
  128. elif $(match_version) '$(alpha_version_rx)'; then \
  129. echo "$@: improper version '$(VERSION)' for a release" >&2; \
  130. if test -n '$(strip $(DEVEL_SNAPSHOT))'; then \
  131. echo "$@: continuing anyway since DEVEL_SNAPSHOT is set" >&2; \
  132. release_type='Development snapshot'; \
  133. announcement_type='development snapshot'; \
  134. dest=alpha; \
  135. else \
  136. exit 1; \
  137. fi; \
  138. else \
  139. echo "$@: invalid version number '$(VERSION)'" >&2; \
  140. exit 1; \
  141. fi
  142. # Help the debugging of $(determine_release_type) and related code.
  143. print-release-type:
  144. @$(determine_release_type); \
  145. echo "$$release_type $(VERSION);" \
  146. "it will be announced as a \"$$announcement_type\""
  147. git-tag-release: maintainer-check
  148. @set -e -u; \
  149. case '$(AM_TAG_DRYRUN)' in \
  150. ""|[nN]|[nN]o|NO) run="";; \
  151. *) run="echo Running:";; \
  152. esac; \
  153. $(git_must_have_clean_workdir); \
  154. $$run $(GIT) tag -s "v$(VERSION)" -m "$(PACKAGE) $(VERSION)"
  155. git-upload-release:
  156. @# Check this is a version we can cut a release (either test
  157. @# or stable) from.
  158. @$(determine_release_type)
  159. @# The repository must be clean.
  160. @$(git_must_have_clean_workdir)
  161. @# Check that we are releasing from a valid tag.
  162. @tag=`$(GIT) describe` \
  163. && case $$tag in "v$(VERSION)") true;; *) false;; esac \
  164. || { echo "$@: you can only create a release from a tagged" \
  165. "version" >&2; \
  166. exit 1; }
  167. @# Build the distribution tarball(s).
  168. $(MAKE) dist
  169. @# Upload it to the correct FTP repository.
  170. @$(determine_release_type) \
  171. && dest=$$dest.gnu.org:automake \
  172. && echo "Will upload to $$dest: $(DIST_ARCHIVES)" \
  173. && $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) --to $$dest \
  174. $(DIST_ARCHIVES)
  175. .PHONY: print-release-type git-upload-release git-tag-release
  176. # ------------------------------------------------------------------ #
  177. # Explore differences of autogenerated files in different commits. #
  178. # ------------------------------------------------------------------ #
  179. # Visually comparing differences between the Makefile.in files in
  180. # automake's own build system as generated in two different branches
  181. # might help to catch bugs and blunders. This has already happened a
  182. # few times in the past, when we used to version-control Makefile.in.
  183. autodiffs:
  184. @set -u; \
  185. NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
  186. OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
  187. am_gitdir='$(abs_top_srcdir)/.git'; \
  188. get_autofiles_from_rev () \
  189. { \
  190. rev=$$1 dir=$$2 \
  191. && echo "$@: will get files from revision $$rev" \
  192. && $(GIT) clone -q --depth 1 "$$am_gitdir" tmp \
  193. && cd tmp \
  194. && $(GIT) checkout -q "$$rev" \
  195. && echo "$@: bootstrapping $$rev" \
  196. && $(SHELL) ./bootstrap \
  197. && echo "$@: copying files from $$rev" \
  198. && makefile_ins=`find . -name Makefile.in` \
  199. && (tar cf - configure aclocal.m4 $$makefile_ins) | \
  200. (cd .. && cd "$$dir" && tar xf -) \
  201. && cd .. \
  202. && rm -rf tmp; \
  203. }; \
  204. outdir=$@.dir \
  205. && : Before proceeding, ensure the specified revisions truly exist. \
  206. && $(GIT) --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
  207. && $(GIT) --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
  208. && rm -rf $$outdir \
  209. && mkdir $$outdir \
  210. && cd $$outdir \
  211. && mkdir new old \
  212. && get_autofiles_from_rev $$OLD_COMMIT old \
  213. && get_autofiles_from_rev $$NEW_COMMIT new \
  214. && exit 0
  215. # With lots of eye candy; we like our developers pampered and spoiled :-)
  216. compare-autodiffs: autodiffs
  217. @set -u; \
  218. : $${COLORDIFF=colordiff} $${DIFF=diff}; \
  219. dir=autodiffs.dir; \
  220. if test ! -d "$$dir"; then \
  221. echo "$@: $$dir: Not a directory" >&2; \
  222. exit 1; \
  223. fi; \
  224. mydiff=false mypager=false; \
  225. if test -t 1; then \
  226. if ($$COLORDIFF -r . .) </dev/null >/dev/null 2>&1; then \
  227. mydiff=$$COLORDIFF; \
  228. mypager="less -R"; \
  229. else \
  230. mypager=less; \
  231. fi; \
  232. else \
  233. mypager=cat; \
  234. fi; \
  235. if test "$$mydiff" = false; then \
  236. if ($$DIFF -r -u . .); then \
  237. mydiff=$$DIFF; \
  238. else \
  239. echo "$@: no good-enough diff program specified" >&2; \
  240. exit 1; \
  241. fi; \
  242. fi; \
  243. st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
  244. rm -rf $$dir; \
  245. exit $$st
  246. .PHONY: autodiffs compare-autodiffs
  247. # ---------------------------------------------- #
  248. # Help writing the announcement for a release. #
  249. # ---------------------------------------------- #
  250. PACKAGE_MAILINGLIST = automake@gnu.org
  251. announcement: DEVEL_SNAPSHOT = yes
  252. announcement: NEWS
  253. $(AM_V_GEN): \
  254. && rm -f $@ $@-t \
  255. && $(determine_release_type) \
  256. && ftp_base="ftp://$$dest.gnu.org/gnu/$(PACKAGE)" \
  257. && X () { printf '%s\n' "$$*" >> $@-t; } \
  258. && X "We are pleased to announce the $(PACKAGE_NAME) $(VERSION)" \
  259. "$$announcement_type." \
  260. && X \
  261. && X "**TODO** Brief description of the release here." \
  262. && X \
  263. && X "**TODO** This description can span multiple paragraphs." \
  264. && X \
  265. && X "See below for the detailed list of changes since the" \
  266. && X "previous version, as summarized by the NEWS file." \
  267. && X \
  268. && X "Download here:" \
  269. && X \
  270. && X " $$ftp_base/$(PACKAGE)-$(VERSION).tar.gz" \
  271. && X " $$ftp_base/$(PACKAGE)-$(VERSION).tar.xz" \
  272. && X \
  273. && X "Please report bugs and problems to" \
  274. "<$(PACKAGE_BUGREPORT)>," \
  275. && X "and send general comments and feedback to" \
  276. "<$(PACKAGE_MAILINGLIST)>." \
  277. && X \
  278. && X "Thanks to everyone who has reported problems, contributed" \
  279. && X "patches, and helped testing Automake!" \
  280. && X \
  281. && X "-*-*-*-" \
  282. && X \
  283. && $(AWK) '\
  284. ($$0 ~ /^New in .*:/) { wait_for_end=1; } \
  285. (/^~~~/ && wait_for_end) { print; exit(0) } \
  286. { print } \
  287. ' <$(srcdir)/NEWS >> $@-t \
  288. && mv -f $@-t $@
  289. .PHONY: announcement
  290. CLEANFILES += announcement
  291. # --------------------------------------------------------------------- #
  292. # Synchronize third-party files that are committed in our repository. #
  293. # --------------------------------------------------------------------- #
  294. # Git repositories on Savannah.
  295. git-sv-host = git.savannah.gnu.org
  296. # Some repositories we sync files from.
  297. SV_GIT_CF = 'https://$(git-sv-host)/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
  298. SV_GIT_GL = 'https://$(git-sv-host)/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
  299. # Files that we fetch and which we compare against.
  300. # Note that the 'lib/COPYING' file must still be synced by hand.
  301. FETCHFILES = \
  302. $(SV_GIT_CF)config.guess \
  303. $(SV_GIT_CF)config.sub \
  304. $(SV_GIT_GL)build-aux/texinfo.tex \
  305. $(SV_GIT_GL)build-aux/gendocs.sh \
  306. $(SV_GIT_GL)build-aux/gitlog-to-changelog \
  307. $(SV_GIT_GL)build-aux/gnupload \
  308. $(SV_GIT_GL)build-aux/update-copyright \
  309. $(SV_GIT_GL)doc/gendocs_template \
  310. $(SV_GIT_GL)doc/INSTALL
  311. # Fetch the latest versions of few scripts and files we care about.
  312. # A retrieval failure or a copying failure usually mean serious problems,
  313. # so we'll just bail out if 'wget' or 'cp' fail.
  314. fetch:
  315. $(AM_V_at)rm -rf Fetchdir
  316. $(AM_V_at)mkdir Fetchdir
  317. $(AM_V_GEN)set -e; \
  318. if $(AM_V_P); then wget_opts=; else wget_opts=-nv; fi; \
  319. for url in $(FETCHFILES); do \
  320. file=`printf '%s\n' "$$url" | sed 's|^.*/||; s|^.*=||'`; \
  321. $(WGET) $$wget_opts "$$url" -O Fetchdir/$$file || exit 1; \
  322. if cmp Fetchdir/$$file $(srcdir)/lib/$$file >/dev/null; then \
  323. : Nothing to do; \
  324. else \
  325. echo "$@: updating file $$file"; \
  326. cp Fetchdir/$$file $(srcdir)/lib/$$file || exit 1; \
  327. fi; \
  328. done
  329. $(AM_V_at)rm -rf Fetchdir
  330. .PHONY: fetch
  331. # ---------------------------------------------------------------------- #
  332. # Generate and upload manuals in several formats, for the GNU website. #
  333. # ---------------------------------------------------------------------- #
  334. web_manual_dir = doc/web-manual
  335. RSYNC = rsync
  336. CVS = cvs
  337. CVSU = cvsu
  338. CVS_USER = $${USER}
  339. WEBCVS_ROOT = cvs.savannah.gnu.org:/web
  340. CVS_RSH = ssh
  341. export CVS_RSH
  342. .PHONY: web-manual web-manual-update
  343. web-manual web-manual-update: t = $@.dir
  344. # Build manual in several formats. Note to the recipe:
  345. # 1. The symlinking of automake.texi into the temporary directory is
  346. # required to pacify extra checks from gendocs.sh.
  347. # 2. The redirection to /dev/null before the invocation of gendocs.sh
  348. # is done to better respect silent rules.
  349. web-manual:
  350. $(AM_V_at)rm -rf $(web_manual_dir) $t
  351. $(AM_V_at)mkdir $t
  352. $(AM_V_at)$(LN_S) '$(abs_srcdir)/doc/$(PACKAGE).texi' '$t/'
  353. $(AM_V_GEN)cd $t \
  354. && GENDOCS_TEMPLATE_DIR='$(abs_srcdir)/lib' \
  355. && export GENDOCS_TEMPLATE_DIR \
  356. && if $(AM_V_P); then :; else exec >/dev/null 2>&1; fi \
  357. && $(SHELL) '$(abs_srcdir)/lib/gendocs.sh' \
  358. -I '$(abs_srcdir)/doc' --email $(PACKAGE_BUGREPORT) \
  359. $(PACKAGE) '$(PACKAGE_NAME)'
  360. $(AM_V_at)mkdir $(web_manual_dir)
  361. $(AM_V_at)mv -f $t/manual/* $(web_manual_dir)
  362. $(AM_V_at)rm -rf $t
  363. @! $(AM_V_P) || ls -l $(web_manual_dir)
  364. # Upload manual to www.gnu.org, using CVS (sigh!)
  365. web-manual-update:
  366. $(AM_V_at)$(determine_release_type); \
  367. case $$release_type in \
  368. [Mm]ajor\ release|[Mm]inor\ release|[Mm]icro\ release);; \
  369. *) echo "Cannot upload manuals from a \"$$release_type\"" >&2; \
  370. exit 1;; \
  371. esac
  372. $(AM_V_at)test -f $(web_manual_dir)/$(PACKAGE).html || { \
  373. echo 'You have to run "$(MAKE) web-manual" before' \
  374. 'invoking "$(MAKE) $@"' >&2; \
  375. exit 1; \
  376. }
  377. $(AM_V_at)rm -rf $t
  378. $(AM_V_at)mkdir $t
  379. $(AM_V_at)cd $t \
  380. && $(CVS) -z3 -d :ext:$(CVS_USER)@$(WEBCVS_ROOT)/$(PACKAGE) \
  381. co $(PACKAGE)
  382. @# According to the rsync manpage, "a trailing slash on the
  383. @# source [...] avoids creating an additional directory
  384. @# level at the destination". So the trailing '/' after
  385. @# '$(web_manual_dir)' below is intended.
  386. $(AM_V_at)$(RSYNC) -avP $(web_manual_dir)/ $t/$(PACKAGE)/manual
  387. $(AM_V_GEN): \
  388. && cd $t/$(PACKAGE)/manual \
  389. && new_files=`$(CVSU) --types='?'` \
  390. && new_files=`echo "$$new_files" | sed s/^..//` \
  391. && { test -z "$$new_files" || $(CVS) add -ko $$new_files; } \
  392. && $(CVS) ci -m $(VERSION)
  393. $(AM_V_at)rm -rf $t
  394. .PHONY: web-manual-update
  395. clean-web-manual:
  396. $(AM_V_at)rm -rf $(web_manual_dir)
  397. .PHONY: clean-web-manual
  398. clean-local: clean-web-manual
  399. EXTRA_DIST += lib/gendocs.sh lib/gendocs_template
  400. # ------------------------------------------------ #
  401. # Update copyright years of all committed files. #
  402. # ------------------------------------------------ #
  403. EXTRA_DIST += lib/update-copyright
  404. update_copyright_env = \
  405. UPDATE_COPYRIGHT_FORCE=1 \
  406. UPDATE_COPYRIGHT_USE_INTERVALS=2
  407. # In addition to the several README files, these as well are
  408. # not expected to have a copyright notice.
  409. files_without_copyright = \
  410. .autom4te.cfg \
  411. .git-log-fix \
  412. .gitattributes \
  413. .gitignore \
  414. INSTALL \
  415. COPYING \
  416. AUTHORS \
  417. THANKS \
  418. lib/INSTALL \
  419. lib/COPYING
  420. # This script is in the public domain.
  421. files_without_copyright += lib/mkinstalldirs
  422. # This script has an MIT-style license
  423. files_without_copyright += lib/install-sh
  424. # The UPDATE_COPYRIGHT_YEAR environment variable is honoured by the
  425. # 'lib/update-copyright' script.
  426. .PHONY: update-copyright
  427. update-copyright:
  428. $(AM_V_GEN)set -e; \
  429. if test -n "$$UPDATE_COPYRIGHT_YEAR"; then \
  430. current_year=$$UPDATE_COPYRIGHT_YEAR; \
  431. else \
  432. current_year=`date +%Y` && test -n "$$current_year" \
  433. || { echo "$@: cannot get current year" >&2; exit 1; }; \
  434. fi; \
  435. sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" \
  436. bootstrap configure.ac; \
  437. excluded_re=`( \
  438. for url in $(FETCHFILES); do echo "$$url"; done \
  439. | sed -e 's!^.*/!!' -e 's!^.*=!!' -e 's!^!lib/!' \
  440. && for f in $(files_without_copyright); do echo $$f; done \
  441. ) | sed -e '$$!s,$$,|,' | tr -d '\012\015'`; \
  442. $(GIT) ls-files \
  443. | grep -Ev '(^|/)README$$' \
  444. | grep -Ev '^PLANS(/|$$)' \
  445. | grep -Ev "^($$excluded_re)$$" \
  446. | $(update_copyright_env) xargs $(srcdir)/lib/$@
  447. # -------------------------------------------------------------- #
  448. # Run the testsuite with the least supported autoconf version. #
  449. # -------------------------------------------------------------- #
  450. gnu-ftp = http://ftp.gnu.org/gnu
  451. # Various shorthands: version, name, package name, tarball name,
  452. # tarball location, installation directory.
  453. ac-v = $(required_autoconf_version)
  454. ac-n = autoconf
  455. ac-p = $(ac-n)-$(ac-v)
  456. ac-t = $(ac-p).tar.gz
  457. ac-l = maintainer/$(ac-t)
  458. ac-d = maintainer/$(ac-p)
  459. fetch-minimal-autoconf: o = $(ac-l)
  460. fetch-minimal-autoconf:
  461. $(AM_V_at)$(MKDIR_P) $(dir $o)
  462. $(AM_V_at)rm -f $o $o-t
  463. $(AM_V_GEN)$(WGET) -O $o-t $(gnu-ftp)/$(ac-n)/$(ac-t)
  464. $(AM_V_at)chmod a-w $o-t && mv -f $o-t $o && ls -l $o
  465. .PHONY: fetch-minimal-autoconf
  466. build-minimal-autoconf:
  467. $(AM_V_GEN):; \
  468. test -f $(ac-l) || { \
  469. echo "$@: tarball $(ac-l) seems missing." >&2; \
  470. echo "$@: have you run '$(MAKE) fetch-minimal-autoconf'?" >&2; \
  471. exit 1; \
  472. }; \
  473. set -x \
  474. && $(PERL) $(srcdir)/t/ax/deltree.pl $(ac-d) \
  475. && $(MKDIR_P) $(ac-d) \
  476. && cd $(ac-d) \
  477. && tar xzf '$(CURDIR)/$(ac-l)' \
  478. && mv $(ac-p) src \
  479. && mkdir build \
  480. && cd build \
  481. && env CONFIG_SHELL='$(SHELL)' $(SHELL) ../src/configure \
  482. --prefix='$(CURDIR)/$(ac-d)' CONFIG_SHELL='$(SHELL)' \
  483. && $(MAKE) install
  484. $(AM_V_at)echo ' ======' && $(ac-d)/bin/autoconf --version
  485. .PHONY: build-minimal-autoconf
  486. check-minimal-autoconf:
  487. $(AM_V_at)p='$(ac-d)/bin/autoconf'; \
  488. if test ! -f "$$p" || test ! -x "$$p"; then \
  489. echo "$@: program '$$p' seems missing." >&2; \
  490. echo "$@: have you run '$(MAKE) build-minimal-autoconf'?" >&2; \
  491. exit 1; \
  492. fi
  493. $(AM_V_GEN): \
  494. && PATH='$(CURDIR)/$(ac-d)/bin$(PATH_SEPARATOR)'$$PATH \
  495. && export PATH \
  496. && AUTOCONF=autoconf \
  497. && AUTOHEADER=autoheader \
  498. && AUTORECONF=autoreconf \
  499. && AUTOM4TE=autom4te \
  500. && AUTOUPDATE=autoupdate \
  501. && export AUTOCONF AUTOHEADER AUTORECONF AUTOM4TE AUTOUPDATE \
  502. && echo === check autoconf version '(must be = $(ac-v))' \
  503. && autoconf --version \
  504. && autoconf --version | sed -e 's/^/ /; s/$$/ /' -e 1q \
  505. | $(FGREP) '$(ac-v)' >/dev/null \
  506. && echo === configure \
  507. && $(srcdir)/configure $(shell ./config.status --config) \
  508. && echo === build and test \
  509. && $(MAKE) check
  510. .PHONY: check-minimal-autoconf
  511. # --------------------------------------------------------------- #
  512. # Testing on real-world packages can help us avoid regressions. #
  513. # --------------------------------------------------------------- #
  514. #
  515. # NOTE (from Stefano Lattarini):
  516. #
  517. # This section is mostly hacky and ad-hoc, but works for me and
  518. # on my system. And while far from clean, it should help catching
  519. # real regressions on real world packages, which is important.
  520. # Ideas about how to improve this and make it more generic, portable,
  521. # clean, etc., are welcome.
  522. #
  523. # Tiny sample package.
  524. FEW_PACKAGES += hello
  525. # Smallish package using recursive make setup.
  526. FEW_PACKAGES += make
  527. # Medium-size package using non-recursive make setup.
  528. FEW_PACKAGES += coreutils
  529. ALL_PACKAGES = \
  530. $(FEW_PACKAGES) \
  531. autoconf \
  532. bison \
  533. grep \
  534. tar \
  535. diffutils \
  536. smalltalk
  537. pkg-targets = check dist
  538. # Note: "ttp" stays for "Third Party Package".
  539. ttp-check ttp-check-all: do-clone = $(GIT) clone --verbose
  540. ttp-check: ttp-packages = $(FEW_PACKAGES)
  541. ttp-check-all: ttp-packages = $(ALL_PACKAGES)
  542. # Note: some packages depend on pkg-config, and its provided macros.
  543. ttp-check ttp-check-all: t/pkg-config-macros.log
  544. @set -e; \
  545. $(setup_autotools_paths); \
  546. skip_all_ () \
  547. { \
  548. echo "***" >&2; \
  549. echo "*** $@: WARNING: $$@" >&2; \
  550. echo "*** $@: WARNING: some packages might fail to bootstrap" >&2; \
  551. echo "***" >&2; \
  552. }; \
  553. . t/pkg-config-macros.dir/get.sh || exit 1; \
  554. mkdir $@.d && cd $@.d || exit 1; \
  555. for p in $(ttp-packages); do \
  556. echo; \
  557. echo ======== BEGIN TTP $$p =========; \
  558. echo; \
  559. set -x; \
  560. $(do-clone) git://$(git-sv-host)/$$p.git || exit 1; \
  561. ( \
  562. cd $$p \
  563. && ls -l \
  564. && if test -f bootstrap; then \
  565. ./bootstrap --no-git; \
  566. else \
  567. $$AUTORECONF -fvi; \
  568. fi \
  569. && ./configure \
  570. && if test $$p = make; then \
  571. $(MAKE) update; \
  572. else :; fi \
  573. && for t in $(pkg-targets); do \
  574. $(MAKE) $$t WERROR_CFLAGS= || exit 1; \
  575. done \
  576. ) || exit 1; \
  577. set +x; \
  578. echo; \
  579. echo ======== END TTP $$p =========; \
  580. echo; \
  581. done
  582. ifndef keep-ttp-dir
  583. rm -rf $@.d
  584. endif
  585. # Alias for lazy typists.
  586. ttp: ttp-check
  587. ttp-all: ttp-check-all
  588. .PHONY: ttp ttp-check ttp-all ttp-check-all