OSDN Git Service

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