Merge branch 'msvc'
[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         $(AM_V_GEN)rm -f $@ $@.tmp
90         $(AM_V_at)$(do_subst) $(srcdir)/$@.in >$@.tmp
91         $(AM_V_at)chmod +x $@.tmp
92         $(AM_V_at)chmod a-w $@.tmp
93         $(AM_V_at)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         $(AM_V_GEN)cp $(srcdir)/lib/INSTALL $@
100
101 ## recheck: convenience proxy target for the test suites.
102 TEST_SUBDIRS = lib/Automake/tests tests
103
104 .PHONY: recheck
105 recheck:
106         @failcom='exit 1'; \
107         for f in x $$MAKEFLAGS; do \
108           case $$f in \
109             *=* | --[!k]*);; \
110             *k*) failcom='fail=yes';; \
111           esac; \
112         done; \
113         for subdir in $(TEST_SUBDIRS); do \
114           (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@) || eval $$failcom; \
115         done; \
116         test -z "$$fail"
117
118 ################################################################
119 ##
120 ## Everything past here is useful to the maintainer, but probably not
121 ## to anybody else
122 ##
123
124 # Ensure tests are world-executable
125 dist-hook:
126         cd $(distdir)/tests && chmod a+rx *.test
127
128
129 # Perl coverage statistics.
130 PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
131 PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
132 PERL_COVER = cover
133
134 check-coverage-run recheck-coverage-run: all
135         $(mkinstalldirs) $(PERL_COVERAGE_DB)
136         PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
137         WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
138         $(MAKE) $(AM_MAKEFLAGS) `echo $@ | sed 's/-coverage-run//'`
139
140 check-coverage-report:
141         @if test ! -d "$(PERL_COVERAGE_DB)"; then \
142           echo "No coverage database found in \`$(PERL_COVERAGE_DB)'." >&2; \
143           echo "Please run \`make check-coverage' first" >&2; \
144           exit 1; \
145         fi
146         $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
147
148 # We don't use direct dependencies here because we'd like to be able
149 # to invoke the report even after interrupted check-coverage.
150 check-coverage: check-coverage-run
151         $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
152
153 recheck-coverage: recheck-coverage-run
154         $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
155
156 clean-coverage:
157         rm -rf "$(PERL_COVERAGE_DB)"
158 clean-local: clean-coverage
159
160 .PHONY: check-coverage recheck-coverage check-coverage-run \
161         recheck-coverage-run check-coverage-report clean-coverage
162
163 # Some simple checks, and then ordinary check.  These are only really
164 # guaranteed to work on my machine.
165 syntax_check_rules = \
166 sc_diff_automake_in_automake \
167 sc_perl_syntax \
168 sc_no_brace_variable_expansions \
169 sc_rm_minus_f \
170 sc_no_for_variable_in_macro \
171 sc_mkinstalldirs \
172 sc_pre_normal_post_install_uninstall \
173 sc_perl_no_undef \
174 sc_perl_no_split_regex_space \
175 sc_cd_in_backquotes \
176 sc_cd_relative_dir \
177 sc_perl_at_uscore_in_scalar_context \
178 sc_perl_local_no_parens \
179 sc_perl_local \
180 sc_AMDEP_TRUE_in_automake_in \
181 sc_tests_make_without_am_makeflags \
182 sc_tests_plain_make \
183 sc_tests_plain_autoconf \
184 sc_tests_plain_autoupdate \
185 sc_tests_plain_automake \
186 sc_tests_here_document_format \
187 sc_tests_Exit_not_exit \
188 sc_tests_automake_fails \
189 sc_tests_plain_aclocal \
190 sc_tests_plain_perl \
191 sc_tests_required_after_defs \
192 sc_tests_overriding_macros_on_cmdline \
193 sc_tests_plain_sleep \
194 sc_tests_plain_egrep_fgrep \
195 sc_tests_logs_duplicate_prefixes \
196 sc_mkdir_p \
197 sc_perl_at_substs \
198 sc_unquoted_DESTDIR \
199 sc_tabs_in_texi \
200 sc_at_in_texi
201
202 .PHONY: $(syntax_check_rules)
203 $(syntax_check_rules): automake aclocal
204 maintainer-check: $(syntax_check_rules)
205
206 ## This check avoids accidental configure substitutions in the source.
207 ## There are exactly 8 lines that should be modified.  This works out
208 ## to 28 lines of diffs.
209 sc_diff_automake_in_automake:
210         @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 28; then \
211           echo "found too many diffs between automake.in and automake" 1>&2; \
212           diff -c $(srcdir)/automake.in automake; \
213           exit 1; \
214         fi
215
216 ## Syntax check with default Perl (on my machine, Perl 5).
217 sc_perl_syntax:
218         perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w automake
219         perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w aclocal
220
221 ## expect no instances of '${...}'.  However, $${...} is ok, since that
222 ## is a shell construct, not a Makefile construct.
223 sc_no_brace_variable_expansions:
224         @if grep -F '$${' $(srcdir)/lib/am/[a-z]*.am | \
225                grep -F -v '$$$$'; then \
226           echo "Found too many uses of '\$${' in the lines above." 1>&2; \
227           exit 1;                               \
228         else :; fi
229
230 ## Make sure `rm' is called with `-f'.
231 sc_rm_minus_f:
232         @if grep -v '^#' $(srcdir)/lib/am/[a-z]*.am $(srcdir)/tests/*.test | \
233             grep -E '\<rm ([^-]|\-[^f ]*\>)'; then \
234           echo "Suspicious 'rm' invocation." 1>&2; \
235           exit 1;                               \
236         else :; fi
237
238 ## Never use something like `for file in $(FILES)', this doesn't work
239 ## if FILES is empty or if it contains shell meta characters (e.g. $ is
240 ## commonly used in Java filenames).
241 sc_no_for_variable_in_macro:
242         @if grep 'for .* in \$$(' $(srcdir)/lib/am/[a-z]*.am; then \
243           echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
244           exit 1; \
245         else :; fi
246
247 ## Make sure all invocations of mkinstalldirs are correct.
248 sc_mkinstalldirs:
249         @if grep -n 'mkinstalldirs' $(srcdir)/lib/am/[a-z]*.am | \
250               grep -F -v '$$(mkinstalldirs)'; then \
251           echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
252           exit 1; \
253         else :; fi
254
255 ## Make sure all calls to PRE/NORMAL/POST_INSTALL/UNINSTALL
256 sc_pre_normal_post_install_uninstall:
257         @if grep -E -n '\((PRE|NORMAL|POST)_(|UN)INSTALL\)' \
258                  $(srcdir)/lib/am/[a-z]*.am | \
259               grep -v ':##' | grep -v ':        @\$$('; then \
260           echo "Found incorrect use of PRE/NORMAL/POST_INSTALL/UNINSTALL in the lines above" 1>&2; \
261           exit 1; \
262         else :; fi
263
264 ## We never want to use "undef", only "delete", but for $/.
265 sc_perl_no_undef:
266         @if grep -n -w 'undef ' $(srcdir)/automake.in | \
267               grep -F -v 'undef $$/'; then \
268           echo "Found undef in automake.in; use delete instead" 1>&2; \
269           exit 1; \
270         fi
271
272 ## We never want split (/ /,...), only split (' ', ...).
273 sc_perl_no_split_regex_space:
274         @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
275           echo "Found bad split in the lines above." 1>&2; \
276           exit 1; \
277         fi
278
279 ## Look for cd within backquotes
280 sc_cd_in_backquotes:
281         @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in \
282               $(srcdir)/lib/am/*.am; then \
283           echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
284           exit 1; \
285         fi
286
287 ## Look for cd to a relative directory (may be influenced by CDPATH).
288 ## Skip some known directories that are OK.
289 sc_cd_relative_dir:
290         @if grep -n '^[^#]*cd ' $(srcdir)/automake.in \
291               $(srcdir)/lib/am/*.am | \
292               grep -v 'echo.*cd ' | \
293               grep -v 'am__cd =' | \
294               grep -v '^[^#]*cd [./]' | \
295               grep -v '^[^#]*cd \$$(top_builddir)' | \
296               grep -v '^[^#]*cd "\$$\$$am__cwd' | \
297               grep -v '^[^#]*cd \$$(abs' | \
298               grep -v '^[^#]*cd "\$$(DESTDIR)'; then \
299           echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
300           exit 1; \
301         fi
302
303 ## Using @_ in a scalar context is most probably a programming error.
304 sc_perl_at_uscore_in_scalar_context:
305         @if grep -Hn '[^@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' $(srcdir)/automake.in; then \
306           echo "Using @_ in a scalar context in the lines above." 1>&2; \
307           exit 1; \
308         fi
309
310 ## Forbid using parens with `local' to ease counting.
311 sc_perl_local_no_parens:
312         @if grep '^[ \t]*local *(' $(srcdir)/automake.in; then \
313           echo "Don't use \`local' with parens: use several \`local' above." >&2; \
314           exit 1; \
315         fi
316
317 ## Allow only `local $_' in Automake.
318 sc_perl_local:
319         @if grep -v '^[ \t]*local \$$_;' $(srcdir)/automake.in | \
320                 grep '^[ \t]*local [^*]'; then \
321           echo "Please avoid \`local'." 1>&2; \
322           exit 1; \
323         fi
324
325 ## Don't let AMDEP_TRUE substitution appear in automake.in.
326 sc_AMDEP_TRUE_in_automake_in:
327         @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
328           echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
329           exit 1; \
330         fi
331
332 ## Tests should never call make directly.
333 sc_tests_make_without_am_makeflags:
334         @if grep '^[^#].*(MAKE) ' $(srcdir)/lib/am/*.am $(srcdir)/automake.in |\
335                 grep -v 'AM_MAKEFLAGS'; then \
336           echo 'Use $$(MAKE) $$(AM_MAKEFLAGS).' 1>&2; \
337           exit 1; \
338         fi
339
340 ## Tests should never call make directly.
341 sc_tests_plain_make:
342         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*make'; then \
343           echo 'Do not run "make" in the above tests.  Use "$$MAKE" instead.' 1>&2; \
344           exit 1; \
345         fi
346
347 ## Tests should never call autoconf directly.
348 sc_tests_plain_autoconf:
349         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoconf'; then \
350           echo 'Do not run "autoconf" in the above tests.  Use "$$AUTOCONF" instead.' 1>&2; \
351           exit 1; \
352         fi
353
354 ## Tests should never call autoupdate directly.
355 sc_tests_plain_autoupdate:
356         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoupdate'; then \
357           echo 'Do not run "autoupdate" in the above tests.  Use "$$AUTOUPDATE" instead.' 1>&2; \
358           exit 1; \
359         fi
360
361 ## Tests should never call automake directly.
362 sc_tests_plain_automake:
363         @if grep -v '^#' $(srcdir)/tests/*.test | grep -E ':[   ]*automake([^:]|$$)'; then \
364           echo 'Do not run "automake" in the above tests.  Use "$$AUTOMAKE" instead.' 1>&2;  \
365           exit 1; \
366         fi
367
368 ## Tests should only use END and EOF for here documents
369 ## (so that the next test is effective).
370 sc_tests_here_document_format:
371         @if grep '<<' $(srcdir)/tests/*.test | grep -v 'END' | grep -v 'EOF'; then \
372           echo 'Use here documents with "END" and "EOF" only, for greppability.' 1>&2; \
373           exit 1; \
374         fi
375
376 ## Tests should never call exit directly, but use Exit.
377 ## This is so that the exit status is transported correctly across the 0 trap.
378 ## Ignore comments, and ignore one perl line in ext2.test.
379 sc_tests_Exit_not_exit:
380         @found=false; for file in $(srcdir)/tests/*.test; do \
381           res=`sed -n -e '/^#/d; /^\$$PERL/d' -e '/<<.*END/,/^END/b' \
382                       -e '/<<.*EOF/,/^EOF/b' -e '/exit [$$0-9]/p' $$file`; \
383           if test -n "$$res"; then \
384             echo "$$file:$$res"; \
385             found=true; \
386           fi; \
387         done; \
388         if $$found; then \
389           echo 'Do not call plain "exit", use "Exit" instead, in above tests.' 1>&2; \
390           exit 1; \
391         fi
392
393 ## Use AUTOMAKE_fails when appropriate
394 sc_tests_automake_fails:
395         @if grep -v '^#' $(srcdir)/tests/*.test | grep '\$$AUTOMAKE.*&&.*[eE]xit'; then \
396           echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2;  \
397           exit 1; \
398         fi
399
400 ## Tests should never call aclocal directly.
401 sc_tests_plain_aclocal:
402         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*aclocal'; then \
403           echo 'Do not run "aclocal" in the above tests.  Use "$$ACLOCAL" instead.' 1>&2;  \
404           exit 1; \
405         fi
406
407 ## Tests should never call perl directly.
408 sc_tests_plain_perl:
409         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*perl'; then \
410           echo 'Do not run "perl" in the above tests.  Use "$$PERL" instead.' 1>&2; \
411           exit 1; \
412         fi
413
414 ## Setting `required' after sourcing `./defs' is a bug.
415 sc_tests_required_after_defs:
416         @for file in $(srcdir)/tests/*.test; do \
417           if out=`sed -n '/defs/,$${/required=/p;}' $$file`; test -n "$$out"; then \
418             echo 'Do not set "required" after sourcing "defs" in '"$$file: $$out" 1>&2; \
419             exit 1; \
420           fi; \
421         done
422
423 ## Overriding a Makefile macro on the command line is not portable when
424 ## recursive targets are used.  Better use an envvar.  SHELL is an exception,
425 ## POSIX says it can't come from the environment.  V and DESTDIRS are exceptions,
426 ## too, as package authors are urged not to initialize them anywhere.
427 sc_tests_overriding_macros_on_cmdline:
428         @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(srcdir)/tests/*.test; then \
429           echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
430           echo ' in the above lines, it is more portable.' 1>&2; \
431           exit 1; \
432         fi
433         @if sed 's/DESTDIR=[^ ]*//; s/SHELL=[^ ]*//; s/V=[^ ]*//' $(srcdir)/tests/*.test | \
434             grep '\$$MAKE .*=' ; then \
435           echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
436           echo 'it is more portable.' 1>&2; \
437           exit 1; \
438         fi
439         @if grep 'SHELL=.*\$$MAKE' $(srcdir)/tests/*.test; then \
440           echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 1>&2; \
441           echo 'the above lines.' 1>&2; \
442           exit 1; \
443         fi
444
445 ## Never use `sleep 1' to create files with different timestamps.
446 ## Use `$sleep' instead.  Some filesystems (e.g., Windows') have only
447 ## a 2sec resolution.
448 sc_tests_plain_sleep:
449         @if grep -E '\bsleep +[12345]\b' $(srcdir)/tests/*.test; then \
450           echo 'Do not use "sleep x" in the above tests.  Use "$$sleep" instead.' 1>&2; \
451           exit 1; \
452         fi
453
454 ## fgrep and egrep are not required by POSIX.
455 sc_tests_plain_egrep_fgrep:
456         @if grep -E '\b[ef]grep\b' $(srcdir)/tests/*.test ; then \
457           echo 'Do not use egrep or fgrep in test cases.  Use $$FGREP or $$EGREP.' 1>&2; \
458           exit 1; \
459         fi
460         @if grep -E '\b[ef]grep\b' $(srcdir)/lib/am/*.am $(srcdir)/m4/*.m4; then \
461           echo 'Do not use egrep or fgrep in the above files, they are not portable.' 1>&2; \
462           exit 1; \
463         fi
464
465 ## Rule to ensure that the testsuite has been run before.  We don't depend on `check'
466 ## here, because that would be very wasteful in the common case.  We could run
467 ## `make check RECHECK_LOGS=' and avoid toplevel races with AM_RECURSIVE_TARGETS.
468 sc_ensure_testsuite_has_run:
469         @if test ! -f tests/test-suite.log; then \
470           echo "Run \`make check' before \`maintainer-check'" >&2; \
471           exit 1; \
472         fi
473 .PHONY: sc_ensure_testsuite_has_run
474
475 ## Ensure our warning and error messages do not contain duplicate 'warning:' prefixes.
476 ## This test actually depends on the testsuite having been run before.
477 sc_tests_logs_duplicate_prefixes: sc_ensure_testsuite_has_run
478         @if grep -E '(warning|error):.*(warning|error):' tests/*.log; then \
479           echo 'Duplicate warning/error message prefixes seen in above tests.' >&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