tests: don't list a removed tests in XFAIL_TESTS
[automake.git] / maint.mk
blob97bbf9b16fb09a6f9cdb5943d1fe88aeab15592e
1 # Maintainer makefile rules for Automake.
3 # Copyright (C) 1995-2012 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 <http://www.gnu.org/licenses/>.
18 # Avoid CDPATH issues.
19 unexport CDPATH
21 # --------------------------------------------------------- #
22 # Automatic generation of the ChangeLog from git history. #
23 # --------------------------------------------------------- #
25 gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
26 gitlog_to_changelog_fixes = $(srcdir)/.git-log-fix
27 gitlog_to_changelog_options = --amend=$(gitlog_to_changelog_fixes) \
28 --since='2011-12-28 00:00:00' \
29 --no-cluster --format '%s%n%n%b'
31 EXTRA_DIST += lib/gitlog-to-changelog
32 EXTRA_DIST += $(gitlog_to_changelog_fixes)
34 # When executed from a git checkout, generate the ChangeLog from the git
35 # history. When executed from an extracted distribution tarball, just
36 # copy the distributed ChangeLog in the build directory (and if this
37 # fails, or if no distributed ChangeLog file is present, complain and
38 # give an error).
40 # The ChangeLog should be regenerated unconditionally when working from
41 # checked-out sources; otherwise, if we're working from a distribution
42 # tarball, we expect the ChangeLog to be distributed, so check that it
43 # is indeed present in the source directory.
44 ChangeLog:
45 $(AM_V_GEN)set -e; set -u; \
46 if test -d $(srcdir)/.git; then \
47 rm -f $@-t \
48 && $(gitlog_to_changelog_command) \
49 $(gitlog_to_changelog_options) >$@-t \
50 && chmod a-w $@-t \
51 && mv -f $@-t $@ \
52 || exit 1; \
53 elif test ! -f $(srcdir)/$@; then \
54 echo "Source tree is not a git checkout, and no pre-existent" \
55 "$@ file has been found there" >&2; \
56 exit 1; \
58 .PHONY: ChangeLog
61 # --------------------------- #
62 # Perl coverage statistics. #
63 # --------------------------- #
65 PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
66 PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
67 PERL_COVER = cover
69 check-coverage-run recheck-coverage-run: %-coverage-run: all
70 $(MKDIR_P) $(PERL_COVERAGE_DB)
71 PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
72 WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
73 $(MAKE) $*
75 check-coverage-report:
76 @if test ! -d "$(PERL_COVERAGE_DB)"; then \
77 echo "No coverage database found in '$(PERL_COVERAGE_DB)'." >&2; \
78 echo "Please run \"make check-coverage\" first" >&2; \
79 exit 1; \
81 $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
83 # We don't use direct dependencies here because we'd like to be able
84 # to invoke the report even after interrupted check-coverage.
85 check-coverage: check-coverage-run
86 $(MAKE) check-coverage-report
88 recheck-coverage: recheck-coverage-run
89 $(MAKE) check-coverage-report
91 clean-coverage:
92 rm -rf "$(PERL_COVERAGE_DB)"
93 clean-local: clean-coverage
95 .PHONY: check-coverage recheck-coverage check-coverage-run \
96 recheck-coverage-run check-coverage-report clean-coverage
99 # ---------------------------------------------------- #
100 # Tagging and/or uploading stable and beta releases. #
101 # ---------------------------------------------------- #
103 GIT = git
105 EXTRA_DIST += lib/gnupload
107 base_version_rx = ^[1-9][0-9]*\.[0-9][0-9]*
108 stable_major_version_rx = $(base_version_rx)$$
109 stable_minor_version_rx = $(base_version_rx)\.[0-9][0-9]*$$
110 beta_version_rx = $(base_version_rx)(\.[0-9][0-9]*)?[bdfhjlnprtvxz]$$
111 match_version = echo "$(VERSION)" | $(EGREP) >/dev/null
113 # Check that we don't have uncommitted or unstaged changes.
114 # TODO: Maybe the git suite already offers a shortcut to verify if the
115 # TODO: working directory is "clean" or not? If yes, use that instead
116 # TODO: of duplicating the logic here.
117 git_must_have_clean_workdir = \
118 $(GIT) rev-parse --verify HEAD >/dev/null \
119 && $(GIT) update-index -q --refresh \
120 && $(GIT) diff-files --quiet \
121 && $(GIT) diff-index --quiet --cached HEAD \
122 || { echo "$@: you have uncommitted or unstaged changes" >&2; exit 1; }
124 determine_release_type = \
125 if $(match_version) '$(stable_major_version_rx)'; then \
126 release_type='Major release'; \
127 announcement_type='major release'; \
128 dest=ftp; \
129 elif $(match_version) '$(stable_minor_version_rx)'; then \
130 release_type='Minor release'; \
131 announcement_type='maintenance release'; \
132 dest=ftp; \
133 elif $(match_version) '$(beta_version_rx)'; then \
134 release_type='Beta release'; \
135 announcement_type='test release'; \
136 dest=alpha; \
137 else \
138 echo "$@: invalid version '$(VERSION)' for a release" >&2; \
139 exit 1; \
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"
148 git-tag-release: maintainer-check
149 @set -e -u; \
150 case '$(AM_TAG_DRYRUN)' in \
151 ""|[nN]|[nN]o|NO) run="";; \
152 *) run="echo Running:";; \
153 esac; \
154 $(determine_release_type); \
155 $(git_must_have_clean_workdir); \
156 $$run $(GIT) tag -s "v$(VERSION)" -m "$$release_type $(VERSION)"
158 git-upload-release:
159 @# Check this is a version we can cut a release (either test
160 @# or stable) from.
161 @$(determine_release_type)
162 @# The repository must be clean.
163 @$(git_must_have_clean_workdir)
164 @# Check that we are releasing from a valid tag.
165 @tag=`$(GIT) describe` \
166 && case $$tag in "v$(VERSION)") true;; *) false;; esac \
167 || { echo "$@: you can only create a release from a tagged" \
168 "version" >&2; \
169 exit 1; }
170 @# Build the distribution tarball(s).
171 $(MAKE) dist
172 @# Upload it to the correct FTP repository.
173 @$(determine_release_type) \
174 && dest=$$dest.gnu.org:automake \
175 && echo "Will upload to $$dest: $(DIST_ARCHIVES)" \
176 && $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) --to $$dest \
177 $(DIST_ARCHIVES)
179 .PHONY: print-release-type git-upload-release git-tag-release
182 # ------------------------------------------------------------------ #
183 # Explore differences of autogenerated files in different commits. #
184 # ------------------------------------------------------------------ #
186 # Visually comparing differences between the Makefile.in files in
187 # automake's own build system as generated in two different branches
188 # might help to catch bugs and blunders. This has already happened a
189 # few times in the past, when we used to version-control Makefile.in.
190 autodiffs:
191 @set -u; \
192 NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
193 OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
194 am_gitdir='$(abs_top_srcdir)/.git'; \
195 get_autofiles_from_rev () \
197 rev=$$1 dir=$$2 \
198 && echo "$@: will get files from revision $$rev" \
199 && $(GIT) clone -q --depth 1 "$$am_gitdir" tmp \
200 && cd tmp \
201 && $(GIT) checkout -q "$$rev" \
202 && echo "$@: bootstrapping $$rev" \
203 && $(SHELL) ./bootstrap.sh \
204 && echo "$@: copying files from $$rev" \
205 && makefile_ins=`find . -name Makefile.in` \
206 && (tar cf - configure aclocal.m4 $$makefile_ins) | \
207 (cd .. && cd "$$dir" && tar xf -) \
208 && cd .. \
209 && rm -rf tmp; \
210 }; \
211 outdir=$@.dir \
212 && : Before proceeding, ensure the specified revisions truly exist. \
213 && $(GIT) --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
214 && $(GIT) --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
215 && rm -rf $$outdir \
216 && mkdir $$outdir \
217 && cd $$outdir \
218 && mkdir new old \
219 && get_autofiles_from_rev $$OLD_COMMIT old \
220 && get_autofiles_from_rev $$NEW_COMMIT new \
221 && exit 0
223 # With lots of eye candy; we like our developers pampered and spoiled :-)
224 compare-autodiffs: autodiffs
225 @set -u; \
226 : $${COLORDIFF=colordiff} $${DIFF=diff}; \
227 dir=autodiffs.dir; \
228 if test ! -d "$$dir"; then \
229 echo "$@: $$dir: Not a directory" >&2; \
230 exit 1; \
231 fi; \
232 mydiff=false mypager=false; \
233 if test -t 1; then \
234 if ($$COLORDIFF -r . .) </dev/null >/dev/null 2>&1; then \
235 mydiff=$$COLORDIFF; \
236 mypager="less -R"; \
237 else \
238 mypager=less; \
239 fi; \
240 else \
241 mypager=cat; \
242 fi; \
243 if test "$$mydiff" = false; then \
244 if ($$DIFF -r -u . .); then \
245 mydiff=$$DIFF; \
246 else \
247 echo "$@: no good-enough diff program specified" >&2; \
248 exit 1; \
249 fi; \
250 fi; \
251 st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
252 rm -rf $$dir; \
253 exit $$st
254 .PHONY: autodiffs compare-autodiffs
256 # ---------------------------------------------- #
257 # Help writing the announcement for a release. #
258 # ---------------------------------------------- #
260 PACKAGE_MAILINGLIST = automake@gnu.org
262 announcement: NEWS
263 $(AM_V_GEN): \
264 && rm -f $@ $@-t \
265 && $(determine_release_type) \
266 && ftp_base="ftp://$$dest.gnu.org/gnu/$(PACKAGE)" \
267 && X () { printf '%s\n' "$$*" >> $@-t; } \
268 && X "We are pleased to announce the $(PACKAGE_NAME) $(VERSION)" \
269 "$$announcement_type." \
270 && X \
271 && X "**TODO** Brief description of the release here." \
272 && X \
273 && X "**TODO** This description can span multiple paragraphs." \
274 && X \
275 && X "See below for the detailed list of changes since the" \
276 && X "previous version, as summarized by the NEWS file." \
277 && X \
278 && X "Download here:" \
279 && X \
280 && X " $$ftp_base/$(PACKAGE)-$(VERSION).tar.gz" \
281 && X " $$ftp_base/$(PACKAGE)-$(VERSION).tar.xz" \
282 && X \
283 && X "Please report bugs and problems to" \
284 "<$(PACKAGE_BUGREPORT)>," \
285 && X "and send general comments and feedback to" \
286 "<$(PACKAGE_MAILINGLIST)>." \
287 && X \
288 && X "Thanks to everyone who has reported problems, contributed" \
289 && X "patches, and helped testing Automake!" \
290 && X \
291 && X "-*-*-*-" \
292 && X \
293 && sed -n -e '/^~~~/q' -e p $(srcdir)/NEWS >> $@-t \
294 && mv -f $@-t $@
295 .PHONY: announcement
296 CLEANFILES += announcement
298 # --------------------------------------------------------------------- #
299 # Synchronize third-party files that are committed in our repository. #
300 # --------------------------------------------------------------------- #
302 # Program to use to fetch files.
303 WGET = wget
305 # Some repositories we sync files from.
306 SV_CVS = 'http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/'
307 SV_GIT_CF = 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
308 SV_GIT_AC = 'http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
309 SV_GIT_GL = 'http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
311 # Files that we fetch and which we compare against.
312 # Note that the 'lib/COPYING' file must still be synced by hand.
313 FETCHFILES = \
314 $(SV_GIT_CF)config.guess \
315 $(SV_GIT_CF)config.sub \
316 $(SV_CVS)texinfo/texinfo/doc/texinfo.tex \
317 $(SV_CVS)texinfo/texinfo/util/gendocs.sh \
318 $(SV_CVS)texinfo/texinfo/util/gendocs_template \
319 $(SV_GIT_GL)build-aux/gitlog-to-changelog \
320 $(SV_GIT_GL)build-aux/gnupload \
321 $(SV_GIT_GL)build-aux/update-copyright \
322 $(SV_GIT_GL)doc/INSTALL
324 # Fetch the latest versions of few scripts and files we care about.
325 # A retrieval failure or a copying failure usually mean serious problems,
326 # so we'll just bail out if 'wget' or 'cp' fail.
327 fetch:
328 $(AM_V_at)rm -rf Fetchdir
329 $(AM_V_at)mkdir Fetchdir
330 $(AM_V_GEN)set -e; \
331 if $(AM_V_P); then wget_opts=; else wget_opts=-nv; fi; \
332 for url in $(FETCHFILES); do \
333 file=`printf '%s\n' "$$url" | sed 's|^.*/||; s|^.*=||'`; \
334 $(WGET) $$wget_opts "$$url" -O Fetchdir/$$file || exit 1; \
335 if cmp Fetchdir/$$file $(srcdir)/lib/$$file >/dev/null; then \
336 : Nothing to do; \
337 else \
338 echo "$@: updating file $$file"; \
339 cp Fetchdir/$$file $(srcdir)/lib/$$file || exit 1; \
340 fi; \
341 done
342 $(AM_V_at)rm -rf Fetchdir
343 .PHONY: fetch
345 # ---------------------------------------------------------------------- #
346 # Generate and upload manuals in several formats, for the GNU website. #
347 # ---------------------------------------------------------------------- #
349 web_manual_dir = doc/web-manual
351 RSYNC = rsync
352 CVS = cvs
353 CVSU = cvsu
354 CVS_USER = $${USER}
355 WEBCVS_ROOT = cvs.savannah.gnu.org:/web
356 CVS_RSH = ssh
357 export CVS_RSH
359 .PHONY: web-manual web-manual-update
360 web-manual web-manual-update: t = $@.dir
362 # Build manual in several formats. Note to the recipe:
363 # 1. The symlinking of automake.texi into the temporary directory is
364 # required to pacify extra checks from gendocs.sh.
365 # 2. The redirection to /dev/null before the invocation of gendocs.sh
366 # is done to better respect silent rules.
367 web-manual:
368 $(AM_V_at)rm -rf $(web_manual_dir) $t
369 $(AM_V_at)mkdir $t
370 $(AM_V_at)$(LN_S) '$(abs_srcdir)/doc/$(PACKAGE).texi' '$t/'
371 $(AM_V_GEN)cd $t \
372 && GENDOCS_TEMPLATE_DIR='$(abs_srcdir)/lib' \
373 && export GENDOCS_TEMPLATE_DIR \
374 && if $(AM_V_P); then :; else exec >/dev/null 2>&1; fi \
375 && $(SHELL) '$(abs_srcdir)/lib/gendocs.sh' \
376 -I '$(abs_srcdir)/doc' --email $(PACKAGE_BUGREPORT) \
377 $(PACKAGE) '$(PACKAGE_NAME)'
378 $(AM_V_at)mkdir $(web_manual_dir)
379 $(AM_V_at)mv -f $t/manual/* $(web_manual_dir)
380 $(AM_V_at)rm -rf $t
381 @! $(AM_V_P) || ls -l $(web_manual_dir)
383 # Upload manual to www.gnu.org, using CVS (sigh!)
384 web-manual-update:
385 $(AM_V_at)$(determine_release_type); \
386 case $$release_type in \
387 [Mm]ajor\ release|[Mm]inor\ release);; \
388 *) echo "Cannot upload manuals from a \"$$release_type\"" >&2; \
389 exit 1;; \
390 esac
391 $(AM_V_at)test -f $(web_manual_dir)/$(PACKAGE).html || { \
392 echo 'You have to run "$(MAKE) web-manuals" before' \
393 'invoking "$(MAKE) $@"' >&2; \
394 exit 1; \
396 $(AM_V_at)rm -rf $t
397 $(AM_V_at)mkdir $t
398 $(AM_V_at)cd $t \
399 && $(CVS) -z3 -d :ext:$(CVS_USER)@$(WEBCVS_ROOT)/$(PACKAGE) \
400 co $(PACKAGE)
401 @# According to the rsync manpage, "a trailing slash on the
402 @# source [...] avoids creating an additional directory
403 @# level at the destination". So the trailing '/' after
404 @# '$(web_manual_dir)' below is intended.
405 $(AM_V_at)$(RSYNC) -avP $(web_manual_dir)/ $t/$(PACKAGE)/manual
406 $(AM_V_GEN): \
407 && cd $t/$(PACKAGE)/manual \
408 && new_files=`$(CVSU) --types='?'` \
409 && new_files=`echo "$$new_files" | sed s/^..//` \
410 && { test -z "$$new_files" || $(CVS) add -ko $$new_files; } \
411 && $(CVS) ci -m $(VERSION)
412 $(AM_V_at)rm -rf $t
413 .PHONY: web-manual-update
415 clean-web-manual:
416 $(AM_V_at)rm -rf $(web_manual_dir)
417 .PHONY: clean-web-manual
418 clean-local: clean-web-manual
420 EXTRA_DIST += lib/gendocs.sh lib/gendocs_template
422 # ------------------------------------------------ #
423 # Update copyright years of all committed files. #
424 # ------------------------------------------------ #
426 EXTRA_DIST += lib/update-copyright
428 update_copyright_env = \
429 UPDATE_COPYRIGHT_FORCE=1 \
430 UPDATE_COPYRIGHT_USE_INTERVALS=2
432 # In addition to the several README files, these as well are
433 # not expected to have a copyright notice.
434 files_without_copyright = \
435 .autom4te.cfg \
436 .git-log-fix \
437 .gitattributes \
438 .gitignore \
439 INSTALL \
440 COPYING \
441 AUTHORS \
442 THANKS \
443 lib/INSTALL \
444 lib/COPYING
446 # This script is in the public domain.
447 files_without_copyright += lib/mkinstalldirs
449 # This script has an MIT-style license
450 files_without_copyright += lib/install-sh
452 .PHONY: update-copyright
453 update-copyright:
454 $(AM_V_GEN)set -e; \
455 current_year=`date +%Y` && test -n "$$current_year" \
456 || { echo "$@: cannot get current year" >&2; exit 1; }; \
457 sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" \
458 bootstrap.sh configure.ac; \
459 excluded_re=`( \
460 for url in $(FETCHFILES); do echo "$$url"; done \
461 | sed -e 's!^.*/!!' -e 's!^.*=!!' -e 's!^!lib/!' \
462 && for f in $(files_without_copyright); do echo $$f; done \
463 ) | sed -e '$$!s,$$,|,' | tr -d '\012\015'`; \
464 $(GIT) ls-files \
465 | grep -Ev '(^|/)README$$' \
466 | grep -Ev "^($$excluded_re)$$" \
467 | $(update_copyright_env) xargs $(srcdir)/lib/$@