maint: update copyright year
[autoconf.git] / maint.mk
blobcaa928835c2d274131015f77355d30cc5506975c
1 # -*-Makefile-*-
2 # This Makefile fragment tries to be general-purpose enough to be
3 # used by at least coreutils, idutils, CPPI, Bison, and Autoconf.
5 ## Copyright (C) 2001-2011 Free Software Foundation, Inc.
6 ##
7 ## This program is free software: you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation, either version 3 of the License, or
10 ## (at your option) any later version.
12 ## This program is distributed in the hope that it will be useful,
13 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ## GNU General Public License for more details.
17 ## You should have received a copy of the GNU General Public License
18 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # This is reported not to work with make-3.79.1
21 # ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
22 ME := maint.mk
24 # Override this in cfg.mk if you use a non-standard build-aux directory.
25 build_aux ?= $(srcdir)/build-aux
27 # Do not save the original name or timestamp in the .tar.gz file.
28 # Use --rsyncable if available.
29 gzip_rsyncable := \
30 $(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null \
31 && printf %s --rsyncable)
32 GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
34 GIT = git
35 VC = $(GIT)
36 VC-tag = git tag -s -m '$(VERSION)' -u '$(gpg_key_ID)'
38 VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
40 VC_LIST_EXCEPT = \
41 $(VC_LIST) | if test -f $(srcdir)/.x-$@; then \
42 grep -vEf $(srcdir)/.x-$@; \
43 else \
44 grep -v ChangeLog; \
47 ifeq ($(origin prev_version_file), undefined)
48 prev_version_file = $(srcdir)/.prev-version
49 endif
51 PREV_VERSION := $(shell cat $(prev_version_file) 2>/dev/null)
52 VERSION_REGEXP = $(subst .,\.,$(VERSION))
53 PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION))
55 this-vc-tag = v$(VERSION)
56 this-vc-tag-regexp = v$(VERSION_REGEXP)
57 my_distdir = $(PACKAGE)-$(VERSION)
59 # Old releases are stored here.
60 # Used for diffs.
61 release_archive_dir ?= ../release
63 # Override gnu_rel_host and url_dir_list in cfg.mk if these are not right.
64 # Use alpha.gnu.org for alpha and beta releases.
65 # Use ftp.gnu.org for stable releases.
66 gnu_ftp_host-alpha = alpha.gnu.org
67 gnu_ftp_host-beta = alpha.gnu.org
68 gnu_ftp_host-stable = ftp.gnu.org
69 gnu_rel_host ?= $(gnu_ftp_host-$(RELEASE_TYPE))
71 ifeq ($(gnu_rel_host),ftp.gnu.org)
72 url_dir_list ?= http://ftpmirror.gnu.org/$(PACKAGE)
73 else
74 url_dir_list ?= ftp://$(gnu_rel_host)/gnu/$(PACKAGE)
75 endif
77 # Prevent programs like 'sort' from considering distinct strings to be equal.
78 # Doing it here saves us from having to set LC_ALL elsewhere in this file.
79 export LC_ALL = C
83 ## --------------- ##
84 ## Sanity checks. ##
85 ## --------------- ##
87 # Collect the names of rules starting with `sc_'.
88 syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \
89 $(srcdir)/$(ME))
90 .PHONY: $(syntax-check-rules)
92 local-checks-available = \
93 po-check copyright-check writable-files m4-check author_mark_check \
94 changelog-check patch-check strftime-check $(syntax-check-rules) \
95 makefile_path_separator_check \
96 makefile-check check-AUTHORS
97 .PHONY: $(local-checks-available)
99 local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
101 syntax-check: $(local-check)
102 # @shopt -s nullglob; \
103 # grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
104 # $$(find -type f -name '*.[chly]') /dev/null && \
105 # { echo '$(ME): found conditional include' 1>&2; \
106 # exit 1; } || :
108 # grep -nE '^# *include <(string|stdlib)\.h>' \
109 # $(srcdir)/{lib,src}/*.[chly] /dev/null && \
110 # { echo '$(ME): FIXME' 1>&2; \
111 # exit 1; } || :
112 # FIXME: don't allow `#include .strings\.h' anywhere
114 sc_cast_of_argument_to_free:
115 @shopt -s nullglob; \
116 grep -nE '\<free \(\(' \
117 $(srcdir)/{lib,src}/*.[chly] /dev/null && \
118 { echo '$(ME): don'\''t cast free argument' 1>&2; \
119 exit 1; } || :
121 sc_cast_of_x_alloc_return_value:
122 @shopt -s nullglob; \
123 grep -nE --exclude=$(srcdir)/lib/regex.c \
124 '\*\) *x(m|c|re)alloc\>' \
125 $(srcdir)/{lib,src}/*.[chly] /dev/null && \
126 { echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
127 exit 1; } || :
129 sc_cast_of_alloca_return_value:
130 @shopt -s nullglob; \
131 grep -nE '\*\) *alloca\>' \
132 $(srcdir)/src/*.[chly] /dev/null && \
133 { echo '$(ME): don'\''t cast alloca return value' 1>&2; \
134 exit 1; } || :
136 sc_space_tab:
137 @grep -n '[ ] ' $$($(VC_LIST_EXCEPT)) && \
138 { echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
139 1>&2; exit 1; } || :
141 # Don't use *scanf or the old ato* functions in `real' code.
142 # They provide no error checking mechanism.
143 # Instead, use strto* functions.
144 sc_prohibit_atoi_atof:
145 @grep -nE '\<([fs]?scanf|ato([filq]|ll))\>' $$($(VC_LIST_EXCEPT)) && \
146 { echo '$(ME): do not use *scan''f, ato''f, ato''i, ato''l, ato''ll, ato''q, or ss''canf' \
147 1>&2; exit 1; } || :
149 # Using EXIT_SUCCESS as the first argument to error is misleading,
150 # since when that parameter is 0, error does not exit. Use `0' instead.
151 sc_error_exit_success:
152 @grep -nF 'error (EXIT_SUCCESS,' \
153 $$(find -type f -name '*.[chly]') /dev/null && \
154 { echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
155 exit 1; } || :
157 sc_file_system:
158 @grep -ni 'file''system' $$($(VC_LIST_EXCEPT)) \
159 | grep -v 'File''system Hierarchy Standard' && \
160 { echo '$(ME): found use of "file''system";' \
161 'rewrite to use "file system"' 1>&2; \
162 exit 1; } || :
164 sc_no_have_config_h:
165 @grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) && \
166 { echo '$(ME): found use of HAVE''_CONFIG_H; remove' \
167 1>&2; exit 1; } || :
169 # Nearly all .c files must include <config.h>.
170 sc_require_config_h:
171 @if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
172 grep -L '^# *include <config\.h>' \
173 $$($(VC_LIST_EXCEPT) | grep '\.c$$') \
174 | grep . && \
175 { echo '$(ME): the above files do not include <config.h>' \
176 1>&2; exit 1; } || :; \
177 else :; \
180 # To use this "command" macro, you must first define two shell variables:
181 # h: the header, enclosed in <> or ""
182 # re: a regular expression that matches IFF something provided by $h is used.
183 define _header_without_use
184 h_esc=`echo "$$h"|sed 's/\./\\./'`; \
185 if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
186 files=$$(grep -l '^# *include '"$$h_esc" \
187 $$($(VC_LIST_EXCEPT) | grep '\.c$$')) && \
188 grep -LE "$$re" $$files | grep . && \
189 { echo "$(ME): the above files include $$h but don't use it" \
190 1>&2; exit 1; } || :; \
191 else :; \
193 endef
195 # Prohibit the inclusion of assert.h without an actual use of assert.
196 sc_prohibit_assert_without_use:
197 @h='<assert.h>' re='\<assert *\(' $(_header_without_use)
199 # Prohibit the inclusion of getopt.h without an actual use.
200 sc_prohibit_getopt_without_use:
201 @h='<getopt.h>' re='\<getopt(_long)? *\(' $(_header_without_use)
203 # Don't include quotearg.h unless you use one of its functions.
204 sc_prohibit_quotearg_without_use:
205 @h='"quotearg.h"' re='\<quotearg(_[^ ]+)? *\(' $(_header_without_use)
207 # Don't include quote.h unless you use one of its functions.
208 sc_prohibit_quote_without_use:
209 @h='"quote.h"' re='\<quote(_n)? *\(' $(_header_without_use)
211 # Don't include this header unless you use one of its functions.
212 sc_prohibit_long_options_without_use:
213 @h='"long-options.h"' re='\<parse_long_options *\(' \
214 $(_header_without_use)
216 # Don't include this header unless you use one of its functions.
217 sc_prohibit_inttostr_without_use:
218 @h='"inttostr.h"' re='\<(off|[iu]max|uint)tostr *\(' \
219 $(_header_without_use)
221 # Don't include this header unless you use one of its functions.
222 sc_prohibit_error_without_use:
223 @h='"error.h"' \
224 re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? *\('\
225 $(_header_without_use)
227 sc_prohibit_safe_read_without_use:
228 @h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
229 $(_header_without_use)
231 sc_prohibit_argmatch_without_use:
232 @h='"argmatch.h"' \
233 re='(\<(ARRAY_CARDINALITY|X?ARGMATCH(|_TO_ARGUMENT|_VERIFY))\>|\<argmatch(_exit_fn|_(in)?valid) *\()' \
234 $(_header_without_use)
236 sc_prohibit_root_dev_ino_without_use:
237 @h='"root-dev-ino.h"' \
238 re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \
239 $(_header_without_use)
241 sc_obsolete_symbols:
242 @grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
243 $$($(VC_LIST_EXCEPT)) && \
244 { echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
245 1>&2; exit 1; } || :
247 # FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
249 # Each nonempty line must start with a year number, or a TAB.
250 sc_changelog:
251 @grep -n '^[^12 ]' $$(find $(srcdir) -maxdepth 2 -name ChangeLog) && \
252 { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
253 exit 1; } || :
255 # Ensure that dd's definition of LONGEST_SYMBOL stays in sync
256 # with the strings from the two affected variables.
257 dd_c = $(srcdir)/src/dd.c
258 sc_dd_max_sym_length:
259 ifneq ($(wildcard $(dd_c)),)
260 @len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
261 sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
262 |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
263 | wc --max-line-length); \
264 max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
265 |tr -d '"' | wc --max-line-length); \
266 if test "$$len" = "$$max"; then :; else \
267 echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
268 exit 1; \
270 endif
272 # Many m4 macros names once began with `jm_'.
273 # On 2004-04-13, they were all changed to start with gl_ instead.
274 # Make sure that none are inadvertently reintroduced.
275 sc_prohibit_jm_in_m4:
276 @grep -nE 'jm_[A-Z]' \
277 $$($(VC_LIST) m4 |grep '\.m4$$') && \
278 { echo '$(ME): do not use jm_ in m4 macro names' \
279 1>&2; exit 1; } || :
281 sc_root_tests:
282 @t1=sc-root.expected; t2=sc-root.actual; \
283 grep -nl '^PRIV_CHECK_ARG=require-root' \
284 $$($(VC_LIST) tests) |sed s/tests/./ |sort > $$t1; \
285 sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \
286 $(srcdir)/tests/Makefile.am |sort > $$t2; \
287 diff -u $$t1 $$t2 || diff=1; \
288 rm -f $$t1 $$t2; \
289 test "$$diff" \
290 && { echo 'tests/Makefile.am: missing check-root action'>&2; \
291 exit 1; } || :
293 # Files in src/ should not include directly any of
294 # the headers already included via system.h.
295 sc_system_h_headers:
296 @if test -f $(srcdir)/src/system.h; then \
297 pat=$$( \
298 sed -n '/^# *include /s///p' $(srcdir)/src/system.h /dev/null \
299 | grep -Ev 'sys/(param|file)\.h' \
300 | sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
301 ) && \
302 grep -nE -f "$pat" \
303 $$($(VC_LIST) src | \
304 grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
305 && { echo '$(ME): the above are already included via system.h'\
306 1>&2; exit 1; } || :; \
309 sc_sun_os_names:
310 @grep -nEi \
311 'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
312 $$($(VC_LIST_EXCEPT)) && \
313 { echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
314 exit 1; } || :
316 sc_the_the:
317 @grep -ni '\<the ''the\>' $$($(VC_LIST_EXCEPT)) && \
318 { echo '$(ME): found use of "the ''the";' 1>&2; \
319 exit 1; } || :
321 sc_tight_scope:
322 test ! -d src || $(MAKE) -C src $@
324 sc_trailing_blank:
325 @grep -n '[ ]$$' $$($(VC_LIST_EXCEPT)) && \
326 { echo '$(ME): found trailing blank(s)' \
327 1>&2; exit 1; } || :
329 # Match lines like the following, but where there is only one space
330 # between the options and the description:
331 # -D, --all-repeated[=delimit-method] print all duplicate lines\n
332 longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*\]?)?
333 sc_two_space_separator_in_usage:
334 @grep -nE '^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \
335 $$($(VC_LIST_EXCEPT)) && \
336 { echo "$(ME): help2man requires at least two spaces between"; \
337 echo "$(ME): an option and its description"; \
338 1>&2; exit 1; } || :
340 # Look for diagnostics that aren't marked for translation.
341 # This won't find any for which error's format string is on a separate line.
342 sc_unmarked_diagnostics:
343 @grep -nE \
344 '\<error \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
345 | grep -v '_''(' && \
346 { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
347 exit 1; } || :
349 # Avoid useless parentheses like those in this example:
350 # #if defined (SYMBOL) || defined (SYM2)
351 sc_useless_cpp_parens:
352 @grep -n '^# *if .*defined *(' $$($(VC_LIST_EXCEPT)) && \
353 { echo '$(ME): found useless parentheses in cpp directive' \
354 1>&2; exit 1; } || :
356 # Ensure that the c99-to-c89 patch applies cleanly.
357 patch-check:
358 if test -f src/c99-to-c89.diff; then \
359 rm -rf src-c89 $@.1 $@.2 && \
360 cp -a src src-c89 && \
361 (cd src-c89; patch -V never --fuzz=0) < src/c99-to-c89.diff \
362 > $@.1 2>&1 && \
363 { grep -v '^patching file ' $@.1 > $@.2 || :; } && \
364 test -s $@.2 && \
365 rm -rf src-c89 $@.1 $@.2; \
368 # Ensure that date's --help output stays in sync with the info
369 # documentation for GNU strftime. The only exception is %N,
370 # which date accepts but GNU strftime does not.
371 extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
372 strftime-check:
373 if test -f $(srcdir)/src/date.c; then \
374 grep '^ %. ' $(srcdir)/src/date.c | sort \
375 | $(extract_char) > $@-src; \
376 { echo N; \
377 info libc date calendar format | grep '^ `%.'\' \
378 | $(extract_char); } | sort > $@-info; \
379 diff -u $@-src $@-info || exit 1; \
380 rm -f $@-src $@-info; \
383 check-AUTHORS:
384 test ! -d src || $(MAKE) -C src $@
386 NEWS_hash = \
387 $$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \
388 $(srcdir)/NEWS \
389 | perl -0777 -pe \
390 's/^Copyright.+?Free\sSoftware\sFoundation,\sInc\.\n//ms' \
391 | md5sum - \
392 | sed 's/ .*//')
394 # Ensure that we don't accidentally insert an entry into an old NEWS block.
395 sc_immutable_NEWS:
396 @if test -f $(srcdir)/NEWS; then \
397 test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : || \
398 { echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \
401 # Update the hash stored above. Do this after each release and
402 # for any corrections to old entries.
403 update-NEWS-hash: NEWS
404 perl -pi -e 's/^(old_NEWS_hash[ \t]+:?=[ \t]+).*/$${1}'"$(NEWS_hash)/" \
405 $(srcdir)/cfg.mk
407 # Ensure that we use only the standard $(VAR) notation,
408 # not @...@ in Makefile.am, now that we can rely on automake
409 # to emit a definition for each substituted variable.
410 makefile-check:
411 grep -nE '@[A-Z_0-9]+@' `find $(srcdir) -name Makefile.am` \
412 && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
414 news-date-check: NEWS
415 today=`date +%Y-%m-%d`; \
416 if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
417 >/dev/null; then \
418 :; \
419 else \
420 echo "version or today's date is not in NEWS" 1>&2; \
421 exit 1; \
424 changelog-check:
425 if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
426 >/dev/null; then \
427 :; \
428 else \
429 echo "$(VERSION) not in ChangeLog" 1>&2; \
430 exit 1; \
433 m4-check:
434 @shopt -s nullglob; \
435 grep 'AC_DEFUN([^[]' m4/*.m4 /dev/null \
436 && { echo '$(ME): quote the first arg to AC_DEFUN' 1>&2; \
437 exit 1; } || :
439 # Verify that all source files using _() are listed in po/POTFILES.in.
440 # FIXME: don't hard-code file names below; use a more general mechanism.
441 po-check:
442 if test -f po/POTFILES.in; then \
443 grep -E -v '^(#|$$)' po/POTFILES.in \
444 | grep -v '^src/false\.c$$' | sort > $@-1; \
445 files=; \
446 for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do \
447 case $$file in \
448 djgpp/* | man/*) continue;; \
449 */c99-to-c89.diff) continue;; \
450 esac; \
451 case $$file in \
452 *.[ch]) \
453 base=`expr " $$file" : ' \(.*\)\..'`; \
454 { test -f $$base.l || test -f $$base.y; } && continue;; \
455 esac; \
456 files="$$files $$file"; \
457 done; \
458 grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files \
459 | sort -u > $@-2; \
460 diff -u $@-1 $@-2 || exit 1; \
461 rm -f $@-1 $@-2; \
464 # In a definition of #define AUTHORS "... and ..." where the RHS contains
465 # the English word `and', the string must be marked with `N_ (...)' so that
466 # gettext recognizes it as a string requiring translation.
467 author_mark_check:
468 @shopt -s nullglob; \
469 grep -n '^# *define AUTHORS "[^"]* and ' src/*.c /dev/null \
470 | grep -v ' N_ (' && \
471 { echo '$(ME): enclose the above strings in N_ (...)' 1>&2; \
472 exit 1; } || :
474 # Sometimes it is useful to change the PATH environment variable
475 # in Makefiles. When doing so, it's better not to use the Unix-centric
476 # path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'.
477 # It'd be better to use `find -print0 ...|xargs -0 ...', but less portable,
478 # and there probably aren't many projects with so many Makefile.am files
479 # that we'd have to worry about limits on command line length.
480 msg = '$(ME): Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
481 makefile_path_separator_check:
482 @grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
483 && { echo $(msg) 1>&2; exit 1; } || :
485 # Check that `make alpha' will not fail at the end of the process.
486 writable-files:
487 if test -d $(release_archive_dir); then :; else \
488 mkdir $(release_archive_dir); \
490 for file in $(distdir).tar.gz \
491 $(release_archive_dir)/$(distdir).tar.gz; do \
492 test -e $$file || continue; \
493 test -w $$file \
494 || { echo ERROR: $$file is not writable; fail=1; }; \
495 done; \
496 test "$$fail" && exit 1 || :
498 v_etc_file = lib/version-etc.c
499 # Make sure that the copyright date in $(v_etc_file) is up to date.
500 copyright-check:
501 @if test -f $(v_etc_file); then \
502 grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
503 >/dev/null \
504 || { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
505 exit 1; }; \
508 vc-diff-check:
509 (CDPATH=; cd $(srcdir) && $(VC) diff) > vc-diffs || :
510 if test -s vc-diffs; then \
511 cat vc-diffs; \
512 echo "Some files are locally modified:" 1>&2; \
513 exit 1; \
514 else \
515 rm vc-diffs; \
518 cvs-check: vc-diff-check
520 maintainer-distcheck:
521 $(MAKE) distcheck
522 $(MAKE) -C tests $(AM_MAKEFLAGS) maintainer-check
523 $(MAKE) my-distcheck
525 # Don't make a distribution if checks fail.
526 # Also, make sure the NEWS file is up-to-date.
527 vc-dist: $(local-check) cvs-check maintainer-distcheck
528 $(MAKE) dist
530 # Use this to make sure we don't run these programs when building
531 # from a virgin tgz file, below.
532 null_AM_MAKEFLAGS = \
533 ACLOCAL=false \
534 AUTOCONF=false \
535 AUTOMAKE=false \
536 AUTOHEADER=false \
537 MAKEINFO=false
539 # Detect format-string/arg-list mismatches that would normally be obscured
540 # by the use of _(). The --disable-nls effectively defines away that macro,
541 # and building with CFLAGS='-Wformat -Werror' causes any format warning to be
542 # treated as a failure. Also, check for shadowing problems with -Wshadow,
543 # and for pointer arithmetic problems with -Wpointer-arith.
544 # These CFLAGS are pretty strict. If you build this target, you probably
545 # have to have a recent version of gcc and glibc headers.
546 TMPDIR ?= /tmp
547 t=$(TMPDIR)/$(PACKAGE)/test
548 my-distcheck: $(local-check) $(release_archive_dir)/$(prev-tgz)
549 -rm -rf $(t)
550 mkdir -p $(t)
551 GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
552 cd $(t)/$(distdir) \
553 && ./configure --disable-nls \
554 && $(MAKE) CFLAGS='-Werror -Wall -Wformat -Wshadow -Wpointer-arith' \
555 AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
556 && $(MAKE) dvi \
557 && $(MAKE) check \
558 && $(MAKE) distclean
559 (cd $(t) && mv $(distdir) $(distdir).old \
560 && $(AMTAR) -zxf - ) < $(distdir).tar.gz
561 diff -ur $(t)/$(distdir).old $(t)/$(distdir)
562 -rm -rf $(t)
563 @echo "========================"; \
564 echo "$(distdir).tar.gz is ready for distribution"; \
565 echo "========================"
567 prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
569 rel-files = $(DIST_ARCHIVES)
571 gnulib_dir ?= $(srcdir)/gnulib
572 gnulib-version = $$(cd $(gnulib_dir) && git describe)
573 bootstrap-tools ?= autoconf,automake,gnulib
575 # If it's not already specified, derive the GPG key ID from
576 # the signed tag we've just applied to mark this release.
577 gpg_key_ID ?= \
578 $$(git cat-file tag v$(VERSION) > .ann-sig \
579 && gpgv .ann-sig - < /dev/null 2>&1 \
580 | sed -n '/.*key ID \([0-9A-F]*\)/s//\1/p'; rm -f .ann-sig)
582 translation_project_ ?= coordinator@translationproject.org
583 announcement_Cc_ ?= $(translation_project_), $(PACKAGE_BUGREPORT)
584 announcement_mail_headers_ ?= \
585 To: info-gnu@gnu.org \
586 Cc: $(announcement_Cc_) \
587 Mail-Followup-To: $(PACKAGE_BUGREPORT)
589 announcement: NEWS ChangeLog $(rel-files)
590 @$(build_aux)/announce-gen \
591 --mail-headers='$(announcement_mail_headers_)' \
592 --release-type=$(RELEASE_TYPE) \
593 --package=$(PACKAGE) \
594 --prev=$(PREV_VERSION) \
595 --curr=$(VERSION) \
596 --gpg-key-id=$(gpg_key_ID) \
597 --news=$(srcdir)/NEWS \
598 --bootstrap-tools=$(bootstrap-tools) \
599 --no-print-checksums \
600 $(addprefix --url-dir=, $(url_dir_list))
602 ## ---------------- ##
603 ## Updating files. ##
604 ## ---------------- ##
606 ftp-gnu = ftp://ftp.gnu.org/gnu
607 www-gnu = http://www.gnu.org
609 # Use mv, if you don't have/want move-if-change.
610 move_if_change ?= move-if-change
612 upload_dest_dir_ ?= $(PACKAGE)
614 emit_upload_commands:
615 @echo =====================================
616 @echo =====================================
617 @echo "$(build_aux)/gnupload $(GNUPLOADFLAGS) \\"
618 @echo " --to $(gnu_rel_host):$(upload_dest_dir_) \\"
619 @echo " $(rel-files)"
620 @echo '# send the ~/announce-$(my_distdir) e-mail'
621 @echo =====================================
622 @echo =====================================
624 noteworthy = * Noteworthy changes in release ?.? (????-??-??) [?]
625 define emit-commit-log
626 printf '%s\n' 'post-release administrivia' '' \
627 '* NEWS: Add header line for next release.' \
628 '* .prev-version: Record previous version.' \
629 '* cfg.mk (old_NEWS_hash): Auto-update.'
630 endef
632 .PHONY: alpha beta stable
633 ALL_RECURSIVE_TARGETS += alpha beta stable
634 alpha beta stable: news-date-check changelog-check $(local-check)
635 test $@ = stable \
636 && { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \
637 || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\
638 || :
639 $(MAKE) vc-dist
640 $(MAKE) dist XZ_OPT=-9ev
641 $(MAKE) $(release-prep-hook) RELEASE_TYPE=$@
642 $(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
644 # Override this in cfg.mk if you follow different procedures.
645 release-prep-hook ?= release-prep
647 .PHONY: release-prep
648 release-prep:
649 case $$RELEASE_TYPE in alpha|beta|stable) ;; \
650 *) echo "invalid RELEASE_TYPE: $$RELEASE_TYPE" 1>&2; exit 1;; esac
651 $(MAKE) -s announcement > ~/announce-$(my_distdir)
652 if test -d $(release_archive_dir); then \
653 ln $(rel-files) $(release_archive_dir); \
654 chmod a-w $(rel-files); \
656 echo $(VERSION) > $(prev_version_file)
657 $(MAKE) update-NEWS-hash
658 perl -pi -e '$$. == 3 and print "$(noteworthy)\n\n\n"' NEWS
659 $(emit-commit-log) > .ci-msg
660 $(VC) commit -F .ci-msg -a
661 rm .ci-msg
664 # Override this with e.g., -s $(srcdir)/some_other_name.texi
665 # if the default $(PACKAGE)-derived name doesn't apply.
666 gendocs_options_ ?=
668 .PHONY: web-manual
669 web-manual:
670 @test -z "$(manual_title)" \
671 && { echo define manual_title in cfg.mk 1>&2; exit 1; } || :
672 @cd '$(srcdir)/doc'; \
673 $(SHELL) ../build-aux/gendocs.sh $(gendocs_options_) \
674 -o '$(abs_builddir)/doc/manual' \
675 --email $(PACKAGE_BUGREPORT) $(PACKAGE) \
676 "$(PACKAGE_NAME) - $(manual_title)"
677 @echo " *** Upload the doc/manual directory to web-cvs."
679 # If you want to set UPDATE_COPYRIGHT_* environment variables,
680 # put the assignments in this variable.
681 update-copyright-env ?=
683 # Run this rule once per year (usually early in January)
684 # to update all FSF copyright year lists in your project.
685 # If you have an additional project-specific rule,
686 # add it in cfg.mk along with a line 'update-copyright: prereq'.
687 # By default, exclude all variants of COPYING; you can also
688 # add exemptions (such as ChangeLog..* for rotated change logs)
689 # in the file .x-update-copyright.
690 .PHONY: update-copyright
691 update-copyright:
692 grep -l -w Copyright $$($(VC_LIST_EXCEPT)) \
693 $(srcdir)/ChangeLog | grep -v COPYING \
694 | $(update-copyright-env) xargs $(build_aux)/$@