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