]>
Commit | Line | Data |
---|---|---|
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 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/>. | |
19 | ||
20 | # This is reported not to work with make-3.79.1 | |
21 | # ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) | |
22 | ME := Makefile.maint | |
23 | ||
24 | # Do not save the original name or timestamp in the .tar.gz file. | |
25 | # Use --rsyncable if available. | |
26 | gzip_rsyncable = \ | |
27 | (gzip --help|grep rsyncable) >/dev/null 2>&1 && echo --rsyncable | |
28 | GZIP_ENV = "--no-name --best `$(gzip_rsyncable)`" | |
29 | ||
30 | CVS = cvs | |
31 | ||
32 | # cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/ | |
33 | CVS_LIST = sh -c ' \ | |
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 \ | |
45 | ' dummy | |
46 | ||
47 | CVS_LIST_EXCEPT = \ | |
48 | $(CVS_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi | |
49 | ||
50 | ifeq ($(origin prev_version_file), undefined) | |
51 | prev_version_file = .prev-version | |
52 | endif | |
53 | ||
54 | PREV_VERSION := $(shell cat $(prev_version_file)) | |
55 | VERSION_REGEXP = $(subst .,\.,$(VERSION)) | |
56 | ||
57 | tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]') | |
58 | tag-this-version = $(subst .,_,$(VERSION)) | |
59 | this-cvs-tag = $(tag-package)-$(tag-this-version) | |
60 | my_distdir = $(PACKAGE)-$(VERSION) | |
61 | ||
62 | # Old releases are stored here. | |
63 | # Used for diffs and xdeltas. | |
64 | release_archive_dir ?= ../release | |
65 | ||
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. | |
68 | export LC_ALL = C | |
69 | ||
70 | ||
71 | ||
72 | ## --------------- ## | |
73 | ## Sanity checks. ## | |
74 | ## --------------- ## | |
75 | ||
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 | ||
80 | # Checks that don't require cvs. | |
81 | # Run `changelog-check' last, as previous test may reveal problems requiring | |
82 | # new ChangeLog entries. | |
83 | local-checks-available = \ | |
84 | po-check copyright-check writable-files m4-check author_mark_check \ | |
85 | changelog-check strftime-check $(syntax-check-rules) \ | |
86 | makefile_path_separator_check \ | |
87 | makefile-check | |
88 | .PHONY: $(local-checks-available) | |
89 | ||
90 | local-check = $(filter-out $(local-checks-to-skip), $(local-checks-available)) | |
91 | ||
92 | .PHONY: $(syntax-check-rules) | |
93 | syntax-check-rules = \ | |
94 | sc_cast_of_argument_to_free \ | |
95 | sc_cast_of_x_alloc_return_value \ | |
96 | sc_cast_of_alloca_return_value \ | |
97 | sc_changelog \ | |
98 | sc_dd_max_sym_length \ | |
99 | sc_error_exit_success \ | |
100 | sc_file_system \ | |
101 | sc_no_if_have_config_h \ | |
102 | sc_obsolete_symbols \ | |
103 | sc_prohibit_atoi_atof \ | |
104 | sc_prohibit_jm_in_m4 \ | |
105 | sc_prohibit_assert_without_use \ | |
106 | sc_require_config_h \ | |
107 | sc_root_tests \ | |
108 | sc_space_tab \ | |
109 | sc_sun_os_names \ | |
110 | sc_system_h_headers \ | |
111 | sc_tight_scope \ | |
112 | sc_trailing_blank \ | |
113 | sc_two_space_separator_in_usage \ | |
114 | sc_unmarked_diagnostics \ | |
115 | sc_useless_cpp_parens | |
116 | ||
117 | syntax-check: $(syntax-check-rules) | |
118 | # @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \ | |
119 | # $$(find -type f -name '*.[chly]') && \ | |
120 | # { echo '$(ME): found conditional include' 1>&2; \ | |
121 | # exit 1; } || : | |
122 | ||
123 | # grep -nE '^# *include <(string|stdlib)\.h>' \ | |
124 | # $(srcdir)/{lib,src}/*.[chy] && \ | |
125 | # { echo '$(ME): FIXME' 1>&2; \ | |
126 | # exit 1; } || : | |
127 | # FIXME: don't allow `#include .strings\.h' anywhere | |
128 | ||
129 | sc_cast_of_argument_to_free: | |
130 | @grep -nE '\<free \(\(' $(srcdir)/{lib,src}/*.[chly] && \ | |
131 | { echo '$(ME): don'\''t cast free argument' 1>&2; \ | |
132 | exit 1; } || : | |
133 | ||
134 | sc_cast_of_x_alloc_return_value: | |
135 | @grep -nE --exclude=$(srcdir)/lib/regex.c \ | |
136 | '\*\) *x(m|c|re)alloc\>' \ | |
137 | $(srcdir)/{lib,src}/*.[chy] && \ | |
138 | { echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \ | |
139 | exit 1; } || : | |
140 | ||
141 | sc_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 | ||
147 | sc_space_tab: | |
148 | @grep -n '[ ] ' $$($(CVS_LIST_EXCEPT)) && \ | |
149 | { echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \ | |
150 | 1>&2; exit 1; } || : | |
151 | ||
152 | # Don't use the old ato* functions in `real' code. | |
153 | # They provide no error checking mechanism. | |
154 | # Instead, use strto* functions. | |
155 | sc_prohibit_atoi_atof: | |
156 | @grep -nE '\<ato([filq]|ll)\>' $$($(CVS_LIST_EXCEPT)) && \ | |
157 | { echo '$(ME): do not use ato''f, ato''i, ato''l, ato''ll, or ato''q' \ | |
158 | 1>&2; exit 1; } || : | |
159 | ||
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. | |
162 | sc_error_exit_success: | |
163 | @grep -nF 'error (EXIT_SUCCESS,' \ | |
164 | $$(find -type f -name '*.[chly]') && \ | |
165 | { echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \ | |
166 | exit 1; } || : | |
167 | ||
168 | sc_file_system: | |
169 | @grep -ni 'file''system' $$($(CVS_LIST_EXCEPT)) && \ | |
170 | { echo '$(ME): found use of "file''system";' \ | |
171 | 'rewrite to use "file system"' 1>&2; \ | |
172 | exit 1; } || : | |
173 | ||
174 | sc_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>. | |
180 | sc_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. | |
188 | sc_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 | ||
196 | sc_obsolete_symbols: | |
197 | @grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \ | |
198 | $$($(CVS_LIST_EXCEPT)) && \ | |
199 | { echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \ | |
200 | 1>&2; exit 1; } || : | |
201 | ||
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. | |
205 | sc_changelog: | |
206 | @grep -n '^[^12 ]' $$(find . -maxdepth 2 -name ChangeLog) && \ | |
207 | { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \ | |
208 | exit 1; } || : | |
209 | ||
210 | # Ensure that dd's definition of LONGEST_SYMBOL stays in sync | |
211 | # with the strings from the two affected variables. | |
212 | dd_c = $(srcdir)/src/dd.c | |
213 | sc_dd_max_sym_length: | |
214 | ifneq ($(wildcard $(dd_c)),) | |
215 | @len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\ | |
216 | sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \ | |
217 | |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \ | |
218 | | wc --max-line-length); \ | |
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 | |
225 | endif | |
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. | |
230 | sc_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 | ||
236 | sc_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 $@ | |
256 | ||
257 | # Files in src/ should not include directly any of | |
258 | # the headers already included via system.h. | |
259 | sc_system_h_headers: .re-list | |
260 | @if test -f $(srcdir)/src/system.h; then \ | |
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 | |
268 | ||
269 | sc_sun_os_names: | |
270 | @grep -nEi \ | |
271 | 'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \ | |
272 | $$($(CVS_LIST_EXCEPT)) && \ | |
273 | { echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \ | |
274 | exit 1; } || : | |
275 | ||
276 | sc_tight_scope: | |
277 | $(MAKE) -C src $@ | |
278 | ||
279 | sc_trailing_blank: | |
280 | @grep -n '[ ]$$' $$($(CVS_LIST_EXCEPT)) && \ | |
281 | { echo '$(ME): found trailing blank(s)' \ | |
282 | 1>&2; exit 1; } || : | |
283 | ||
284 | sc_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 | ||
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. | |
293 | sc_unmarked_diagnostics: | |
294 | @grep -nE \ | |
295 | '\<error \([^"]*"[^"]*[a-z]{3}' $$($(CVS_LIST_EXCEPT)) \ | |
296 | | grep -v '_''(' && \ | |
297 | { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \ | |
298 | exit 1; } || : | |
299 | ||
300 | # Avoid useless parentheses like those in this example: | |
301 | # #if defined (SYMBOL) || defined (SYM2) | |
302 | sc_useless_cpp_parens: | |
303 | @grep -n '^# *if .*defined *(' $$($(CVS_LIST_EXCEPT)) && \ | |
304 | { echo '$(ME): found useless parentheses in cpp directive' \ | |
305 | 1>&2; exit 1; } || : | |
306 | ||
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. | |
310 | extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/' | |
311 | strftime-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 | |
321 | ||
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. | |
325 | makefile-check: | |
326 | grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \ | |
327 | && { echo 'Makefile.maint: use $$(...), not @...@' 1>&2; exit 1; } || : | |
328 | ||
329 | news-date-check: NEWS | |
330 | today=`date +%Y-%m-%d`; \ | |
331 | if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \ | |
332 | >/dev/null; then \ | |
333 | :; \ | |
334 | else \ | |
335 | echo "version or today's date is not in NEWS" 1>&2; \ | |
336 | exit 1; \ | |
337 | fi | |
338 | ||
339 | changelog-check: | |
340 | if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \ | |
341 | >/dev/null; then \ | |
342 | :; \ | |
343 | else \ | |
344 | echo "$(VERSION) not in ChangeLog" 1>&2; \ | |
345 | exit 1; \ | |
346 | fi | |
347 | ||
348 | m4-check: | |
349 | @grep -n 'AC_DEFUN([^[]' m4/*.m4 \ | |
350 | && { echo 'Makefile.maint: quote the first arg to AC_DEFUN' 1>&2; \ | |
351 | exit 1; } || : | |
352 | ||
353 | # Verify that all source files using _() are listed in po/POTFILES.in. | |
354 | # FIXME: don't hard-code file names below; use a more general mechanism. | |
355 | po-check: | |
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=; \ | |
360 | for file in $$($(CVS_LIST_EXCEPT)) lib/*.[ch]; do \ | |
361 | case $$file in \ | |
362 | djgpp/* | man/*) continue;; \ | |
363 | esac; \ | |
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; \ | |
371 | grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort -u > $@-2; \ | |
372 | diff -u $@-1 $@-2 || exit 1; \ | |
373 | rm -f $@-1 $@-2; \ | |
374 | fi | |
375 | ||
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. | |
379 | author_mark_check: | |
380 | @grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \ | |
381 | { echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \ | |
382 | exit 1; } || : | |
383 | ||
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. | |
390 | msg = 'Makefile.maint: Do not use `:'\'' above; use @PATH_SEPARATOR@ instead' | |
391 | makefile_path_separator_check: | |
392 | @grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \ | |
393 | && { echo $(msg) 1>&2; exit 1; } || : | |
394 | ||
395 | # Check that `make alpha' will not fail at the end of the process. | |
396 | writable-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 | ||
409 | v_etc_file = lib/version-etc.c | |
410 | # Make sure that the copyright date in $(v_etc_file) is up to date. | |
411 | copyright-check: | |
412 | @if test -f $(v_etc_file); then \ | |
413 | grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \ | |
414 | >/dev/null \ | |
415 | || { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \ | |
416 | exit 1; }; \ | |
417 | fi | |
418 | ||
419 | ||
420 | # Sanity checks with the CVS repository. | |
421 | cvs-tag-check: | |
422 | echo $(this-cvs-tag); \ | |
423 | if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \ | |
424 | echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \ | |
425 | exit 1; \ | |
426 | else :; fi | |
427 | ||
428 | cvs-diff-check: | |
429 | if $(CVS) diff >cvs-diffs; then \ | |
430 | rm cvs-diffs; \ | |
431 | else \ | |
432 | echo "Some files are locally modified:" 1>&2; \ | |
433 | cat cvs-diffs; \ | |
434 | exit 1; \ | |
435 | fi | |
436 | ||
437 | cvs-check: cvs-diff-check cvs-tag-check | |
438 | ||
439 | maintainer-distcheck: changelog-check | |
440 | $(MAKE) distcheck | |
441 | $(MAKE) my-distcheck | |
442 | ||
443 | ||
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. | |
447 | cvs-dist: $(local-check) cvs-check maintainer-distcheck | |
448 | $(CVS) update po | |
449 | $(CVS) tag -c $(this-cvs-tag) | |
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. | |
454 | null_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 | |
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. | |
467 | TMPDIR ?= /tmp | |
468 | t=$(TMPDIR)/$(PACKAGE)/test | |
469 | my-distcheck: $(local-check) $(release_archive_dir)/$(prev-tgz) | |
470 | -rm -rf $(t) | |
471 | mkdir -p $(t) | |
472 | GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz | |
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 \ | |
479 | && $(MAKE) distclean | |
480 | (cd $(t) && mv $(distdir) $(distdir).old \ | |
481 | && $(AMTAR) -zxf - ) < $(distdir).tar.gz | |
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 | ||
488 | WGET = wget | |
489 | WGETFLAGS = -C off | |
490 | ||
491 | rel-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; \ | |
496 | $(WGET) $(WGETFLAGS) -q --output-document=$$tarz $(url); \ | |
497 | echo "$(md5) -" > $$md5_tmp; \ | |
498 | md5sum -c $$md5_tmp < $$tarz | |
499 | ||
500 | prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz | |
501 | xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta | |
502 | ||
503 | rel-files = $(xd-delta) $(DIST_ARCHIVES) | |
504 | announcement: NEWS ChangeLog $(rel-files) | |
505 | @./announce-gen \ | |
506 | --release-type=$(RELEASE_TYPE) \ | |
507 | --package=$(PACKAGE) \ | |
508 | --prev=$(PREV_VERSION) \ | |
509 | --curr=$(VERSION) \ | |
510 | --release-archive-directory=$(release_archive_dir) \ | |
511 | --gpg-key-id=$(gpg_key_ID) \ | |
512 | --news=NEWS \ | |
513 | $(addprefix --url-dir=, $(url_dir_list)) \ | |
514 | ||
515 | ||
516 | ## ---------------- ## | |
517 | ## Updating files. ## | |
518 | ## ---------------- ## | |
519 | ||
520 | ftp-gnu = ftp://ftp.gnu.org/gnu | |
521 | www-gnu = http://www.gnu.org | |
522 | ||
523 | # Use mv, if you don't have/want move-if-change. | |
524 | move_if_change ?= move-if-change | |
525 | ||
526 | ||
527 | # --------------------- # | |
528 | # Updating everything. # | |
529 | # --------------------- # | |
530 | ||
531 | .PHONY: update | |
532 | local_updates ?= wget-update cvs-update po-update | |
533 | update: $(local_updates) | |
534 | ||
535 | ||
536 | # ------------------- # | |
537 | # Updating PO files. # | |
538 | # ------------------- # | |
539 | ||
540 | po_repo = http://www.iro.umontreal.ca/contrib/po/maint/$(PACKAGE) | |
541 | .PHONY: do-po-update po-update | |
542 | do-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 | ||
552 | po-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. | |
564 | wget_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 | ||
570 | get-targets = $(patsubst %, get-%, $(wget_files)) | |
571 | ||
572 | config.guess-url_prefix = $(ftp-gnu)/build-aux/ | |
573 | config.sub-url_prefix = $(ftp-gnu)/build-aux/ | |
574 | ||
575 | ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/ | |
576 | ||
577 | texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/ | |
578 | ||
579 | standards.texi-url_prefix = $(www-gnu)/prep/ | |
580 | make-stds.texi-url_prefix = $(standards.texi-url_prefix) | |
581 | ||
582 | target = $(patsubst get-%, %, $@) | |
583 | url = $($(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 | ||
590 | cvs_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 | |
596 | automake_repo=:pserver:anoncvs:anoncvs@sources.redhat.com:/cvs/automake | |
597 | .PHONY: wget-update | |
598 | wget-update: $(get-targets) | |
599 | ||
600 | .PHONY: cvs-update | |
601 | cvs-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 | ||
615 | emit_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 ===================================== | |
624 | ||
625 | $(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz | |
626 | xdelta delta -9 $^ $@ || : | |
627 | ||
628 | .PHONY: alpha beta major | |
629 | alpha beta major: news-date-check $(local-check) | |
630 | $(MAKE) cvs-dist | |
631 | $(MAKE) $(xd-delta) | |
632 | $(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir) | |
633 | ln $(rel-files) $(release_archive_dir) | |
634 | chmod a-w $(rel-files) | |
635 | $(MAKE) -s emit_upload_commands RELEASE_TYPE=$@ | |
636 | echo $(VERSION) > $(prev_version_file) | |
637 | $(CVS) ci -m. $(prev_version_file) |