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