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