Document $(( )) pitfalls.
[autoconf.git] / maint.mk
blob7149adf8b1901bc5ab2eda0c1b384d0dde6f47f7
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-2008 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 # Do not save the original name or timestamp in the .tar.gz file.
25 # Use --rsyncable if available.
26 gzip_rsyncable := \
27 $(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null && echo --rsyncable)
28 GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
30 GIT = git
31 VC = $(GIT)
32 VC-tag = git tag -s -m '$(VERSION)'
34 VC_LIST = $(srcdir)/build-aux/vc-list-files -C $(srcdir)
36 VC_LIST_EXCEPT = \
37 $(VC_LIST) | if test -f $(srcdir)/.x-$@; then \
38 grep -vEf $(srcdir)/.x-$@; \
39 else \
40 grep -v ChangeLog; \
43 ifeq ($(origin prev_version_file), undefined)
44 prev_version_file = $(srcdir)/.prev-version
45 endif
47 PREV_VERSION := $(shell cat $(prev_version_file))
48 VERSION_REGEXP = $(subst .,\.,$(VERSION))
50 this-vc-tag = v$(VERSION)
51 this-vc-tag-regexp = v$(VERSION_REGEXP)
52 my_distdir = $(PACKAGE)-$(VERSION)
54 # Old releases are stored here.
55 # Used for diffs and xdeltas.
56 release_archive_dir ?= ../release
58 # Prevent programs like 'sort' from considering distinct strings to be equal.
59 # Doing it here saves us from having to set LC_ALL elsewhere in this file.
60 export LC_ALL = C
64 ## --------------- ##
65 ## Sanity checks. ##
66 ## --------------- ##
68 # Collect the names of rules starting with `sc_'.
69 syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \
70 $(srcdir)/$(ME))
71 .PHONY: $(syntax-check-rules)
73 local-checks-available = \
74 po-check copyright-check writable-files m4-check author_mark_check \
75 changelog-check patch-check strftime-check $(syntax-check-rules) \
76 makefile_path_separator_check \
77 makefile-check check-AUTHORS
78 .PHONY: $(local-checks-available)
80 local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
82 syntax-check: $(local-check)
83 # @shopt -s nullglob; \
84 # grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
85 # $$(find -type f -name '*.[chly]') /dev/null && \
86 # { echo '$(ME): found conditional include' 1>&2; \
87 # exit 1; } || :
89 # grep -nE '^# *include <(string|stdlib)\.h>' \
90 # $(srcdir)/{lib,src}/*.[chly] /dev/null && \
91 # { echo '$(ME): FIXME' 1>&2; \
92 # exit 1; } || :
93 # FIXME: don't allow `#include .strings\.h' anywhere
95 sc_cast_of_argument_to_free:
96 @shopt -s nullglob; \
97 grep -nE '\<free \(\(' \
98 $(srcdir)/{lib,src}/*.[chly] /dev/null && \
99 { echo '$(ME): don'\''t cast free argument' 1>&2; \
100 exit 1; } || :
102 sc_cast_of_x_alloc_return_value:
103 @shopt -s nullglob; \
104 grep -nE --exclude=$(srcdir)/lib/regex.c \
105 '\*\) *x(m|c|re)alloc\>' \
106 $(srcdir)/{lib,src}/*.[chly] /dev/null && \
107 { echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
108 exit 1; } || :
110 sc_cast_of_alloca_return_value:
111 @shopt -s nullglob; \
112 grep -nE '\*\) *alloca\>' \
113 $(srcdir)/src/*.[chly] /dev/null && \
114 { echo '$(ME): don'\''t cast alloca return value' 1>&2; \
115 exit 1; } || :
117 sc_space_tab:
118 @grep -n '[ ] ' $$($(VC_LIST_EXCEPT)) && \
119 { echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
120 1>&2; exit 1; } || :
122 # Don't use *scanf or the old ato* functions in `real' code.
123 # They provide no error checking mechanism.
124 # Instead, use strto* functions.
125 sc_prohibit_atoi_atof:
126 @grep -nE '\<([fs]?scanf|ato([filq]|ll))\>' $$($(VC_LIST_EXCEPT)) && \
127 { echo '$(ME): do not use *scan''f, ato''f, ato''i, ato''l, ato''ll, ato''q, or ss''canf' \
128 1>&2; exit 1; } || :
130 # Using EXIT_SUCCESS as the first argument to error is misleading,
131 # since when that parameter is 0, error does not exit. Use `0' instead.
132 sc_error_exit_success:
133 @grep -nF 'error (EXIT_SUCCESS,' \
134 $$(find -type f -name '*.[chly]') /dev/null && \
135 { echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
136 exit 1; } || :
138 sc_file_system:
139 @grep -ni 'file''system' $$($(VC_LIST_EXCEPT)) \
140 | grep -v 'File''system Hierarchy Standard' && \
141 { echo '$(ME): found use of "file''system";' \
142 'rewrite to use "file system"' 1>&2; \
143 exit 1; } || :
145 sc_no_have_config_h:
146 @grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) && \
147 { echo '$(ME): found use of HAVE''_CONFIG_H; remove' \
148 1>&2; exit 1; } || :
150 # Nearly all .c files must include <config.h>.
151 sc_require_config_h:
152 @if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
153 grep -L '^# *include <config\.h>' \
154 $$($(VC_LIST_EXCEPT) | grep '\.c$$') \
155 | grep . && \
156 { echo '$(ME): the above files do not include <config.h>' \
157 1>&2; exit 1; } || :; \
158 else :; \
161 # To use this "command" macro, you must first define two shell variables:
162 # h: the header, enclosed in <> or ""
163 # re: a regular expression that matches IFF something provided by $h is used.
164 define _header_without_use
165 h_esc=`echo "$$h"|sed 's/\./\\./'`; \
166 if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
167 files=$$(grep -l '^# *include '"$$h_esc" \
168 $$($(VC_LIST_EXCEPT) | grep '\.c$$')) && \
169 grep -LE "$$re" $$files | grep . && \
170 { echo "$(ME): the above files include $$h but don't use it" \
171 1>&2; exit 1; } || :; \
172 else :; \
174 endef
176 # Prohibit the inclusion of assert.h without an actual use of assert.
177 sc_prohibit_assert_without_use:
178 @h='<assert.h>' re='\<assert *\(' $(_header_without_use)
180 # Prohibit the inclusion of getopt.h without an actual use.
181 sc_prohibit_getopt_without_use:
182 @h='<getopt.h>' re='\<getopt(_long)? *\(' $(_header_without_use)
184 # Don't include quotearg.h unless you use one of its functions.
185 sc_prohibit_quotearg_without_use:
186 @h='"quotearg.h"' re='\<quotearg(_[^ ]+)? *\(' $(_header_without_use)
188 # Don't include quote.h unless you use one of its functions.
189 sc_prohibit_quote_without_use:
190 @h='"quote.h"' re='\<quote(_n)? *\(' $(_header_without_use)
192 # Don't include this header unless you use one of its functions.
193 sc_prohibit_long_options_without_use:
194 @h='"long-options.h"' re='\<parse_long_options *\(' \
195 $(_header_without_use)
197 # Don't include this header unless you use one of its functions.
198 sc_prohibit_inttostr_without_use:
199 @h='"inttostr.h"' re='\<(off|[iu]max|uint)tostr *\(' \
200 $(_header_without_use)
202 # Don't include this header unless you use one of its functions.
203 sc_prohibit_error_without_use:
204 @h='"error.h"' \
205 re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? *\('\
206 $(_header_without_use)
208 sc_prohibit_safe_read_without_use:
209 @h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
210 $(_header_without_use)
212 sc_prohibit_argmatch_without_use:
213 @h='"argmatch.h"' \
214 re='(\<(ARRAY_CARDINALITY|X?ARGMATCH(|_TO_ARGUMENT|_VERIFY))\>|\<argmatch(_exit_fn|_(in)?valid) *\()' \
215 $(_header_without_use)
217 sc_prohibit_root_dev_ino_without_use:
218 @h='"root-dev-ino.h"' \
219 re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \
220 $(_header_without_use)
222 sc_obsolete_symbols:
223 @grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
224 $$($(VC_LIST_EXCEPT)) && \
225 { echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
226 1>&2; exit 1; } || :
228 # FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
230 # Each nonempty line must start with a year number, or a TAB.
231 sc_changelog:
232 @grep -n '^[^12 ]' $$(find $(srcdir) -maxdepth 2 -name ChangeLog) && \
233 { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
234 exit 1; } || :
236 # Ensure that dd's definition of LONGEST_SYMBOL stays in sync
237 # with the strings from the two affected variables.
238 dd_c = $(srcdir)/src/dd.c
239 sc_dd_max_sym_length:
240 ifneq ($(wildcard $(dd_c)),)
241 @len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
242 sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
243 |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
244 | wc --max-line-length); \
245 max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
246 |tr -d '"' | wc --max-line-length); \
247 if test "$$len" = "$$max"; then :; else \
248 echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
249 exit 1; \
251 endif
253 # Many m4 macros names once began with `jm_'.
254 # On 2004-04-13, they were all changed to start with gl_ instead.
255 # Make sure that none are inadvertently reintroduced.
256 sc_prohibit_jm_in_m4:
257 @grep -nE 'jm_[A-Z]' \
258 $$($(VC_LIST) m4 |grep '\.m4$$') && \
259 { echo '$(ME): do not use jm_ in m4 macro names' \
260 1>&2; exit 1; } || :
262 sc_root_tests:
263 @t1=sc-root.expected; t2=sc-root.actual; \
264 grep -nl '^PRIV_CHECK_ARG=require-root' \
265 $$($(VC_LIST) tests) |sed s/tests/./ |sort > $$t1; \
266 sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \
267 $(srcdir)/tests/Makefile.am |sort > $$t2; \
268 diff -u $$t1 $$t2 || diff=1; \
269 rm -f $$t1 $$t2; \
270 test "$$diff" \
271 && { echo 'tests/Makefile.am: missing check-root action'>&2; \
272 exit 1; } || :
274 # Files in src/ should not include directly any of
275 # the headers already included via system.h.
276 sc_system_h_headers:
277 @if test -f $(srcdir)/src/system.h; then \
278 pat=$$( \
279 sed -n '/^# *include /s///p' $(srcdir)/src/system.h /dev/null \
280 | grep -Ev 'sys/(param|file)\.h' \
281 | sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
282 ) && \
283 grep -nE -f "$pat" \
284 $$($(VC_LIST) src | \
285 grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
286 && { echo '$(ME): the above are already included via system.h'\
287 1>&2; exit 1; } || :; \
290 sc_sun_os_names:
291 @grep -nEi \
292 'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
293 $$($(VC_LIST_EXCEPT)) && \
294 { echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
295 exit 1; } || :
297 sc_the_the:
298 @grep -ni '\<the ''the\>' $$($(VC_LIST_EXCEPT)) && \
299 { echo '$(ME): found use of "the ''the";' 1>&2; \
300 exit 1; } || :
302 sc_tight_scope:
303 test ! -d src || $(MAKE) -C src $@
305 sc_trailing_blank:
306 @grep -n '[ ]$$' $$($(VC_LIST_EXCEPT)) && \
307 { echo '$(ME): found trailing blank(s)' \
308 1>&2; exit 1; } || :
310 # Match lines like the following, but where there is only one space
311 # between the options and the description:
312 # -D, --all-repeated[=delimit-method] print all duplicate lines\n
313 longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*\]?)?
314 sc_two_space_separator_in_usage:
315 @grep -nE '^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \
316 $$($(VC_LIST_EXCEPT)) && \
317 { echo "$(ME): help2man requires at least two spaces between"; \
318 echo "$(ME): an option and its description"; \
319 1>&2; exit 1; } || :
321 # Look for diagnostics that aren't marked for translation.
322 # This won't find any for which error's format string is on a separate line.
323 sc_unmarked_diagnostics:
324 @grep -nE \
325 '\<error \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
326 | grep -v '_''(' && \
327 { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
328 exit 1; } || :
330 # Avoid useless parentheses like those in this example:
331 # #if defined (SYMBOL) || defined (SYM2)
332 sc_useless_cpp_parens:
333 @grep -n '^# *if .*defined *(' $$($(VC_LIST_EXCEPT)) && \
334 { echo '$(ME): found useless parentheses in cpp directive' \
335 1>&2; exit 1; } || :
337 # Ensure that the c99-to-c89 patch applies cleanly.
338 patch-check:
339 if test -f src/c99-to-c89.diff; then \
340 rm -rf src-c89 $@.1 $@.2 && \
341 cp -a src src-c89 && \
342 (cd src-c89; patch -V never --fuzz=0) < src/c99-to-c89.diff \
343 > $@.1 2>&1 && \
344 { grep -v '^patching file ' $@.1 > $@.2 || :; } && \
345 test -s $@.2 && \
346 rm -rf src-c89 $@.1 $@.2; \
349 # Ensure that date's --help output stays in sync with the info
350 # documentation for GNU strftime. The only exception is %N,
351 # which date accepts but GNU strftime does not.
352 extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
353 strftime-check:
354 if test -f $(srcdir)/src/date.c; then \
355 grep '^ %. ' $(srcdir)/src/date.c | sort \
356 | $(extract_char) > $@-src; \
357 { echo N; \
358 info libc date calendar format | grep '^ `%.'\' \
359 | $(extract_char); } | sort > $@-info; \
360 diff -u $@-src $@-info || exit 1; \
361 rm -f $@-src $@-info; \
364 check-AUTHORS:
365 test ! -d src || $(MAKE) -C src $@
367 # Ensure that we use only the standard $(VAR) notation,
368 # not @...@ in Makefile.am, now that we can rely on automake
369 # to emit a definition for each substituted variable.
370 makefile-check:
371 grep -nE '@[A-Z_0-9]+@' `find $(srcdir) -name Makefile.am` \
372 && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
374 news-date-check: NEWS
375 today=`date +%Y-%m-%d`; \
376 if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
377 >/dev/null; then \
378 :; \
379 else \
380 echo "version or today's date is not in NEWS" 1>&2; \
381 exit 1; \
384 changelog-check:
385 if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
386 >/dev/null; then \
387 :; \
388 else \
389 echo "$(VERSION) not in ChangeLog" 1>&2; \
390 exit 1; \
393 m4-check:
394 @shopt -s nullglob; \
395 grep 'AC_DEFUN([^[]' m4/*.m4 /dev/null \
396 && { echo '$(ME): quote the first arg to AC_DEFUN' 1>&2; \
397 exit 1; } || :
399 # Verify that all source files using _() are listed in po/POTFILES.in.
400 # FIXME: don't hard-code file names below; use a more general mechanism.
401 po-check:
402 if test -f po/POTFILES.in; then \
403 grep -E -v '^(#|$$)' po/POTFILES.in \
404 | grep -v '^src/false\.c$$' | sort > $@-1; \
405 files=; \
406 for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do \
407 case $$file in \
408 djgpp/* | man/*) continue;; \
409 */c99-to-c89.diff) continue;; \
410 esac; \
411 case $$file in \
412 *.[ch]) \
413 base=`expr " $$file" : ' \(.*\)\..'`; \
414 { test -f $$base.l || test -f $$base.y; } && continue;; \
415 esac; \
416 files="$$files $$file"; \
417 done; \
418 grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files \
419 | sort -u > $@-2; \
420 diff -u $@-1 $@-2 || exit 1; \
421 rm -f $@-1 $@-2; \
424 # In a definition of #define AUTHORS "... and ..." where the RHS contains
425 # the English word `and', the string must be marked with `N_ (...)' so that
426 # gettext recognizes it as a string requiring translation.
427 author_mark_check:
428 @shopt -s nullglob; \
429 grep -n '^# *define AUTHORS "[^"]* and ' src/*.c /dev/null \
430 | grep -v ' N_ (' && \
431 { echo '$(ME): enclose the above strings in N_ (...)' 1>&2; \
432 exit 1; } || :
434 # Sometimes it is useful to change the PATH environment variable
435 # in Makefiles. When doing so, it's better not to use the Unix-centric
436 # path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'.
437 # It'd be better to use `find -print0 ...|xargs -0 ...', but less portable,
438 # and there probably aren't many projects with so many Makefile.am files
439 # that we'd have to worry about limits on command line length.
440 msg = '$(ME): Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
441 makefile_path_separator_check:
442 @grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
443 && { echo $(msg) 1>&2; exit 1; } || :
445 # Check that `make alpha' will not fail at the end of the process.
446 writable-files:
447 if test -d $(release_archive_dir); then :; else \
448 mkdir $(release_archive_dir); \
450 for file in $(distdir).tar.gz $(xd-delta) \
451 $(release_archive_dir)/$(distdir).tar.gz \
452 $(release_archive_dir)/$(xd-delta); do \
453 test -e $$file || continue; \
454 test -w $$file \
455 || { echo ERROR: $$file is not writable; fail=1; }; \
456 done; \
457 test "$$fail" && exit 1 || :
459 v_etc_file = lib/version-etc.c
460 # Make sure that the copyright date in $(v_etc_file) is up to date.
461 copyright-check:
462 @if test -f $(v_etc_file); then \
463 grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
464 >/dev/null \
465 || { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
466 exit 1; }; \
469 vc-diff-check:
470 (CDPATH=; cd $(srcdir) && $(VC) diff) > vc-diffs || :
471 if test -s vc-diffs; then \
472 cat vc-diffs; \
473 echo "Some files are locally modified:" 1>&2; \
474 exit 1; \
475 else \
476 rm vc-diffs; \
479 cvs-check: vc-diff-check
481 maintainer-distcheck:
482 $(MAKE) distcheck
483 $(MAKE) my-distcheck
485 # Don't make a distribution if checks fail.
486 # Also, make sure the NEWS file is up-to-date.
487 vc-dist: $(local-check) cvs-check maintainer-distcheck
488 $(MAKE) dist
490 # Use this to make sure we don't run these programs when building
491 # from a virgin tgz file, below.
492 null_AM_MAKEFLAGS = \
493 ACLOCAL=false \
494 AUTOCONF=false \
495 AUTOMAKE=false \
496 AUTOHEADER=false \
497 MAKEINFO=false
499 # Detect format-string/arg-list mismatches that would normally be obscured
500 # by the use of _(). The --disable-nls effectively defines away that macro,
501 # and building with CFLAGS='-Wformat -Werror' causes any format warning to be
502 # treated as a failure. Also, check for shadowing problems with -Wshadow,
503 # and for pointer arithmetic problems with -Wpointer-arith.
504 # These CFLAGS are pretty strict. If you build this target, you probably
505 # have to have a recent version of gcc and glibc headers.
506 TMPDIR ?= /tmp
507 t=$(TMPDIR)/$(PACKAGE)/test
508 my-distcheck: $(local-check) $(release_archive_dir)/$(prev-tgz)
509 -rm -rf $(t)
510 mkdir -p $(t)
511 GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
512 cd $(t)/$(distdir) \
513 && ./configure --disable-nls \
514 && $(MAKE) CFLAGS='-Werror -Wall -Wformat -Wshadow -Wpointer-arith' \
515 AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
516 && $(MAKE) dvi \
517 && $(MAKE) check \
518 && $(MAKE) distclean
519 (cd $(t) && mv $(distdir) $(distdir).old \
520 && $(AMTAR) -zxf - ) < $(distdir).tar.gz
521 diff -ur $(t)/$(distdir).old $(t)/$(distdir)
522 -rm -rf $(t)
523 @echo "========================"; \
524 echo "$(distdir).tar.gz is ready for distribution"; \
525 echo "========================"
527 prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
528 xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
530 rel-files = $(xd-delta) $(DIST_ARCHIVES)
531 announcement: NEWS ChangeLog $(rel-files)
532 @$(announce_gen) \
533 --release-type=$(RELEASE_TYPE) \
534 --package=$(PACKAGE) \
535 --prev=$(PREV_VERSION) \
536 --curr=$(VERSION) \
537 --gpg-key-id=$(gpg_key_ID) \
538 --news=$(srcdir)/NEWS \
539 --bootstrap-tools=automake \
540 $(addprefix --url-dir=, $(url_dir_list))
542 ## ---------------- ##
543 ## Updating files. ##
544 ## ---------------- ##
546 ftp-gnu = ftp://ftp.gnu.org/gnu
547 www-gnu = http://www.gnu.org
549 # Use mv, if you don't have/want move-if-change.
550 move_if_change ?= move-if-change
553 # --------------------- #
554 # Updating everything. #
555 # --------------------- #
557 .PHONY: update
558 local_updates ?= cvs-update
559 update: $(local_updates)
562 # -------------------------- #
563 # Updating GNU build tools. #
564 # -------------------------- #
566 cvs_files ?= \
567 $(srcdir)/build-aux/depcomp \
568 $(srcdir)/build-aux/install-sh \
569 $(srcdir)/build-aux/missing
570 gnulib_repo=:pserver:anonymous@cvs.savannah.gnu.org:/sources/gnulib
571 .PHONY: wget-update
572 wget-update: $(get-targets)
574 .PHONY: cvs-update
575 cvs-update:
576 fail=; \
577 for f in $(cvs_files) dummy; do \
578 test $$f = dummy && continue; \
579 test -f $$f || { echo "*** skipping $$f" 1>&2; continue; }; \
580 cvs diff $$f > /dev/null \
581 || { echo "*** $$f is locally modified; skipping it" 1>&2; \
582 fail=yes; continue; }; \
583 file=$$(expr "X$$f" : 'X$(srcdir)/\(.*\)'); \
584 echo checking out $$file...; \
585 $(CVS) -d $(gnulib_repo) co -p gnulib/$$file >$$f.t \
586 && $(move_if_change) $$f.t $$f; \
587 done; \
588 test "$$fail" && exit 1
590 emit_upload_commands:
591 @echo =====================================
592 @echo =====================================
593 @echo "$(srcdir)/build-aux/gnupload $(GNUPLOADFLAGS) \\"
594 @echo " --to $(gnu_rel_host):$(PACKAGE) \\"
595 @echo " $(rel-files)"
596 @echo '# send the /tmp/announcement e-mail'
597 @echo =====================================
598 @echo =====================================
600 $(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
601 xdelta delta -9 $^ $@ || :
603 .PHONY: alpha beta major
604 alpha beta major: news-date-check changelog-check $(local-check)
605 test $@ = major \
606 && { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \
607 || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\
608 || :
609 $(MAKE) vc-dist
610 $(MAKE) $(xd-delta)
611 $(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
612 ln $(rel-files) $(release_archive_dir)
613 chmod a-w $(rel-files)
614 $(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
615 echo $(VERSION) > $(prev_version_file)
616 $(VC) commit -m \
617 '$(prev_version_file): Record previous version: $(VERSION).' \
618 $(prev_version_file)