maintcheck: fix some failures, extend some checks
[platform/upstream/automake.git] / Makefile.am
1 ## Process this file with automake to create Makefile.in
2
3 ## Makefile for Automake.
4
5 # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004,
6 # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
7 # Inc.
8
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2, or (at your option)
12 # any later version.
13
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18
19 # You should have received a copy of the GNU General Public License
20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
22 ## lib goes first, because it builds Config.pm, used by aclocal and
23 ## automake (run in doc, tests, and in the rebuild rules.)
24 ## `.' goes before doc and tests, because the latter two directories
25 ## run aclocal and automake.
26 SUBDIRS = lib . doc m4 tests
27
28 bin_SCRIPTS = automake aclocal
29
30 CLEANFILES = $(bin_SCRIPTS)
31 AUTOMAKESOURCES = automake.in aclocal.in
32
33 TAGS_FILES = $(AUTOMAKESOURCES)
34
35 EXTRA_DIST = \
36   ChangeLog.96 \
37   ChangeLog.98 \
38   ChangeLog.00 \
39   ChangeLog.01 \
40   ChangeLog.02 \
41   ChangeLog.03 \
42   ChangeLog.04 \
43   ChangeLog.09 \
44   bootstrap \
45   $(AUTOMAKESOURCES)
46
47 ## Make versioned links.  We only run the transform on the root name;
48 ## then we make a versioned link with the transformed base name.  This
49 ## seemed like the most reasonable approach.
50 install-exec-hook:
51         @$(POST_INSTALL)
52         @for p in $(bin_SCRIPTS); do \
53           f="`echo $$p|sed '$(transform)'`"; \
54           fv="$$f-$(APIVERSION)"; \
55           rm -f $(DESTDIR)$(bindir)/$$fv; \
56           echo " $(LN) $(DESTDIR)$(bindir)/$$f $(DESTDIR)$(bindir)/$$fv"; \
57           $(LN) $(DESTDIR)$(bindir)/$$f $(DESTDIR)$(bindir)/$$fv; \
58         done
59
60 uninstall-hook:
61         @for p in $(bin_SCRIPTS); do \
62           f="`echo $$p|sed '$(transform)'`"; \
63           fv="$$f-$(APIVERSION)"; \
64           rm -f $(DESTDIR)$(bindir)/$$fv; \
65         done
66
67
68 ## We can't use configure to do the substitution here; we must do it
69 ## by hand.  We use a funny notation here to avoid configure
70 ## substitutions in our text.
71 do_subst = sed \
72   -e 's,[@]APIVERSION[@],$(APIVERSION),g' \
73   -e 's,[@]PACKAGE[@],$(PACKAGE),g' \
74   -e 's,[@]PACKAGE_BUGREPORT[@],$(PACKAGE_BUGREPORT),g' \
75   -e 's,[@]PACKAGE_URL[@],$(PACKAGE_URL),g' \
76   -e 's,[@]PATH_SEPARATOR[@],$(PATH_SEPARATOR),g' \
77   -e 's,[@]PERL[@],$(PERL),g' \
78   -e 's,[@]PERL_THREADS[@],$(PERL_THREADS),g' \
79   -e 's,[@]SHELL[@],$(SHELL),g' \
80   -e 's,[@]am_AUTOCONF[@],$(am_AUTOCONF),g' \
81   -e 's,[@]am_AUTOM4TE[@],$(am_AUTOM4TE),g' \
82   -e 's,[@]VERSION[@],$(VERSION),g' \
83   -e 's,[@]configure_input[@],Generated from $@.in; do not edit by hand.,g' \
84   -e 's,[@]datadir[@],$(datadir),g'
85
86 ## These files depend on Makefile so they are rebuilt if $(VERSION),
87 ## $(datadir) or other do_subst'ituted variables change.
88 ## Use chmod a-w to prevent people from editing the wrong file by accident.
89 automake: automake.in
90 aclocal: aclocal.in
91 automake aclocal: Makefile
92         rm -f $@ $@.tmp
93         $(do_subst) $(srcdir)/$@.in >$@.tmp
94         chmod +x $@.tmp
95         chmod a-w $@.tmp
96         mv -f $@.tmp $@
97
98 ## The master location for INSTALL is lib/INSTALL.
99 ## This is where `make fetch' will install new versions.
100 ## Make sure we also update this copy.
101 INSTALL: lib/INSTALL
102         cp $(srcdir)/lib/INSTALL $@
103
104 ################################################################
105 ##
106 ## Everything past here is useful to the maintainer, but probably not
107 ## to anybody else
108 ##
109
110 # Ensure tests are world-executable
111 dist-hook:
112         cd $(distdir)/tests && chmod a+rx *.test
113
114 # Some simple checks, and then ordinary check.  These are only really
115 # guaranteed to work on my machine.
116 syntax_check_rules = \
117 sc_test_names \
118 sc_diff_automake_in_automake \
119 sc_diff_aclocal_in_automake \
120 sc_perl_syntax \
121 sc_no_brace_variable_expansions \
122 sc_rm_minus_f \
123 sc_no_for_variable_in_macro \
124 sc_mkinstalldirs \
125 sc_pre_normal_post_install_uninstall \
126 sc_perl_no_undef \
127 sc_perl_no_split_regex_space \
128 sc_cd_in_backquotes \
129 sc_cd_relative_dir \
130 sc_perl_at_uscore_in_scalar_context \
131 sc_perl_local_no_parens \
132 sc_perl_local \
133 sc_AMDEP_TRUE_in_automake_in \
134 sc_tests_make_without_am_makeflags \
135 sc_tests_plain_make \
136 sc_tests_plain_autoconf \
137 sc_tests_plain_autoupdate \
138 sc_tests_plain_automake \
139 sc_tests_here_document_format \
140 sc_tests_Exit_not_exit \
141 sc_tests_automake_fails \
142 sc_tests_plain_aclocal \
143 sc_tests_plain_perl \
144 sc_tests_required_after_defs \
145 sc_tests_overriding_macros_on_cmdline \
146 sc_tests_plain_sleep \
147 sc_tests_plain_egrep_fgrep \
148 sc_tests_PATH_SEPARATOR \
149 sc_mkdir_p \
150 sc_perl_at_substs \
151 sc_unquoted_DESTDIR \
152 sc_tabs_in_texi \
153 sc_at_in_texi
154
155 .PHONY: $(syntax_check_rules)
156 $(syntax_check_rules): automake aclocal
157 maintainer-check: $(syntax_check_rules)
158
159 ## Look for test whose names can cause spurious failures when used as
160 ## first argument to AC_INIT (chiefly because they might contain an
161 ## m4/m4sugar builtin or macro name).
162 m4_builtins = \
163   __gnu__ \
164   __unix__ \
165   bpatsubst \
166   bregexp \
167   builtin \
168   changecom \
169   changequote \
170   changeword \
171   debugfile \
172   debugmode \
173   decr \
174   define \
175   defn \
176   divert \
177   divnum \
178   dnl \
179   dumpdef \
180   errprint \
181   esyscmd \
182   eval \
183   format \
184   ifdef \
185   ifelse \
186   include \
187   incr \
188   index \
189   indir \
190   len \
191   m4exit \
192   m4wrap \
193   maketemp \
194   mkstemp \
195   patsubst \
196   popdef \
197   pushdef \
198   regexp \
199   shift \
200   sinclude \
201   substr \
202   symbols \
203   syscmd \
204   sysval \
205   traceoff \
206   traceon \
207   translit \
208   undefine \
209   undivert
210 sc_test_names:
211         @m4_builtin_rx=`echo $(m4_builtins) | sed 's/ /|/g'`; \
212          m4_macro_rx="\\<($$m4_builtin_rx)\\>|\\<_?(A[CUMHS]|m4)_"; \
213          if ls tests/*.test | LC_ALL=C grep -E "$$m4_macro_rx"; then \
214            echo "the names of the tests above can be problematic" 1>&2; \
215            echo "Avoid test names that contain names of m4 macros" 1>&2; \
216            exit 1; \
217          fi
218
219 ## These check avoids accidental configure substitutions in the source.
220 ## There are exactly 9 lines that should be modified from automake.in to
221 ## automake, and 10 lines that should be modified from aclocal.in to
222 ## aclocal; these wors out to 32 and 34 lines of diffs, respectively.
223 sc_diff_automake_in_automake:
224         @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 32; then \
225           echo "found too many diffs between automake.in and automake" 1>&2; \
226           diff -c $(srcdir)/automake.in automake; \
227           exit 1; \
228         fi
229 sc_diff_aclocal_in_aclocal:
230         @if test `diff $(srcdir)/aclocal.in aclocal | wc -l` -ne 34; then \
231           echo "found too many diffs between aclocal.in and aclocal" 1>&2; \
232           diff -c $(srcdir)/aclocal.in aclocal; \
233           exit 1; \
234         fi
235
236 ## Syntax check with default Perl (on my machine, Perl 5).
237 sc_perl_syntax:
238         perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w automake
239         perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w aclocal
240
241 ## expect no instances of '${...}'.  However, $${...} is ok, since that
242 ## is a shell construct, not a Makefile construct.
243 sc_no_brace_variable_expansions:
244         @if grep -F '$${' $(srcdir)/lib/am/[a-z]*.am | \
245                grep -F -v '$$$$'; then \
246           echo "Found too many uses of '\$${' in the lines above." 1>&2; \
247           exit 1;                               \
248         else :; fi
249
250 ## Make sure `rm' is called with `-f'.
251 sc_rm_minus_f:
252         @if grep -v '^#' $(srcdir)/lib/am/[a-z]*.am $(srcdir)/tests/*.test | \
253             grep -E '\<rm ([^-]|\-[^f ]*\>)'; then \
254           echo "Suspicious 'rm' invocation." 1>&2; \
255           exit 1;                               \
256         else :; fi
257
258 ## Never use something like `for file in $(FILES)', this doesn't work
259 ## if FILES is empty or if it contains shell meta characters (e.g. $ is
260 ## commonly used in Java filenames).
261 sc_no_for_variable_in_macro:
262         @if grep 'for .* in \$$(' $(srcdir)/lib/am/[a-z]*.am; then \
263           echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
264           exit 1; \
265         else :; fi
266
267 ## Make sure all invocations of mkinstalldirs are correct.
268 sc_mkinstalldirs:
269         @if grep -n 'mkinstalldirs' $(srcdir)/lib/am/[a-z]*.am | \
270               grep -F -v '$$(mkinstalldirs)'; then \
271           echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
272           exit 1; \
273         else :; fi
274
275 ## Make sure all calls to PRE/NORMAL/POST_INSTALL/UNINSTALL
276 sc_pre_normal_post_install_uninstall:
277         @if grep -E -n '\((PRE|NORMAL|POST)_(|UN)INSTALL\)' \
278                  $(srcdir)/lib/am/[a-z]*.am | \
279               grep -v ':##' | grep -v ':        @\$$('; then \
280           echo "Found incorrect use of PRE/NORMAL/POST_INSTALL/UNINSTALL in the lines above" 1>&2; \
281           exit 1; \
282         else :; fi
283
284 ## We never want to use "undef", only "delete", but for $/.
285 sc_perl_no_undef:
286         @if grep -n -w 'undef ' $(srcdir)/automake.in | \
287               grep -F -v 'undef $$/'; then \
288           echo "Found undef in automake.in; use delete instead" 1>&2; \
289           exit 1; \
290         fi
291
292 ## We never want split (/ /,...), only split (' ', ...).
293 sc_perl_no_split_regex_space:
294         @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
295           echo "Found bad split in the lines above." 1>&2; \
296           exit 1; \
297         fi
298
299 ## Look for cd within backquotes
300 sc_cd_in_backquotes:
301         @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in \
302               $(srcdir)/lib/am/*.am; then \
303           echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
304           exit 1; \
305         fi
306
307 ## Look for cd to a relative directory (may be influenced by CDPATH).
308 ## Skip some known directories that are OK.
309 sc_cd_relative_dir:
310         @if grep -n '^[^#]*cd ' $(srcdir)/automake.in \
311               $(srcdir)/lib/am/*.am | \
312               grep -v 'echo.*cd ' | \
313               grep -v 'am__cd =' | \
314               grep -v '^[^#]*cd [./]' | \
315               grep -v '^[^#]*cd \$$(top_builddir)' | \
316               grep -v '^[^#]*cd "\$$\$$am__cwd' | \
317               grep -v '^[^#]*cd \$$(abs' | \
318               grep -v '^[^#]*cd "\$$(DESTDIR)'; then \
319           echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
320           exit 1; \
321         fi
322
323 ## Using @_ in a scalar context is most probably a programming error.
324 sc_perl_at_uscore_in_scalar_context:
325         @if grep -Hn '[^@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' $(srcdir)/automake.in; then \
326           echo "Using @_ in a scalar context in the lines above." 1>&2; \
327           exit 1; \
328         fi
329
330 ## Forbid using parens with `local' to ease counting.
331 sc_perl_local_no_parens:
332         @if grep '^[ \t]*local *(' $(srcdir)/automake.in; then \
333           echo "Don't use \`local' with parens: use several \`local' above." >&2; \
334           exit 1; \
335         fi
336
337 ## Allow only `local $_' in Automake.
338 sc_perl_local:
339         @if grep -v '^[ \t]*local \$$_;' $(srcdir)/automake.in | \
340                 grep '^[ \t]*local [^*]'; then \
341           echo "Please avoid \`local'." 1>&2; \
342           exit 1; \
343         fi
344
345 ## Don't let AMDEP_TRUE substitution appear in automake.in.
346 sc_AMDEP_TRUE_in_automake_in:
347         @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
348           echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
349           exit 1; \
350         fi
351
352 ## Tests should never call make directly.
353 sc_tests_make_without_am_makeflags:
354         @if grep '^[^#].*(MAKE) ' $(srcdir)/lib/am/*.am $(srcdir)/automake.in |\
355                 grep -v 'AM_MAKEFLAGS'; then \
356           echo 'Use $$(MAKE) $$(AM_MAKEFLAGS).' 1>&2; \
357           exit 1; \
358         fi
359
360 ## Tests should never call make directly.
361 sc_tests_plain_make:
362         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*make'; then \
363           echo 'Do not run "make" in the above tests.  Use "$$MAKE" instead.' 1>&2; \
364           exit 1; \
365         fi
366
367 ## Tests should never call autoconf directly.
368 sc_tests_plain_autoconf:
369         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoconf'; then \
370           echo 'Do not run "autoconf" in the above tests.  Use "$$AUTOCONF" instead.' 1>&2; \
371           exit 1; \
372         fi
373
374 ## Tests should never call autoupdate directly.
375 sc_tests_plain_autoupdate:
376         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoupdate'; then \
377           echo 'Do not run "autoupdate" in the above tests.  Use "$$AUTOUPDATE" instead.' 1>&2; \
378           exit 1; \
379         fi
380
381 ## Tests should never call automake directly.
382 sc_tests_plain_automake:
383         @if grep -v '^#' $(srcdir)/tests/*.test | grep -E ':[   ]*automake([^:]|$$)'; then \
384           echo 'Do not run "automake" in the above tests.  Use "$$AUTOMAKE" instead.' 1>&2;  \
385           exit 1; \
386         fi
387
388 ## Tests should only use END and EOF for here documents
389 ## (so that the next test is effective).
390 sc_tests_here_document_format:
391         @if grep '<<' $(srcdir)/tests/*.test | grep -v 'END' | grep -v 'EOF'; then \
392           echo 'Use here documents with "END" and "EOF" only, for greppability.' 1>&2; \
393           exit 1; \
394         fi
395
396 ## Tests should never call exit directly, but use Exit.
397 ## This is so that the exit status is transported correctly across the 0 trap.
398 ## Ignore comments, testsuite self tests, and one perl line in ext2.test.
399 sc_tests_Exit_not_exit:
400         @found=false; for file in $(srcdir)/tests/*.test; do \
401           case $$file in */self-check-*.test) continue;; esac; \
402           res=`sed -n -e '/^#/d; /^\$$PERL/d' -e '/<<.*END/,/^END/b' \
403                       -e '/<<.*EOF/,/^EOF/b' -e '/exit [$$0-9]/p' $$file`; \
404           if test -n "$$res"; then \
405             echo "$$file:$$res"; \
406             found=true; \
407           fi; \
408         done; \
409         if $$found; then \
410           echo 'Do not call plain "exit", use "Exit" instead, in above tests.' 1>&2; \
411           exit 1; \
412         fi
413
414 ## Use AUTOMAKE_fails when appropriate
415 sc_tests_automake_fails:
416         @if grep -v '^#' $(srcdir)/tests/*.test | grep '\$$AUTOMAKE.*&&.*[eE]xit'; then \
417           echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2;  \
418           exit 1; \
419         fi
420
421 ## Tests should never call aclocal directly.
422 sc_tests_plain_aclocal:
423         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*aclocal'; then \
424           echo 'Do not run "aclocal" in the above tests.  Use "$$ACLOCAL" instead.' 1>&2;  \
425           exit 1; \
426         fi
427
428 ## Tests should never call perl directly.
429 sc_tests_plain_perl:
430         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*perl'; then \
431           echo 'Do not run "perl" in the above tests.  Use "$$PERL" instead.' 1>&2; \
432           exit 1; \
433         fi
434
435 ## Setting `required' after sourcing `./defs' is a bug.
436 sc_tests_required_after_defs:
437         @for file in $(srcdir)/tests/*.test; do \
438           if out=`sed -n '/defs/,$${/required=/p;}' $$file`; test -n "$$out"; then \
439             echo 'Do not set "required" after sourcing "defs" in '"$$file: $$out" 1>&2; \
440             exit 1; \
441           fi; \
442         done
443
444 ## Overriding a Makefile macro on the command line is not portable when
445 ## recursive targets are used.  Better use an envvar.  SHELL is an exception,
446 ## POSIX says it can't come from the environment.  V and DESTDIRS are exceptions,
447 ## too, as package authors are urged not to initialize them anywhere.
448 sc_tests_overriding_macros_on_cmdline:
449         @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(srcdir)/tests/*.test; then \
450           echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
451           echo ' in the above lines, it is more portable.' 1>&2; \
452           exit 1; \
453         fi
454         @if sed 's/DESTDIR=[^ ]*//; s/SHELL=[^ ]*//; s/V=[^ ]*//' $(srcdir)/tests/*.test | \
455             grep '\$$MAKE .*=' ; then \
456           echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
457           echo 'it is more portable.' 1>&2; \
458           exit 1; \
459         fi
460         @if grep 'SHELL=.*\$$MAKE' $(srcdir)/tests/*.test; then \
461           echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 1>&2; \
462           echo 'the above lines.' 1>&2; \
463           exit 1; \
464         fi
465
466 ## Never use `sleep 1' to create files with different timestamps.
467 ## Use `$sleep' instead.  Some filesystems (e.g., Windows') have only
468 ## a 2sec resolution.
469 sc_tests_plain_sleep:
470         @if grep -E '\bsleep +[12345]\b' $(srcdir)/tests/*.test; then \
471           echo 'Do not use "sleep x" in the above tests.  Use "$$sleep" instead.' 1>&2; \
472           exit 1; \
473         fi
474
475 ## fgrep and egrep are not required by POSIX.
476 sc_tests_plain_egrep_fgrep:
477         @if grep -E '\b[ef]grep\b' $(srcdir)/tests/*.test ; then \
478           echo 'Do not use egrep or fgrep in test cases.  Use $$FGREP or $$EGREP.' 1>&2; \
479           exit 1; \
480         fi
481         @if grep -E '\b[ef]grep\b' $(srcdir)/lib/am/*.am $(srcdir)/m4/*.m4; then \
482           echo 'Do not use egrep or fgrep in the above files, they are not portable.' 1>&2; \
483           exit 1; \
484         fi
485
486 ## Using `:' as a PATH separator is not portable.
487 sc_tests_PATH_SEPARATOR:
488         @if grep -E '\bPATH=.*:.*' $(srcdir)/tests/*.test ; then \
489           echo "Use \`\$$PATH_SEPARATOR', not \`:', in PATH definitions above." 1>&2; \
490           exit 1; \
491         fi
492
493 sc_mkdir_p:
494         @if grep 'mkdir_p' $(srcdir)/automake.in \
495               $(srcdir)/lib/am/*.am $(srcdir)/tests/*.test; then \
496           echo 'Do not use mkdir_p in the above files, use MKDIR_P.' 1>&2; \
497           exit 1; \
498         fi
499
500 ## Try to make sure all @...@ substitutions are covered by our
501 ## substitution rule.
502 sc_perl_at_substs:
503         @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
504           echo "Unresolved @...@ substitution in aclocal" 1>&2; \
505           exit 1; \
506         fi
507         @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' automake | wc -l` -ne 0; then \
508           echo "Unresolved @...@ substitution in automake" 1>&2; \
509           exit 1; \
510         fi
511
512 sc_unquoted_DESTDIR:
513         @if grep -E "[^\'\"]\\\$$\(DESTDIR" $(srcdir)/lib/am/*.am; then \
514           echo 'Suspicious unquoted DESTDIR uses.' 1>&2 ; \
515           exit 1; \
516         fi
517
518 sc_tabs_in_texi:
519         @if grep '      ' $(srcdir)/doc/automake.texi; then \
520           echo 'Do not use tabs in the manual.' 1>&2; \
521           exit 1; \
522         fi
523
524 sc_at_in_texi:
525         @if grep -E '([^@]|^)@([         ][^@]|$$)' $(srcdir)/doc/automake.texi; \
526         then \
527           echo 'Unescaped @.' 1>&2; \
528           exit 1; \
529         fi
530
531
532 git-dist: maintainer-check
533 ## Make sure the NEWS file is up-to-date.
534         @if sed 1q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \
535           echo "NEWS not updated; not releasing" 1>&2; \
536           exit 1;                               \
537         fi
538 ## Build the distribution
539         $(MAKE) $(AM_MAKEFLAGS) distcheck
540 ## Finally, if anything was successful, commit the last changes and tag
541 ## the release in the repository.  We don't use RCS keywords so it's OK
542 ## to distribute the files before they were committed.
543         cd $(srcdir) && git commit -a -s && \
544            git tag -s "v$(VERSION)" -m "Release $(VERSION)"
545
546 git-release: git-dist
547         case $(VERSION) in \
548           *[a-z]) dest=alpha;; \
549           *)      dest=ftp;; \
550         esac; \
551         $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) \
552           --to $$dest.gnu.org:automake $(DIST_ARCHIVES)
553
554 git-diff:
555         thisver="v$(VERSION)"; \
556         if test -z "$$OLDVERSION"; then \
557           prevno=`echo "$(VERSION)" - 0.01 | bc | sed 's/^\./0./'`; \
558         else prevno="$$OLDVERSION"; fi; \
559         prevver=v$$prevno; \
560         git diff $$prevver..$$thisver $(PACKAGE) \
561             > $(PACKAGE)-$$prevno-$(VERSION).diff
562
563 ## Check our path lengths.
564 path-check: distdir
565         (cd $(distdir) && \
566 ## FIXME there's got to be a better way!  pathchk should take the list
567 ## of files on stdin, at least.
568           find . -print | xargs pathchk -p); \
569           estatus=$$?; \
570           find $(distdir) -type d '!' -perm -200 -exec chmod u+w {} ';'; \
571           rm -rf $(distdir); \
572           exit $$estatus
573
574 ## Program to use to fetch files.
575 WGET = wget
576 WGET_SV_CVS = $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/
577 WGET_SV_GIT_CF = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
578 WGET_SV_GIT_AC = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
579 WGET_SV_GIT_GL = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
580 WGET_GCC = $(WGET) 'http://gcc.gnu.org/viewcvs/*checkout*/trunk/'
581
582 ## Files that we fetch and which we compare against.
583 ## FIXME should be a lot more here
584 FETCHFILES = \
585 INSTALL \
586 config-ml.in \
587 config.guess \
588 config.sub \
589 symlink-tree \
590 texinfo.tex
591
592 ## Fetch the latest versions of files we care about.
593 fetch:
594         rm -rf Fetchdir > /dev/null 2>&1
595         mkdir Fetchdir
596 ## If a get fails then that is a problem.
597         (cd Fetchdir && \
598         $(WGET_SV_GIT_CF)config.guess -O config.guess && \
599         $(WGET_SV_GIT_CF)config.sub -O config.sub && \
600         $(WGET_SV_CVS)texinfo/texinfo/doc/texinfo.tex -O texinfo.tex && \
601         $(WGET_SV_GIT_GL)doc/INSTALL -O INSTALL && \
602         $(WGET_GCC)config-ml.in -O config-ml.in && \
603         $(WGET_GCC)symlink-tree -O symlink-tree)
604 ## Don't exit after test because we want to give as many errors as
605 ## possible.
606         @stat=0; for file in $(FETCHFILES); do \
607           if diff -u $(srcdir)/lib/$$file Fetchdir/$$file \
608                   >>Fetchdir/update.patch 2>/dev/null; then :; \
609           else \
610             stat=1; \
611             echo "Updating $(srcdir)/lib/$$file..."; \
612             cp Fetchdir/$$file $(srcdir)/lib/$$file; \
613           fi; \
614         done; \
615         test $$stat = 0 || \
616           echo "See Fetchdir/update.patch for a log of the changes."; \
617         exit $$stat
618
619 ## Generate release statistics, for the table in automake.texi.
620 ## This has to be run in an up to date build tree, but there must
621 ## be no temp files nor unused other files lying around!
622 release-stats: ps
623         @am=`wc -l < automake` && \
624         acl=`wc -l < aclocal` && \
625         pmfiles="lib/Automake/*.pm" && \
626         if test . != '$(srcdir)'; then pmfiles="$$pmfiles $(srcdir)/lib/Automake/*.pm"; \
627         else :; fi && \
628         pm=`cat $$pmfiles | wc -l` && \
629         dot_am_files=`ls -1 $(srcdir)/lib/am/*.am | grep -v Makefile.am` && \
630         amf=`echo "$$dot_am_files" | wc -l` && \
631         aml=`cat $$dot_am_files | wc -l` && \
632         m4f=`ls -1 $(srcdir)/m4/*.m4 | wc -l` && \
633         m4l=`cat $(srcdir)/m4/*.m4 | wc -l` && \
634         doc_text=`cd doc && LC_ALL=C pstops 0 automake.ps unused.ps 2>&1` && \
635         echo "$$doc_text" && \
636         rm -f doc/unused.ps && \
637         doc=`echo "$$doc_text" | sed -n 's/.*Wrote \([1-9][0-9]*\) pages.*/\1/p'` && \
638         tests="tests/*.test"; \
639         if test . != '$(srcdir)'; then tests="$$tests $(srcdir)/tests/*.test"; \
640         else :; fi && \
641         t=`ls -1 $$tests | wc -l` && \
642         tgen=`ls -1 $$tests | grep '.-p\.test' | wc -l` && \
643         today=`date +%Y-%m-%d` && \
644         echo "add this to the table in doc/automake.texi after verification:" && \
645         printf '@item %s @tab %-6s @tab %4d @tab %4d @tab %4d @tab %4d %-4s @tab %4d %-4s @tab %3d @tab %d %-4s\n' \
646                       $$today $(VERSION) $$am    $$acl    $$pm   $$aml "($$amf)" $$m4l "($$m4f)" $$doc $$t "($$tgen)"
647 .PHONY: release-stats