Use gzip's --rsyncable option only if it's available.
[platform/upstream/coreutils.git] / Makefile.maint
1 # -*-Makefile-*-
2 # This Makefile fragment is shared between the coreutils,
3 # CPPI, Bison, and Autoconf.
4
5 ## Copyright (C) 2001-2006 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 2, or (at your option)
10 ## any later version.
11 ##
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.
16 ##
17 ## You should have received a copy of the GNU General Public License
18 ## along with this program; if not, write to the Free Software
19 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 ## 02110-1301, USA.
21
22 # This is reported not to work with make-3.79.1
23 # ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
24 ME := Makefile.maint
25
26 # Do not save the original name or timestamp in the .tar.gz file.
27 gzip_rsyncable := \
28   $(shell gzip --help|grep rsyncable >/dev/null && echo --rsyncable)
29 GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
30
31 CVS = cvs
32
33 # cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
34 CVS_LIST = $(srcdir)/build-aux/cvsu --find --types=AFGM
35
36 ifeq ($(origin prev_version_file), undefined)
37   prev_version_file = .prev-version
38 endif
39
40 PREV_VERSION := $(shell cat $(prev_version_file))
41 VERSION_REGEXP = $(subst .,\.,$(VERSION))
42
43 tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
44 tag-this-version = $(subst .,_,$(VERSION))
45 this-cvs-tag = $(tag-package)-$(tag-this-version)
46 my_distdir = $(PACKAGE)-$(VERSION)
47
48 # Old releases are stored here.
49 # Used for diffs and xdeltas.
50 release_archive_dir ?= ../release
51
52 # Prevent programs like 'sort' from considering distinct strings to be equal.
53 # Doing it here saves us from having to set LC_ALL elsewhere in this file.
54 export LC_ALL = C
55
56
57
58 ## --------------- ##
59 ## Sanity checks.  ##
60 ## --------------- ##
61
62 # FIXME: add a check to prohibit definition in src/*.c of symbols defined
63 # in system.h.  E.g. today I removed from tail.c a useless definition of
64 # ENOSYS.  It was useless because system.h ensures it's defined.
65
66 # Checks that don't require cvs.
67 # Run `changelog-check' last, as previous test may reveal problems requiring
68 # new ChangeLog entries.
69 local-checks-available = \
70   po-check copyright-check writable-files m4-check author_mark_check \
71   changelog-check strftime-check $(syntax-check-rules) \
72   makefile_path_separator_check \
73   makefile-check
74 .PHONY: $(local-checks-available)
75
76 local-check = $(filter-out $(local-checks-to-skip), $(local-checks-available))
77
78 .PHONY: $(syntax-check-rules)
79 syntax-check-rules = \
80   sc_cast_of_argument_to_free \
81   sc_cast_of_x_alloc_return_value \
82   sc_cast_of_alloca_return_value \
83   sc_dd_max_sym_length \
84   sc_error_exit_success \
85   sc_file_system \
86   sc_no_if_have_config_h \
87   sc_obsolete_symbols \
88   sc_prohibit_atoi_atof \
89   sc_prohibit_jm_in_m4 \
90   sc_prohibit_assert_without_use \
91   sc_require_config_h \
92   sc_root_tests \
93   sc_space_tab \
94   sc_sun_os_names \
95   sc_system_h_headers \
96   sc_tight_scope \
97   sc_trailing_blank \
98   sc_two_space_separator_in_usage \
99   sc_unmarked_diagnostics \
100   sc_useless_cpp_parens
101
102 syntax-check: $(syntax-check-rules)
103 #       @grep -E '#  *include <(limits|std(def|arg|bool))\.h>'          \
104 #           $$(find -type f -name '*.[chly]') &&                        \
105 #         { echo '$(ME): found conditional include' 1>&2;               \
106 #           exit 1; } || :
107
108 #       grep -E '^#  *include <(string|stdlib)\.h>'                     \
109 #           $(srcdir)/{lib,src}/*.[chy] &&                              \
110 #         { echo '$(ME): FIXME' 1>&2;                                   \
111 #           exit 1; } || :
112 # FIXME: don't allow `#include .strings\.h' anywhere
113
114 sc_cast_of_argument_to_free:
115         @grep -E '\<free \(\(' $(srcdir)/{lib,src}/*.[chly] &&          \
116           { echo '$(ME): don'\''t cast free argument' 1>&2;             \
117             exit 1; } || :
118
119 sc_cast_of_x_alloc_return_value:
120         @grep -E --exclude=$(srcdir)/lib/regex.c                        \
121             '\*\) *x(m|c|re)alloc\>'                                    \
122             $(srcdir)/{lib,src}/*.[chy] &&                              \
123           { echo '$(ME): don'\''t cast x*alloc return value' 1>&2;      \
124             exit 1; } || :
125
126 sc_cast_of_alloca_return_value:
127         @grep -E '\*\) *alloca\>'                                       \
128             $(srcdir)/src/*.[chy] &&                                    \
129           { echo '$(ME): don'\''t cast alloca return value' 1>&2;       \
130             exit 1; } || :
131
132 sc_space_tab:
133         @( $(CVS_LIST) ) > /dev/null 2>&1 || : &&                       \
134           grep '[ ]     '                                               \
135              $$($(CVS_LIST) | grep -vEf .x-$@ ) &&                      \
136           { echo '$(ME): found SPACE-TAB sequence; remove the SPACE'    \
137                 1>&2; exit 1; } || :
138
139 # Don't use atoi, atof, atol, atoll, or atoq in `real' code.
140 # They provide no error checking mechanism.
141 # Instead, use strto* functions.
142 sc_prohibit_atoi_atof:
143         @( $(CVS_LIST) ) > /dev/null 2>&1 || : &&                       \
144           grep -E '\<(ato[filq]|atoll)\>'                               \
145              $$($(CVS_LIST) | grep -vEf .x-$@ ) &&                      \
146           { echo '$(ME): do not use atof, atoi, atol, atoll, or atoq'   \
147                 1>&2; exit 1; } || :
148
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 -F 'error (EXIT_SUCCESS,'                                 \
153             $$(find -type f -name '*.[chly]') &&                        \
154           { echo '$(ME): found error (EXIT_SUCCESS' 1>&2;               \
155             exit 1; } || :
156
157 sc_file_system:
158         @grep -i 'filesystem'                                           \
159              $$($(CVS_LIST) | grep -vEf .x-$@ ) &&                      \
160           { echo '$(ME): found use of "filesystem";'                    \
161             'rewrite to use "file system"' 1>&2;                        \
162             exit 1; } || :
163
164 sc_no_if_have_config_h:
165         @( $(CVS_LIST) ) > /dev/null 2>&1 || : &&                       \
166           grep '^# *if HAVE_CONFIG_H'                                   \
167              $$($(CVS_LIST) | grep -vEf .x-$@ ) &&                      \
168           { echo '$(ME): found use of #if HAVE_CONFIG_H; use #ifdef'    \
169                 1>&2; exit 1; } || :
170
171 # Nearly all .c files must include <config.h>.
172 sc_require_config_h:
173         @( $(CVS_LIST) ) > /dev/null 2>&1 || : &&                       \
174           grep -L '^# *include <config\.h>'                             \
175               $$($(CVS_LIST) | grep '\.c$$' | grep -vEf .x-$@ )         \
176             | grep . &&                                                 \
177           { echo '$(ME): the above files do not include <config.h>'     \
178                 1>&2; exit 1; } || :
179
180 # Prohibit the inclusion of assert.h without an actual use of assert.
181 sc_prohibit_assert_without_use:
182         @( $(CVS_LIST) ) > /dev/null 2>&1 || : &&                       \
183           grep -L '\<assert ('                                          \
184             $$(grep -l '# *include <assert\.h>'                         \
185               $$($(CVS_LIST) | grep '\.c$$' | grep -vEf .x-$@ ))        \
186             | grep . &&                                                 \
187           { echo "$(ME): the above files include <assert.h> but don't use it" \
188                 1>&2; exit 1; } || :
189
190 sc_obsolete_symbols:
191         @( $(CVS_LIST) ) > /dev/null 2>&1 || : &&                       \
192           grep -E '\<(HAVE_FCNTL_H|O_NDELAY)\>'                         \
193              $$($(CVS_LIST) | grep -vEf .x-$@ ) &&                      \
194           { echo '$(ME): do not use HAVE_FCNTL_H or O_NDELAY'           \
195                 1>&2; exit 1; } || :
196
197 # FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
198
199 # Each nonempty line must start with a year number, or a TAB.
200 sc_changelog:
201         @grep '^[^12    ]' $$(find . -maxdepth 2 -name ChangeLog) &&    \
202           { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2;  \
203             exit 1; } || :
204
205 # Ensure that dd's definition of LONGEST_SYMBOL stays in sync
206 # with the strings from the two affected variables.
207 dd_c = $(srcdir)/src/dd.c
208 sc_dd_max_sym_length:
209         @test -f $(dd_c) || exit 0;                             \
210         len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c); \
211                  sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) )      \
212                 |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p'         \
213               | wc --max-line-length);                          \
214         max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
215               |tr -d '"' | wc --max-line-length);               \
216         if test "$$len" = "$$max"; then :; else                 \
217           echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2;      \
218           exit 1;                                               \
219         fi
220
221 # Many m4 macros names once began with `jm_'.
222 # On 2004-04-13, they were all changed to start with gl_ instead.
223 # Make sure that none are inadvertently reintroduced.
224 sc_prohibit_jm_in_m4:
225         @( $(CVS_LIST) ) > /dev/null 2>&1 || : &&                       \
226           grep -E 'jm_[A-Z]'                                            \
227                 $$($(CVS_LIST) $(srcdir)/m4 |grep '\.m4$$') &&          \
228             { echo '$(ME): do not use jm_ in m4 macro names'            \
229               1>&2; exit 1; } || :
230
231 sc_root_tests:
232         @t1=sc-root.expected; t2=sc-root.actual;                        \
233         grep -l '^PRIV_CHECK_ARG=require-root'                          \
234           $$($(CVS_LIST) tests) |sed s,tests,., |sort > $$t1;           \
235         sed -n 's,      cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \
236           $(srcdir)/tests/Makefile.am |sort > $$t2;                     \
237         diff -u $$t1 $$t2 || diff=1;                                    \
238         rm -f $$t1 $$t2;                                                \
239         test "$$diff"                                                   \
240           && { echo 'tests/Makefile.am: missing check-root action'>&2;  \
241                exit 1; } || :
242
243 # Create a list of regular expressions matching the names
244 # of files included from system.h.  Exclude a couple.
245 .re-list:
246         @sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
247           | grep -Ev 'sys/(param|file)\.h' \
248           | sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
249           > $@-t
250         @mv $@-t $@
251
252 # Files in src/ should not include directly any of
253 # the headers already included via system.h.
254 sc_system_h_headers: .re-list
255         @if test -f $(srcdir)/src/system.h; then                        \
256           ( $(CVS_LIST) ) > /dev/null 2>&1 || exit 0;                   \
257           trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15;          \
258           grep -E -f .re-list                                           \
259               $$($(CVS_LIST) src | grep -Ev '(copy|system)\.h$$')       \
260             && { echo '$(ME): the above are already included via system.h'\
261                   1>&2;  exit 1; } || :;                                \
262         fi
263
264 sc_sun_os_names:
265         @( $(CVS_LIST) ) > /dev/null 2>&1 || : && \
266         grep -Ei \
267             'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
268           $$($(CVS_LIST) | grep -vEf .x-$@ ) &&                         \
269           { echo '$(ME): found misuse of Sun OS version numbers' 1>&2;  \
270             exit 1; } || :
271
272 sc_tight_scope:
273         $(MAKE) -C src $@
274
275 sc_trailing_blank:
276         @( $(CVS_LIST) ) > /dev/null 2>&1 || : &&                       \
277           grep '[        ]$$'                                           \
278              $$($(CVS_LIST) | grep -vEf .x-$@ ) &&                      \
279           { echo '$(ME): found trailing blank(s)'                       \
280                 1>&2; exit 1; } || :
281
282 sc_two_space_separator_in_usage:
283         @( $(CVS_LIST) ) > /dev/null 2>&1 || : &&                       \
284           grep '^   *--[a-z][0-9A-Za-z-]* [^ ].*\\$$'                   \
285             $$($(CVS_LIST) | grep 'src/.*\.c$$' | grep -vEf .x-$@) &&   \
286           { echo "$(ME): help2man requires at least two spaces between"; \
287             echo "$(ME): an option and its description"; \
288                 1>&2; exit 1; } || :
289
290 # Look for diagnostics that aren't marked for translation.
291 # This won't find any for which error's format string is on a separate line.
292 sc_unmarked_diagnostics:
293         @( $(CVS_LIST) ) > /dev/null 2>&1 || : &&                       \
294           grep -E                                                       \
295             '\<error \([^"]*"[^"]*[a-z]{3}'                             \
296              $$($(CVS_LIST) | grep -vEf .x-$@ )                         \
297           | grep -v '_(' &&                                             \
298           { echo '$(ME): found unmarked diagnostic(s)' 1>&2;            \
299             exit 1; } || :
300
301 # Avoid useless parentheses like those in this example:
302 # #if defined (SYMBOL) || defined (SYM2)
303 sc_useless_cpp_parens:
304         @( $(CVS_LIST) ) > /dev/null 2>&1 || : &&                       \
305           grep '^# *if .*defined *('                                    \
306              $$($(CVS_LIST) | grep -vEf .x-$@ ) &&                      \
307           { echo '$(ME): found useless parentheses in cpp directive'    \
308                 1>&2; exit 1; } || :
309
310 # Ensure that date's --help output stays in sync with the info
311 # documentation for GNU strftime.  The only exception is %N,
312 # which date accepts but GNU strftime does not.
313 extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
314 strftime-check:
315         if test -f $(srcdir)/src/date.c; then                           \
316           grep '^  %.  ' $(srcdir)/src/date.c | sort                    \
317             | $(extract_char) > $@-src;                                 \
318           { echo N;                                                     \
319             info libc date calendar format | grep '^    `%.'\'          \
320               | $(extract_char); } | sort > $@-info;                    \
321           diff -u $@-src $@-info || exit 1;                             \
322           rm -f $@-src $@-info;                                         \
323         fi
324
325 # Ensure that we use only the standard $(VAR) notation,
326 # not @...@ in Makefile.am, now that we can rely on automake
327 # to emit a definition for each substituted variable.
328 makefile-check:
329         grep -E '@[A-Z_0-9]+@' `find . -name Makefile.am` \
330           && { echo 'Makefile.maint: use $$(...), not @...@' 1>&2; exit 1; } || :
331
332 news-date-check: NEWS
333         today=`date +%Y-%m-%d`; \
334         if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
335             >/dev/null; then \
336           :; \
337         else \
338           echo "version or today's date is not in NEWS" 1>&2; \
339           exit 1; \
340         fi
341
342 changelog-check:
343         if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
344             >/dev/null; then \
345           :; \
346         else \
347           echo "$(VERSION) not in ChangeLog" 1>&2; \
348           exit 1; \
349         fi
350
351 m4-check:
352         @grep 'AC_DEFUN([^[]' m4/*.m4 \
353           && { echo 'Makefile.maint: quote the first arg to AC_DEFUN' 1>&2; \
354                exit 1; } || :
355
356 # Verify that all source files using _() are listed in po/POTFILES.in.
357 # FIXME: don't hard-code src/false.c below; use a more general mechanism.
358 po-check:
359         ( $(CVS_LIST) ) > /dev/null 2>&1 || : &&                        \
360         if test -f po/POTFILES.in; then                                 \
361           grep -E -v '^(#|$$)' po/POTFILES.in                           \
362             | grep -v '^src/false\.c$$' | sort > $@-1;                  \
363           files=;                                                       \
364           for file in $$($(CVS_LIST) lib src | grep '\.[chly]$$'); do   \
365             case $$file in                                              \
366             *.[ch])                                                     \
367               base=`expr " $$file" : ' \(.*\)\..'`;                     \
368               { test -f $$base.l || test -f $$base.y; } && continue;;   \
369             esac;                                                       \
370             files="$$files $$file";                                     \
371           done;                                                         \
372           grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort > $@-2;       \
373           diff -u $@-1 $@-2 || exit 1;                                  \
374           rm -f $@-1 $@-2;                                              \
375         fi
376
377 # In a definition of #define AUTHORS "... and ..." where the RHS contains
378 # the English word `and', the string must be marked with `N_ (...)' so that
379 # gettext recognizes it as a string requiring translation.
380 author_mark_check:
381         @grep '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
382           { echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \
383             exit 1; } || :
384
385 # Sometimes it is useful to change the PATH environment variable
386 # in Makefiles.  When doing so, it's better not to use the Unix-centric
387 # path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'.
388 # It'd be better to use `find -print0 ...|xargs -0 ...', but less portable,
389 # and there probably aren't many projects with so many Makefile.am files
390 # that we'd have to worry about limits on command line length.
391 msg = 'Makefile.maint: Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
392 makefile_path_separator_check:
393         @grep 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
394           && { echo $(msg) 1>&2; exit 1; } || :
395
396 # Check that `make alpha' will not fail at the end of the process.
397 writable-files:
398         if test -d $(release_archive_dir); then :; else                 \
399           mkdir $(release_archive_dir);                                 \
400         fi
401         for file in $(distdir).tar.gz $(xd-delta)                       \
402                     $(release_archive_dir)/$(distdir).tar.gz            \
403                     $(release_archive_dir)/$(xd-delta); do              \
404           test -e $$file || continue;                                   \
405           test -w $$file                                                \
406             || { echo ERROR: $$file is not writable; fail=1; };         \
407         done;                                                           \
408         test "$$fail" && exit 1 || :
409
410 v_etc_file = lib/version-etc.c
411 # Make sure that the copyright date in $(v_etc_file) is up to date.
412 copyright-check:
413         @if test -f $(v_etc_file); then \
414           grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
415             >/dev/null \
416           || { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
417                exit 1; }; \
418         fi
419
420
421 # Sanity checks with the CVS repository.
422 cvs-tag-check:
423         echo $(this-cvs-tag); \
424         if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
425           echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
426           exit 1; \
427         else :; fi
428
429 cvs-diff-check:
430         if $(CVS) diff >cvs-diffs; then                         \
431           rm cvs-diffs;                                         \
432         else                                                    \
433           echo "Some files are locally modified:" 1>&2;         \
434           cat cvs-diffs;                                        \
435           exit 1;                                               \
436         fi
437
438 cvs-check: cvs-diff-check cvs-tag-check
439
440 maintainer-distcheck: changelog-check
441         $(MAKE) distcheck
442         $(MAKE) my-distcheck
443
444
445 # Tag before making distribution.  Also, don't make a distribution if
446 # checks fail.  Also, make sure the NEWS file is up-to-date.
447 # FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
448 cvs-dist: $(local-check) cvs-check maintainer-distcheck
449         $(CVS) update po
450         $(CVS) tag -c $(this-cvs-tag)
451         $(MAKE) dist
452
453 # Use this to make sure we don't run these programs when building
454 # from a virgin tgz file, below.
455 null_AM_MAKEFLAGS = \
456   ACLOCAL=false \
457   AUTOCONF=false \
458   AUTOMAKE=false \
459   AUTOHEADER=false \
460   MAKEINFO=false
461
462 # Detect format-string/arg-list mismatches that would normally be obscured
463 # by the use of _().  The --disable-nls effectively defines away that macro,
464 # and building with CFLAGS='-Wformat -Werror' causes any format warning to be
465 # treated as a failure.  Also, check for shadowing problems with -Wshadow.
466 # These CFLAGS are pretty strict.  If you build this target, you probably
467 # have to have a recent version of gcc and glibc headers.
468 TMPDIR ?= /tmp
469 t=$(TMPDIR)/$(PACKAGE)/test
470 my-distcheck: $(local-check) $(release_archive_dir)/$(prev-tgz)
471         -rm -rf $(t)
472         mkdir -p $(t)
473         GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
474         cd $(t)/$(distdir)                              \
475           && ./configure --disable-nls                  \
476           && $(MAKE) CFLAGS='-Werror -Wall -Wformat -Wshadow' \
477               AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)'       \
478           && $(MAKE) dvi                                \
479           && $(MAKE) check                              \
480           && $(MAKE) distclean
481         (cd $(t) && mv $(distdir) $(distdir).old        \
482           && $(AMTAR) -zxf - ) < $(distdir).tar.gz
483         diff -ur $(t)/$(distdir).old $(t)/$(distdir)
484         -rm -rf $(t)
485         @echo "========================"; \
486         echo "$(distdir).tar.gz is ready for distribution"; \
487         echo "========================"
488
489 WGET = wget
490 WGETFLAGS = -C off
491
492 rel-check:
493         tarz=/tmp/rel-check-tarz-$$$$; \
494         md5_tmp=/tmp/rel-check-md5-$$$$; \
495         set -e; \
496         trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
497         $(WGET) $(WGETFLAGS) -q --output-document=$$tarz $(url); \
498         echo "$(md5)  -" > $$md5_tmp; \
499         md5sum -c $$md5_tmp < $$tarz
500
501 prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
502 xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
503
504 rel-files = $(xd-delta) $(DIST_ARCHIVES)
505 announcement: NEWS ChangeLog $(rel-files)
506         @./announce-gen                                                 \
507             --release-type=$(RELEASE_TYPE)                              \
508             --package=$(PACKAGE)                                        \
509             --prev=$(PREV_VERSION)                                      \
510             --curr=$(VERSION)                                           \
511             --release-archive-directory=$(release_archive_dir)          \
512             --gpg-key-id=$(gpg_key_ID)                                  \
513             --news=NEWS                                                 \
514             $(addprefix --url-dir=, $(url_dir_list))                    \
515
516
517 ## ---------------- ##
518 ## Updating files.  ##
519 ## ---------------- ##
520
521 ftp-gnu = ftp://ftp.gnu.org/gnu
522 www-gnu = http://www.gnu.org
523
524 # Use mv, if you don't have/want move-if-change.
525 move_if_change ?= move-if-change
526
527
528 # --------------------- #
529 # Updating everything.  #
530 # --------------------- #
531
532 .PHONY: update
533 local_updates ?= wget-update cvs-update po-update
534 update: $(local_updates)
535
536
537 # ------------------- #
538 # Updating PO files.  #
539 # ------------------- #
540
541 po_repo = http://www.iro.umontreal.ca/contrib/po/maint/$(PACKAGE)
542 .PHONY: do-po-update po-update
543 do-po-update:
544         tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
545         rm -rf $$tmppo && \
546         mkdir $$tmppo && \
547         (cd $$tmppo && \
548           $(WGET) $(WGETFLAGS) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
549         cp $$tmppo/*.po po
550         cd po && $(MAKE) update-po
551         $(MAKE) po-check
552
553 po-update:
554         if test -d "po"; then \
555           $(MAKE) do-po-update; \
556         fi
557
558 # -------------------------- #
559 # Updating GNU build tools.  #
560 # -------------------------- #
561
562 # The following pseudo table associates a local directory and a URL
563 # with each of the files that belongs to some other package and is
564 # regularly updated from the specified URL.
565 wget_files ?= \
566   $(srcdir)/build-aux/config.guess \
567   $(srcdir)/build-aux/config.sub \
568   $(srcdir)/build-aux/texinfo.tex \
569   $(srcdir)/src/ansi2knr.c
570
571 get-targets = $(patsubst %, get-%, $(wget_files))
572
573 config.guess-url_prefix = $(ftp-gnu)/build-aux/
574 config.sub-url_prefix = $(ftp-gnu)/build-aux/
575
576 ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
577
578 texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
579
580 standards.texi-url_prefix = $(www-gnu)/prep/
581 make-stds.texi-url_prefix = $(standards.texi-url_prefix)
582
583 target = $(patsubst get-%, %, $@)
584 url = $($(notdir $(target))-url_prefix)$(notdir $(target))
585
586 .PHONY: $(get-targets)
587 $(get-targets):
588         $(WGET) $(WGETFLAGS) $(url) -O $(target).t \
589           && $(move_if_change) $(target).t $(target)
590
591 cvs_files ?= \
592   $(srcdir)/build-aux/depcomp \
593   $(srcdir)/build-aux/install-sh \
594   $(srcdir)/build-aux/missing \
595   $(srcdir)/build-aux/mkinstalldirs \
596   $(srcdir)/src/ansi2knr.c
597 automake_repo=:pserver:anoncvs:anoncvs@sources.redhat.com:/cvs/automake
598 .PHONY: wget-update
599 wget-update: $(get-targets)
600
601 .PHONY: cvs-update
602 cvs-update:
603         fail=;                                                          \
604         for f in $(cvs_files); do                                       \
605           test -f $$f || { echo "*** skipping $$f" 1>&2; continue; };   \
606           cvs diff $$f > /dev/null                                      \
607             || { echo "*** $$f is locally modified; skipping it" 1>&2;  \
608                  fail=yes; continue; };                                 \
609           file=$$(basename $$f);                                        \
610           echo checking out $$file...;                                  \
611           $(CVS) -d $(automake_repo) co -p automake/lib/$$file> $$f.t   \
612             && $(move_if_change) $$f.t $$f;                             \
613         done;                                                           \
614         test "$$fail" && exit 1
615
616 emit_upload_commands:
617         @echo =====================================
618         @echo =====================================
619         @echo "$(srcdir)/gnupload $(GNUPLOADFLAGS) \\"
620         @echo "    --to $(gnu_rel_host):coreutils \\"
621         @echo "  $(rel-files)"
622         @echo '# send the /tmp/announcement e-mail'
623         @echo =====================================
624         @echo =====================================
625
626 $(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
627         xdelta delta -9 $^ $@ || :
628
629 .PHONY: alpha beta major
630 alpha beta major: news-date-check $(local-check)
631         $(MAKE) cvs-dist
632         $(MAKE) $(xd-delta)
633         $(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
634         ln $(rel-files) $(release_archive_dir)
635         chmod a-w $(rel-files)
636         $(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
637         echo $(VERSION) > $(prev_version_file)
638         $(CVS) ci -m. $(prev_version_file)