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