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