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