1 # Maintainer makefile rules for Automake.
3 # Copyright (C) 1995-2013 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)
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.
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
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.
45 $(AM_V_GEN
)set
-e
; set
-u
; \
46 if
test -d
$(srcdir)/.git
; then \
48 && $(gitlog_to_changelog_command
) \
49 $(gitlog_to_changelog_options
) >$@
-t \
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; \
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
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
; \
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; \
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
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 # ---------------------------------------------------- #
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'; \
129 elif
$(match_version
) '$(stable_minor_version_rx)'; then \
130 release_type
='Minor release'; \
131 announcement_type
='maintenance release'; \
133 elif
$(match_version
) '$(beta_version_rx)'; then \
134 release_type
='Beta release'; \
135 announcement_type
='test release'; \
138 echo
"$@: invalid version '$(VERSION)' for a release" >&2; \
142 # Help the debugging of $(determine_release_type) and related code.
144 @
$(determine_release_type
); \
145 echo
"$$release_type $(VERSION);" \
146 "it will be announced as a $$announcement_type"
148 git-tag-release
: maintainer-check
150 case
'$(AM_TAG_DRYRUN)' in \
151 ""|
[nN
]|
[nN
]o|NO
) run
="";; \
152 *) run
="echo Running:";; \
154 $(determine_release_type
); \
155 $(git_must_have_clean_workdir
); \
156 $$run $(GIT
) tag
-s
"v$(VERSION)" -m
"$$release_type $(VERSION)"
159 @
# Check this is a version we can cut a release (either test
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" \
170 @
# Build the distribution tarball(s).
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 \
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.
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
() \
198 && echo
"$@: will get files from revision $$rev" \
199 && $(GIT
) clone
-q
--depth
1 "$$am_gitdir" 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
-) \
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 \
219 && get_autofiles_from_rev
$$OLD_COMMIT old \
220 && get_autofiles_from_rev
$$NEW_COMMIT new \
223 # With lots of eye candy; we like our developers pampered and spoiled :-)
224 compare-autodiffs
: autodiffs
226 : $${COLORDIFF
=colordiff
} $${DIFF
=diff
}; \
228 if
test ! -d
"$$dir"; then \
229 echo
"$@: $$dir: Not a directory" >&2; \
232 mydiff
=false mypager
=false
; \
234 if
($$COLORDIFF -r . .
) </dev
/null
>/dev
/null
2>&1; then \
235 mydiff
=$$COLORDIFF; \
243 if
test "$$mydiff" = false
; then \
244 if
($$DIFF -r
-u . .
); then \
247 echo
"$@: no good-enough diff program specified" >&2; \
251 st
=0; $$mydiff -r
-u
$$dir/old
$$dir/new |
$$mypager || st
=$$?
; \
254 .PHONY
: autodiffs compare-autodiffs
256 # ---------------------------------------------- #
257 # Help writing the announcement for a release. #
258 # ---------------------------------------------- #
260 PACKAGE_MAILINGLIST
= automake@gnu.org
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." \
271 && X
"**TODO** Brief description of the release here." \
273 && X
"**TODO** This description can span multiple paragraphs." \
275 && X
"See below for the detailed list of changes since the" \
276 && X
"previous version, as summarized by the NEWS file." \
278 && X
"Download here:" \
280 && X
" $$ftp_base/$(PACKAGE)-$(VERSION).tar.gz" \
281 && X
" $$ftp_base/$(PACKAGE)-$(VERSION).tar.xz" \
283 && X
"Please report bugs and problems to" \
284 "<$(PACKAGE_BUGREPORT)>," \
285 && X
"and send general comments and feedback to" \
286 "<$(PACKAGE_MAILINGLIST)>." \
288 && X
"Thanks to everyone who has reported problems, contributed" \
289 && X
"patches, and helped testing Automake!" \
293 && sed
-n
-e
'/^~~~/q' -e p
$(srcdir)/NEWS
>> $@
-t \
296 CLEANFILES
+= announcement
298 # --------------------------------------------------------------------- #
299 # Synchronize third-party files that are committed in our repository. #
300 # --------------------------------------------------------------------- #
302 # Program to use to fetch files.
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.
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.
328 $(AM_V_at
)rm -rf Fetchdir
329 $(AM_V_at
)mkdir Fetchdir
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 \
338 echo
"$@: updating file $$file"; \
339 cp Fetchdir
/$$file $(srcdir)/lib
/$$file || exit
1; \
342 $(AM_V_at
)rm -rf Fetchdir
345 # ---------------------------------------------------------------------- #
346 # Generate and upload manuals in several formats, for the GNU website. #
347 # ---------------------------------------------------------------------- #
349 web_manual_dir
= doc
/web-manual
355 WEBCVS_ROOT
= cvs.savannah.gnu.org
:/web
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.
368 $(AM_V_at
)rm -rf
$(web_manual_dir
) $t
370 $(AM_V_at
)$(LN_S
) '$(abs_srcdir)/doc/$(PACKAGE).texi' '$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
)
381 @
! $(AM_V_P
) || ls
-l
$(web_manual_dir
)
383 # Upload manual to www.gnu.org, using CVS (sigh!)
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; \
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; \
399 && $(CVS
) -z3
-d
:ext
:$(CVS_USER
)@
$(WEBCVS_ROOT
)/$(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
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
)
413 .PHONY
: web-manual-update
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
= \
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
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
; \
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'`; \
465 | grep
-Ev
'(^|/)README$$' \
466 | grep
-Ev
"^($$excluded_re)$$" \
467 |
$(update_copyright_env
) xargs
$(srcdir)/lib
/$@