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