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, 2011, 2012 Free Software
7 # Foundation, Inc.
8
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2, or (at your option)
12 # any later version.
13
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18
19 # You should have received a copy of the GNU General Public License
20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
22 ## lib goes first, because it builds Config.pm, used by aclocal and
23 ## automake (run in doc, tests, and in the rebuild rules.)
24 ## `.' goes before doc and tests, because the latter two directories
25 ## run aclocal and automake.
26 SUBDIRS = lib . contrib doc m4 tests
27
28 bin_SCRIPTS = automake aclocal
29
30 CLEANFILES = $(bin_SCRIPTS)
31 AUTOMAKESOURCES = automake.in aclocal.in
32
33 TAGS_FILES = $(AUTOMAKESOURCES)
34
35 EXTRA_DIST = \
36   HACKING \
37   ChangeLog.96 \
38   ChangeLog.98 \
39   ChangeLog.00 \
40   ChangeLog.01 \
41   ChangeLog.02 \
42   ChangeLog.03 \
43   ChangeLog.04 \
44   ChangeLog.09 \
45   ChangeLog.11 \
46   bootstrap \
47   $(AUTOMAKESOURCES)
48
49 ## Make versioned links.  We only run the transform on the root name;
50 ## then we make a versioned link with the transformed base name.  This
51 ## seemed like the most reasonable approach.
52 install-exec-hook:
53         @$(POST_INSTALL)
54         @for p in $(bin_SCRIPTS); do \
55           f="`echo $$p|sed '$(transform)'`"; \
56           fv="$$f-$(APIVERSION)"; \
57           rm -f $(DESTDIR)$(bindir)/$$fv; \
58           echo " $(LN) $(DESTDIR)$(bindir)/$$f $(DESTDIR)$(bindir)/$$fv"; \
59           $(LN) $(DESTDIR)$(bindir)/$$f $(DESTDIR)$(bindir)/$$fv; \
60         done
61
62 uninstall-hook:
63         @for p in $(bin_SCRIPTS); do \
64           f="`echo $$p|sed '$(transform)'`"; \
65           fv="$$f-$(APIVERSION)"; \
66           rm -f $(DESTDIR)$(bindir)/$$fv; \
67         done
68
69
70 ## We can't use configure to do the substitution here; we must do it
71 ## by hand.  We use a funny notation here to avoid configure
72 ## substitutions in our text.
73 do_subst = sed \
74   -e 's,[@]APIVERSION[@],$(APIVERSION),g' \
75   -e 's,[@]PACKAGE[@],$(PACKAGE),g' \
76   -e 's,[@]PACKAGE_BUGREPORT[@],$(PACKAGE_BUGREPORT),g' \
77   -e 's,[@]PACKAGE_URL[@],$(PACKAGE_URL),g' \
78   -e 's,[@]PATH_SEPARATOR[@],$(PATH_SEPARATOR),g' \
79   -e 's,[@]PERL[@],$(PERL),g' \
80   -e 's,[@]PERL_THREADS[@],$(PERL_THREADS),g' \
81   -e 's,[@]SHELL[@],$(SHELL),g' \
82   -e 's,[@]am_AUTOCONF[@],$(am_AUTOCONF),g' \
83   -e 's,[@]am_AUTOM4TE[@],$(am_AUTOM4TE),g' \
84   -e 's,[@]VERSION[@],$(VERSION),g' \
85   -e 's,[@]configure_input[@],Generated from $@.in; do not edit by hand.,g' \
86   -e 's,[@]datadir[@],$(datadir),g'
87
88 ## These files depend on Makefile so they are rebuilt if $(VERSION),
89 ## $(datadir) or other do_subst'ituted variables change.
90 ## Use chmod a-w to prevent people from editing the wrong file by accident.
91 automake: automake.in
92 aclocal: aclocal.in
93 automake aclocal: Makefile
94         $(AM_V_at)rm -f $@ $@-t
95         $(AM_V_GEN)$(do_subst) $(srcdir)/$@.in >$@-t
96         $(AM_V_at)chmod a+x,a-w $@-t && mv -f $@-t $@
97
98 ## The master location for INSTALL is lib/INSTALL.
99 ## This is where `make fetch' will install new versions.
100 ## Make sure we also update this copy.
101 INSTALL: lib/INSTALL
102         $(AM_V_GEN)cp $(srcdir)/lib/INSTALL $@
103
104 # Run the testsuite with the installed aclocal and automake.
105 installcheck-local:
106         am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
107
108 ## recheck: convenience proxy target for the test suites.
109 .PHONY: recheck
110 recheck:
111         @failcom='exit 1'; \
112         for f in x $$MAKEFLAGS; do \
113           case $$f in \
114             *=* | --[!k]*);; \
115             *k*) failcom='fail=yes';; \
116           esac; \
117         done; \
118         for subdir in $(TEST_SUBDIRS); do \
119           ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@) \
120             || eval $$failcom; \
121         done; \
122         test -z "$$fail"
123
124 ################################################################
125 ##
126 ## Everything past here is useful to the maintainer, but probably not
127 ## to anybody else
128 ##
129
130 gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
131 gitlog_to_changelog_options = --since='2011-12-28 00:00:00' \
132                               --no-cluster --format '%s%n%n%b'
133
134 # Automatic generation of the ChangeLog from git history.
135 #
136 # When executed from a git checkout, generate the ChangeLog from the git
137 # history.  When executed from an extracted distribution tarball, just
138 # copy the distributed ChangeLog in the build directory (and if this
139 # fails, or if no distributed ChangeLog file is present, complain and
140 # give an error).
141 #
142 # We need the apparently useless dependency from another .PHONY target
143 # `am--changelog-regen-hook' to work around a bug of Solaris make, which
144 # doesn't execute the recipe of a target named as an existing file, even
145 # if such target is declared `.PHONY' (yikes!)
146 #
147 .PHONY: am--changelog-regen-hook
148 am--changelog-regen-hook:
149 ChangeLog: am--changelog-regen-hook
150         $(AM_V_GEN)set -e; set -u; \
151 ## The ChangeLog should be regenerated unconditionally when working from
152 ## checked-out sources; otherwise, if we're working from a distribution
153 ## tarball, we expect the ChangeLog to be distributed, so check that it
154 ## is indeed present in the source directory.
155         if test -d $(srcdir)/.git; then \
156           rm -f $@-t \
157             && $(gitlog_to_changelog_command) \
158                $(gitlog_to_changelog_options) >$@-t \
159             && chmod a-w $@-t \
160             && mv -f $@-t $@ \
161             || exit 1; \
162         elif test ! -f $(srcdir)/$@; then \
163           echo "Source tree is not a git checkout, and no pre-existent" \
164                "$@ file has been found there" >&2; \
165           exit 1; \
166         fi
167
168 # Ensure tests are world-executable
169 dist-hook:
170         $(am__cd) $(distdir)/tests && chmod a+rx *.test
171
172
173 # Perl coverage statistics.
174 PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
175 PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
176 PERL_COVER = cover
177
178 check-coverage-run recheck-coverage-run: all
179         $(mkinstalldirs) $(PERL_COVERAGE_DB)
180         PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
181         WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
182         $(MAKE) $(AM_MAKEFLAGS) `echo $@ | sed 's/-coverage-run//'`
183
184 check-coverage-report:
185         @if test ! -d "$(PERL_COVERAGE_DB)"; then \
186           echo "No coverage database found in \`$(PERL_COVERAGE_DB)'." >&2; \
187           echo "Please run \`make check-coverage' first" >&2; \
188           exit 1; \
189         fi
190         $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
191
192 # We don't use direct dependencies here because we'd like to be able
193 # to invoke the report even after interrupted check-coverage.
194 check-coverage: check-coverage-run
195         $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
196
197 recheck-coverage: recheck-coverage-run
198         $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
199
200 clean-coverage:
201         rm -rf "$(PERL_COVERAGE_DB)"
202 clean-local: clean-coverage
203
204 .PHONY: check-coverage recheck-coverage check-coverage-run \
205         recheck-coverage-run check-coverage-report clean-coverage
206
207 # We also have to take into account VPATH builds (where some generated
208 # tests might be in `$(builddir)' rather than in `$(srcdir)'), TAP-based
209 # tests script (which have a `.tap' extension) and helper scripts used
210 # by other test cases (which have a `.sh' extension).
211 xtests = \
212   `if test $(srcdir) = .; then \
213      dirs=.; \
214    else \
215      dirs='$(srcdir) .'; \
216    fi; \
217    for d in $$dirs; do \
218      for s in test tap sh; do \
219        ls $$d/tests/*.$$s 2>/dev/null; \
220      done; \
221    done | sort`
222
223 # Some simple checks, and then ordinary check.  These are only really
224 # guaranteed to work on my machine.
225 syntax_check_rules = \
226 sc_test_names \
227 sc_diff_automake_in_automake \
228 sc_diff_aclocal_in_automake \
229 sc_perl_syntax \
230 sc_no_brace_variable_expansions \
231 sc_rm_minus_f \
232 sc_no_for_variable_in_macro \
233 sc_mkinstalldirs \
234 sc_pre_normal_post_install_uninstall \
235 sc_perl_no_undef \
236 sc_perl_no_split_regex_space \
237 sc_cd_in_backquotes \
238 sc_cd_relative_dir \
239 sc_perl_at_uscore_in_scalar_context \
240 sc_perl_local_no_parens \
241 sc_perl_local \
242 sc_AMDEP_TRUE_in_automake_in \
243 sc_tests_make_without_am_makeflags \
244 sc_tests_obsolete_variables \
245 sc_tests_plain_make \
246 sc_tests_plain_autoconf \
247 sc_tests_plain_autoupdate \
248 sc_tests_plain_automake \
249 sc_tests_plain_autom4te \
250 sc_tests_plain_autoheader \
251 sc_tests_plain_autoreconf \
252 sc_tests_here_document_format \
253 sc_tests_Exit_not_exit \
254 sc_tests_automake_fails \
255 sc_tests_plain_aclocal \
256 sc_tests_plain_perl \
257 sc_tests_required_after_defs \
258 sc_tests_tap_plan \
259 sc_tests_overriding_macros_on_cmdline \
260 sc_tests_plain_sleep \
261 sc_tests_plain_egrep_fgrep \
262 sc_tests_PATH_SEPARATOR \
263 sc_tests_logs_duplicate_prefixes \
264 sc_tests_makefile_variable_order \
265 sc_mkdir_p \
266 sc_perl_at_substs \
267 sc_unquoted_DESTDIR \
268 sc_tabs_in_texi \
269 sc_at_in_texi
270
271 $(syntax_check_rules): automake aclocal
272 maintainer-check: $(syntax_check_rules)
273 .PHONY: maintainer-check $(syntax_check_rules)
274
275 ## Check that the list of tests given in the Makefile is equal to the
276 ## list of all test scripts in the Automake testsuite.
277 .PHONY: maintainer-check-list-of-tests
278 maintainer-check-list-of-tests:
279         $(am__cd) tests && $(MAKE) $(AM_MAKEFLAGS) $@
280 maintainer-check: maintainer-check-list-of-tests
281
282 ## Look for test whose names can cause spurious failures when used as
283 ## first argument to AC_INIT (chiefly because they might contain an
284 ## m4/m4sugar builtin or macro name).
285 m4_builtins = \
286   __gnu__ \
287   __unix__ \
288   bpatsubst \
289   bregexp \
290   builtin \
291   changecom \
292   changequote \
293   changeword \
294   debugfile \
295   debugmode \
296   decr \
297   define \
298   defn \
299   divert \
300   divnum \
301   dnl \
302   dumpdef \
303   errprint \
304   esyscmd \
305   eval \
306   format \
307   ifdef \
308   ifelse \
309   include \
310   incr \
311   index \
312   indir \
313   len \
314   m4exit \
315   m4wrap \
316   maketemp \
317   mkstemp \
318   patsubst \
319   popdef \
320   pushdef \
321   regexp \
322   shift \
323   sinclude \
324   substr \
325   symbols \
326   syscmd \
327   sysval \
328   traceoff \
329   traceon \
330   translit \
331   undefine \
332   undivert
333 sc_test_names:
334         @m4_builtin_rx=`echo $(m4_builtins) | sed 's/ /|/g'`; \
335          m4_macro_rx="\\<($$m4_builtin_rx)\\>|\\<_?(A[CUMHS]|m4)_"; \
336          if { \
337            for t in $(xtests); do echo $$t; done \
338              | LC_ALL=C grep -E "$$m4_macro_rx"; \
339          }; then \
340            echo "the names of the tests above can be problematic" 1>&2; \
341            echo "Avoid test names that contain names of m4 macros" 1>&2; \
342            exit 1; \
343          fi
344
345 ## These check avoids accidental configure substitutions in the source.
346 ## There are exactly 9 lines that should be modified from automake.in to
347 ## automake, and 10 lines that should be modified from aclocal.in to
348 ## aclocal; these wors out to 32 and 34 lines of diffs, respectively.
349 sc_diff_automake_in_automake:
350         @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 32; then \
351           echo "found too many diffs between automake.in and automake" 1>&2; \
352           diff -c $(srcdir)/automake.in automake; \
353           exit 1; \
354         fi
355 sc_diff_aclocal_in_aclocal:
356         @if test `diff $(srcdir)/aclocal.in aclocal | wc -l` -ne 34; then \
357           echo "found too many diffs between aclocal.in and aclocal" 1>&2; \
358           diff -c $(srcdir)/aclocal.in aclocal; \
359           exit 1; \
360         fi
361
362 ## Syntax check with default Perl (on my machine, Perl 5).
363 sc_perl_syntax:
364         @perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w automake
365         @perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w aclocal
366
367 ## expect no instances of '${...}'.  However, $${...} is ok, since that
368 ## is a shell construct, not a Makefile construct.
369 sc_no_brace_variable_expansions:
370         @if grep -F '$${' $(srcdir)/lib/am/[a-z]*.am | \
371                grep -F -v '$$$$'; then \
372           echo "Found too many uses of '\$${' in the lines above." 1>&2; \
373           exit 1;                               \
374         else :; fi
375
376 ## Make sure `rm' is called with `-f'.
377 sc_rm_minus_f:
378         @if grep -v '^#' $(srcdir)/lib/am/[a-z]*.am $(xtests) \
379            | grep -E '\<rm ([^-]|\-[^f ]*\>)'; \
380         then \
381           echo "Suspicious 'rm' invocation." 1>&2; \
382           exit 1;                               \
383         else :; fi
384
385 ## Never use something like `for file in $(FILES)', this doesn't work
386 ## if FILES is empty or if it contains shell meta characters (e.g. $ is
387 ## commonly used in Java filenames).
388 sc_no_for_variable_in_macro:
389         @if grep 'for .* in \$$(' $(srcdir)/lib/am/[a-z]*.am; then \
390           echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
391           exit 1; \
392         else :; fi
393
394 ## Make sure all invocations of mkinstalldirs are correct.
395 sc_mkinstalldirs:
396         @if grep -n 'mkinstalldirs' $(srcdir)/lib/am/[a-z]*.am | \
397               grep -F -v '$$(mkinstalldirs)'; then \
398           echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
399           exit 1; \
400         else :; fi
401
402 ## Make sure all calls to PRE/NORMAL/POST_INSTALL/UNINSTALL
403 sc_pre_normal_post_install_uninstall:
404         @if grep -E -n '\((PRE|NORMAL|POST)_(|UN)INSTALL\)' \
405                  $(srcdir)/lib/am/[a-z]*.am | \
406               grep -v ':##' | grep -v ':        @\$$('; then \
407           echo "Found incorrect use of PRE/NORMAL/POST_INSTALL/UNINSTALL in the lines above" 1>&2; \
408           exit 1; \
409         else :; fi
410
411 ## We never want to use "undef", only "delete", but for $/.
412 sc_perl_no_undef:
413         @if grep -n -w 'undef ' $(srcdir)/automake.in | \
414               grep -F -v 'undef $$/'; then \
415           echo "Found undef in automake.in; use delete instead" 1>&2; \
416           exit 1; \
417         fi
418
419 ## We never want split (/ /,...), only split (' ', ...).
420 sc_perl_no_split_regex_space:
421         @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
422           echo "Found bad split in the lines above." 1>&2; \
423           exit 1; \
424         fi
425
426 ## Look for cd within backquotes
427 sc_cd_in_backquotes:
428         @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in \
429               $(srcdir)/lib/am/*.am; then \
430           echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
431           exit 1; \
432         fi
433
434 ## Look for cd to a relative directory (may be influenced by CDPATH).
435 ## Skip some known directories that are OK.
436 sc_cd_relative_dir:
437         @if grep -n '^[^#]*cd ' $(srcdir)/automake.in \
438               $(srcdir)/lib/am/*.am | \
439               grep -v 'echo.*cd ' | \
440               grep -v 'am__cd =' | \
441               grep -v '^[^#]*cd [./]' | \
442               grep -v '^[^#]*cd \$$(top_builddir)' | \
443               grep -v '^[^#]*cd "\$$\$$am__cwd' | \
444               grep -v '^[^#]*cd \$$(abs' | \
445               grep -v '^[^#]*cd "\$$(DESTDIR)'; then \
446           echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
447           exit 1; \
448         fi
449
450 ## Using @_ in a scalar context is most probably a programming error.
451 sc_perl_at_uscore_in_scalar_context:
452         @if grep -Hn '[^@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' $(srcdir)/automake.in; then \
453           echo "Using @_ in a scalar context in the lines above." 1>&2; \
454           exit 1; \
455         fi
456
457 ## Forbid using parens with `local' to ease counting.
458 sc_perl_local_no_parens:
459         @if grep '^[ \t]*local *(' $(srcdir)/automake.in; then \
460           echo "Don't use \`local' with parens: use several \`local' above." >&2; \
461           exit 1; \
462         fi
463
464 ## Allow only few variables to be localized in Automake.
465 sc_perl_local:
466         @if egrep -v '^[ \t]*local \$$[_~]( *=|;)' $(srcdir)/automake.in | \
467                 grep '^[ \t]*local [^*]'; then \
468           echo "Please avoid \`local'." 1>&2; \
469           exit 1; \
470         fi
471
472 ## Don't let AMDEP_TRUE substitution appear in automake.in.
473 sc_AMDEP_TRUE_in_automake_in:
474         @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
475           echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
476           exit 1; \
477         fi
478
479 ## Tests should never call make directly.
480 sc_tests_make_without_am_makeflags:
481         @if grep '^[^#].*(MAKE) ' $(srcdir)/lib/am/*.am $(srcdir)/automake.in |\
482                 grep -v 'AM_MAKEFLAGS'; then \
483           echo 'Use $$(MAKE) $$(AM_MAKEFLAGS).' 1>&2; \
484           exit 1; \
485         fi
486
487 ## Look out for some obsolete variables.
488 sc_tests_obsolete_variables:
489         @vars=" \
490           using_tap \
491           parallel_tests \
492           test_prefer_config_shell \
493           original_AUTOMAKE \
494           original_ACLOCAL \
495         "; \
496         seen=""; \
497         for v in $$vars; do \
498           if grep -E "\b$$v\b" \
499             $(xtests) $(srcdir)/tests/defs \
500             $(srcdir)/tests/defs-static.in \
501           ; then \
502             seen="$$seen $$v"; \
503           fi; \
504         done; \
505         if test -n "$$seen"; then \
506           for v in $$seen; do \
507             echo "Variable '$$v' is obsolete, use 'am_$$v' instead." 1>&2; \
508           done; \
509           exit 1; \
510         else :; fi
511
512 ## Tests should never call make directly.
513 sc_tests_plain_make:
514         @if grep -v '^#' $(xtests) | $(EGREP) ':[       ]*make( |$$)'; then \
515           echo 'Do not run "make" in the above tests.  Use "$$MAKE" instead.' 1>&2; \
516           exit 1; \
517         fi
518
519 ## Tests should never call autoconf directly.
520 sc_tests_plain_autoconf:
521         @if grep -v '^#' $(xtests) | grep ':[   ]*autoconf\>'; then \
522           echo 'Do not run "autoconf" in the above tests.  Use "$$AUTOCONF" instead.' 1>&2; \
523           exit 1; \
524         fi
525
526 ## Tests should never call autoupdate directly.
527 sc_tests_plain_autoupdate:
528         @if grep -v '^#' $(xtests) | grep ':[   ]*autoupdate\>'; then \
529           echo 'Do not run "autoupdate" in the above tests.  Use "$$AUTOUPDATE" instead.' 1>&2; \
530           exit 1; \
531         fi
532
533 ## Tests should never call automake directly.
534 sc_tests_plain_automake:
535         @if grep -v '^#' $(xtests) | grep -E ':[        ]*automake\>([^:]|$$)'; then \
536           echo 'Do not run "automake" in the above tests.  Use "$$AUTOMAKE" instead.' 1>&2;  \
537           exit 1; \
538         fi
539
540 ## Tests should never call autoheader directly.
541 sc_tests_plain_autoheader:
542         @if grep -v '^#' $(xtests) | grep ':[   ]*autoheader\>'; then \
543           echo 'Do not run "autoheader" in the above tests.  Use "$$AUTOHEADER" instead.' 1>&2;  \
544           exit 1; \
545         fi
546
547 ## Tests should never call autoreconf directly.
548 sc_tests_plain_autoreconf:
549         @if grep -v '^#' $(xtests) | grep ':[   ]*autoreconf\>'; then \
550           echo 'Do not run "autoreconf" in the above tests.  Use "$$AUTORECONF" instead.' 1>&2;  \
551           exit 1; \
552         fi
553
554 ## Tests should never call autom4te directly.
555 sc_tests_plain_autom4te:
556         @if grep -v '^#' $(xtests) | grep ':[   ]*autom4te\>'; then \
557           echo 'Do not run "autom4te" in the above tests.  Use "$$AUTOM4TE" instead.' 1>&2;  \
558           exit 1; \
559         fi
560
561 ## Tests should only use END and EOF for here documents
562 ## (so that the next test is effective).
563 sc_tests_here_document_format:
564         @if grep '<<' $(xtests) | grep -v 'END' | grep -v 'EOF'; then \
565           echo 'Use here documents with "END" and "EOF" only, for greppability.' 1>&2; \
566           exit 1; \
567         fi
568
569 ## Tests should never call exit directly, but use Exit.
570 ## This is so that the exit status is transported correctly across the 0 trap.
571 ## Ignore comments, testsuite self tests, and one perl line in ext2.test.
572 sc_tests_Exit_not_exit:
573         @found=false; for file in $(xtests); do \
574           case $$file in */self-check-*) continue;; esac; \
575           res=`sed -n -e '/^#/d; /^\$$PERL/d' -e '/<<.*END/,/^END/b' \
576                       -e '/<<.*EOF/,/^EOF/b' -e '/exit [$$0-9]/p' $$file`; \
577           if test -n "$$res"; then \
578             echo "$$file:$$res"; \
579             found=true; \
580           fi; \
581         done; \
582         if $$found; then \
583           echo 'Do not call plain "exit", use "Exit" instead, in above tests.' 1>&2; \
584           exit 1; \
585         fi
586
587 ## Use AUTOMAKE_fails when appropriate
588 sc_tests_automake_fails:
589         @if grep -v '^#' $(xtests) | grep '\$$AUTOMAKE.*&&.*[eE]xit'; then \
590           echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2;  \
591           exit 1; \
592         fi
593
594 ## Tests should never call aclocal directly.
595 sc_tests_plain_aclocal:
596         @if grep -v '^#' $(xtests) | grep ':[   ]*aclocal\>'; then \
597           echo 'Do not run "aclocal" in the above tests.  Use "$$ACLOCAL" instead.' 1>&2;  \
598           exit 1; \
599         fi
600
601 ## Tests should never call perl directly.
602 sc_tests_plain_perl:
603         @if grep -v '^#' $(xtests) | grep ':[   ]*perl\>'; then \
604           echo 'Do not run "perl" in the above tests.  Use "$$PERL" instead.' 1>&2; \
605           exit 1; \
606         fi
607
608 ## Setting `required' after sourcing `./defs' is a bug.
609 sc_tests_required_after_defs:
610         @for file in $(xtests); do \
611           if out=`sed -n '/defs/,$${/required=/p;}' $$file`; test -n "$$out"; then \
612             echo 'Do not set "required" after sourcing "defs" in '"$$file: $$out" 1>&2; \
613             exit 1; \
614           fi; \
615         done
616
617 ## TAP-based test scripts should not forget to declare a TAP plan.  In
618 ## case it is not known in advance how many tests will be run, a "lazy"
619 ## plan can be used; but its use should be deliberate, explicitly declared
620 ## with a "plan_ later" call, rather than the result of an oversight.
621 ## This check helps to ensure this is indeed the case.
622 sc_tests_tap_plan:
623         @with_plan=`grep -l '^ *plan_ ' $(srcdir)/tests/*.tap`; \
624          with_plan=`echo $$with_plan`; \
625          ok=:; \
626          for t in $(srcdir)/tests/*.tap; do \
627            case " $$with_plan " in *" $$t "*) continue;; esac; \
628 ## It's ok for an *auto-generated* test sourcing an hand-written one not
629 ## to declare a TAP plan: that will be done by the sourced test.
630            case $$t in \
631              *-w.tap) \
632                t2=`echo $$t | sed -e 's|.*/||' -e 's/-w\.tap$$/.tap/'` \
633                  && grep -E "^ *\\.  *[^        ]*/$$t2\\b" $$t >/dev/null \
634                  && continue || : ;; \
635            esac; \
636            ok=false; echo $$t; \
637          done; \
638          $$ok || { \
639           echo 'The tests above do not declare a TAP plan.' 1>&2; \
640           exit 1; \
641          }
642
643 ## Overriding a Makefile macro on the command line is not portable when
644 ## recursive targets are used.  Better use an envvar.  SHELL is an
645 ## exception, POSIX says it can't come from the environment.  V, DESTDIR,
646 ## DISTCHECK_CONFIGURE_FLAGS and DISABLE_HARD_ERRORS are exceptions, too,
647 ## as package authors are urged not to initialize them anywhere.
648 sc_tests_overriding_macros_on_cmdline:
649         @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(xtests); then \
650           echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
651           echo ' in the above lines, it is more portable.' 1>&2; \
652           exit 1; \
653         fi
654 ## Also try to account for usages like "$MAKE || st=$?".
655         @if sed -e 's/ || .*//' -e 's/ && .*//' \
656                 -e 's/ DESTDIR=[^ ]*/ /' -e 's/ SHELL=[^ ]*/ /' \
657                 -e 's/ V=[^ ]*/ /' -e 's/ DISABLE_HARD_ERRORS=[^ ]*/ /' \
658 ## DISTCHECK_CONFIGURE_FLAGS is allowed to contain whitespace in its
659 ## definition, so the more complex substitutions below.
660                 -e "s/ DISTCHECK_CONFIGURE_FLAGS='[^']*'/ /" \
661                 -e 's/ DISTCHECK_CONFIGURE_FLAGS="[^"]*"/ /' \
662                 -e 's/ DISTCHECK_CONFIGURE_FLAGS=[^ ]/ /' \
663               $(xtests) | grep '\$$MAKE .*='; then \
664           echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
665           echo 'it is more portable.' 1>&2; \
666           exit 1; \
667         fi
668         @if grep 'SHELL=.*\$$MAKE' $(xtests); then \
669           echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 1>&2; \
670           echo 'the above lines.' 1>&2; \
671           exit 1; \
672         fi
673
674 ## Never use `sleep 1' to create files with different timestamps.
675 ## Use `$sleep' instead.  Some filesystems (e.g., Windows') have only
676 ## a 2sec resolution.
677 sc_tests_plain_sleep:
678         @if grep -E '\bsleep +[12345]\b' $(xtests); then \
679           echo 'Do not use "sleep x" in the above tests.  Use "$$sleep" instead.' 1>&2; \
680           exit 1; \
681         fi
682
683 ## fgrep and egrep are not required by POSIX.
684 sc_tests_plain_egrep_fgrep:
685         @if grep -E '\b[ef]grep\b' $(xtests) ; then \
686           echo 'Do not use egrep or fgrep in test cases.  Use $$FGREP or $$EGREP.' 1>&2; \
687           exit 1; \
688         fi
689         @if grep -E '\b[ef]grep\b' $(srcdir)/lib/am/*.am $(srcdir)/m4/*.m4; then \
690           echo 'Do not use egrep or fgrep in the above files, they are not portable.' 1>&2; \
691           exit 1; \
692         fi
693
694 ## Rule to ensure that the testsuite has been run before.  We don't depend on `check'
695 ## here, because that would be very wasteful in the common case.  We could run
696 ## `make check RECHECK_LOGS=' and avoid toplevel races with AM_RECURSIVE_TARGETS.
697 ## Suggest keeping test directories around for greppability of the Makefile.in files.
698 sc_ensure_testsuite_has_run:
699         @if test ! -f tests/test-suite.log; then \
700           echo "Run \`env keep_testdirs=yes make check' before \`maintainer-check'" >&2; \
701           exit 1; \
702         fi
703 .PHONY: sc_ensure_testsuite_has_run
704
705 ## Ensure our warning and error messages do not contain duplicate 'warning:' prefixes.
706 ## This test actually depends on the testsuite having been run before.
707 sc_tests_logs_duplicate_prefixes: sc_ensure_testsuite_has_run
708         @if grep -E '(warning|error):.*(warning|error):' tests/*.log; then \
709           echo 'Duplicate warning/error message prefixes seen in above tests.' >&2; \
710           exit 1; \
711         fi
712
713 ## Ensure variables are listed before rules in Makefile.in files we generate.
714 sc_tests_makefile_variable_order: sc_ensure_testsuite_has_run
715         @for file in `find tests -name Makefile.in -print`; do \
716           latevars=`sed -n \
717             -e :x -e 's/#.*//' \
718             -e '/\\\\$$/{' -e N -e 'b x' -e '}' \
719 ## Literal TAB.
720             -e '1,/^    /d' \
721 ## Allow @ so we match conditionals.
722             -e '/^ *[a-zA-Z_@]\{1,\} *=/p' $$file`; \
723           if test -n "$$latevars"; then \
724             echo 'Ensure variables are expanded before rules' >&2; \
725             echo "Variables are expanded too late in $$file:" >&2; \
726             echo "$$latevars" | sed 's/^/  /' >&2; \
727             exit 1; \
728           fi; \
729         done
730
731 ## Using `:' as a PATH separator is not portable.
732 sc_tests_PATH_SEPARATOR:
733         @if grep -E '\bPATH=.*:.*' $(xtests) ; then \
734           echo "Use \`\$$PATH_SEPARATOR', not \`:', in PATH definitions above." 1>&2; \
735           exit 1; \
736         fi
737
738 sc_mkdir_p:
739         @if grep 'mkdir_p' \
740           $(srcdir)/automake.in \
741           $(srcdir)/lib/am/*.am \
742           $(xtests); \
743         then \
744           echo 'Do not use mkdir_p in the above files, use MKDIR_P.' 1>&2; \
745           exit 1; \
746         fi
747
748 ## Try to make sure all @...@ substitutions are covered by our
749 ## substitution rule.
750 sc_perl_at_substs:
751         @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
752           echo "Unresolved @...@ substitution in aclocal" 1>&2; \
753           exit 1; \
754         fi
755         @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' automake | wc -l` -ne 0; then \
756           echo "Unresolved @...@ substitution in automake" 1>&2; \
757           exit 1; \
758         fi
759
760 sc_unquoted_DESTDIR:
761         @if grep -E "[^\'\"]\\\$$\(DESTDIR" $(srcdir)/lib/am/*.am; then \
762           echo 'Suspicious unquoted DESTDIR uses.' 1>&2 ; \
763           exit 1; \
764         fi
765
766 sc_tabs_in_texi:
767         @if grep '      ' $(srcdir)/doc/automake.texi; then \
768           echo 'Do not use tabs in the manual.' 1>&2; \
769           exit 1; \
770         fi
771
772 sc_at_in_texi:
773         @if grep -E '([^@]|^)@([         ][^@]|$$)' $(srcdir)/doc/automake.texi; \
774         then \
775           echo 'Unescaped @.' 1>&2; \
776           exit 1; \
777         fi
778
779
780 git-dist: maintainer-check
781 ## Make sure the NEWS file is up-to-date.
782         @if sed 1q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \
783           echo "NEWS not updated; not releasing" 1>&2; \
784           exit 1;                               \
785         fi
786 ## Build the distribution.  We expect the developer to have already run
787 ## "make check" and "make distcheck" on his own (as required in the
788 ## HACKING file, section "Release procedure").
789         $(MAKE) $(AM_MAKEFLAGS) dist
790 ## Finally, if anything was successful, commit the last changes and tag
791 ## the release in the repository.  We don't use RCS keywords so it's OK
792 ## to distribute the files before they were committed.
793         $(am__cd) $(srcdir) && git commit -a -s && \
794            git tag -s "v$(VERSION)" -m "Release $(VERSION)"
795
796 git-release: git-dist
797         case $(VERSION) in \
798           *[a-z]) dest=alpha;; \
799           *)      dest=ftp;; \
800         esac; \
801         $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) \
802           --to $$dest.gnu.org:automake $(DIST_ARCHIVES)
803
804 ## Visually comparing differences between the Makefile.in files in
805 ## automake's own build system as generated in two different branches
806 ## might help to catch bugs and blunders.  This has already happened a
807 ## few times in the past, when we used to version-control Makefile.in.
808 autodiffs:
809         @set -u; \
810          NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
811          OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
812          am_gitdir='$(abs_top_srcdir)/.git'; \
813          get_autofiles_from_rev () \
814          { \
815              rev=$$1 dir=$$2 \
816                && echo "$@: will get files from revision $$rev" \
817                && git clone -q --depth 1 "$$am_gitdir" tmp \
818                && cd tmp \
819                && git checkout -q "$$rev" \
820                && echo "$@: bootstrapping $$rev" \
821                && $(SHELL) ./bootstrap \
822                && echo "$@: copying files from $$rev" \
823                && makefile_ins=`find . -name Makefile.in` \
824                && (tar cf - configure aclocal.m4 $$makefile_ins) | \
825                   (cd .. && cd "$$dir" && tar xf -) \
826                && cd .. \
827                && rm -rf tmp; \
828          }; \
829          outdir=$@.dir \
830 ## Before proceeding, ensure the specified revisions truly exist.
831            && git --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
832            && git --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
833            && rm -rf $$outdir \
834            && mkdir $$outdir \
835            && cd $$outdir \
836            && mkdir new old \
837            && get_autofiles_from_rev $$OLD_COMMIT old \
838            && get_autofiles_from_rev $$NEW_COMMIT new \
839            && exit 0
840 ## With lots of eye candy; we like our developers pampered and spoiled :-)
841 compare-autodiffs: autodiffs
842         @set -u; \
843         : $${COLORDIFF=colordiff} $${DIFF=diff}; \
844         dir=autodiffs.dir; \
845         if test ! -d "$$dir"; then \
846           echo "$@: $$dir: Not a directory" >&2; \
847           exit 1; \
848         fi; \
849         mydiff=false mypager=false; \
850         if test -t 1; then \
851           if ($$COLORDIFF -r . .) </dev/null >/dev/null 2>&1; then \
852             mydiff=$$COLORDIFF; \
853             mypager="less -R"; \
854           else \
855             mypager=less; \
856           fi; \
857         else \
858           mypager=cat; \
859         fi; \
860         if test "$$mydiff" = false; then \
861           if ($$DIFF -r -u . .); then \
862             mydiff=$$DIFF; \
863           else \
864             echo "$@: no good-enough diff program specified" >&2; \
865             exit 1; \
866           fi; \
867         fi; \
868         st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
869         rm -rf $$dir; \
870         exit $$st
871 .PHONY: autodiffs compare-autodiffs
872
873 ## Program to use to fetch files.
874 WGET = wget
875 WGET_SV_CVS = $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/
876 WGET_SV_GIT_CF = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
877 WGET_SV_GIT_AC = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
878 WGET_SV_GIT_GL = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
879 WGET_GCC = $(WGET) 'http://gcc.gnu.org/viewcvs/*checkout*/trunk/'
880
881 ## Files that we fetch and which we compare against.
882 ## FIXME should be a lot more here
883 FETCHFILES = \
884 INSTALL \
885 config-ml.in \
886 config.guess \
887 config.sub \
888 gnupload \
889 gitlog-to-changelog \
890 symlink-tree \
891 texinfo.tex
892
893 ## Fetch the latest versions of files we care about.
894 fetch:
895         rm -rf Fetchdir > /dev/null 2>&1
896         mkdir Fetchdir
897 ## If a get fails then that is a problem.
898         ($(am__cd) Fetchdir && \
899         $(WGET_SV_GIT_CF)config.guess -O config.guess && \
900         $(WGET_SV_GIT_CF)config.sub -O config.sub && \
901         $(WGET_SV_CVS)texinfo/texinfo/doc/texinfo.tex -O texinfo.tex && \
902         $(WGET_SV_GIT_GL)doc/INSTALL -O INSTALL && \
903         $(WGET_SV_GIT_GL)build-aux/gnupload -O gnupload && \
904         $(WGET_SV_GIT_GL)build-aux/gitlog-to-changelog -O gitlog-to-changelog && \
905         $(WGET_GCC)config-ml.in -O config-ml.in && \
906         $(WGET_GCC)symlink-tree -O symlink-tree)
907 ## Don't exit after test because we want to give as many errors as
908 ## possible.
909         @stat=0; for file in $(FETCHFILES); do \
910           if diff -u $(srcdir)/lib/$$file Fetchdir/$$file \
911                   >>Fetchdir/update.patch 2>/dev/null; then :; \
912           else \
913             stat=1; \
914             echo "Updating $(srcdir)/lib/$$file ..."; \
915             cp Fetchdir/$$file $(srcdir)/lib/$$file; \
916           fi; \
917         done; \
918         test $$stat = 0 || \
919           echo "See Fetchdir/update.patch for a log of the changes."; \
920         exit $$stat
921 .PHONY: fetch
922
923 ## Generate release statistics, for the table in automake.texi.
924 ## This has to be run in an up to date build tree, but there must
925 ## be no temp files nor unused other files lying around!
926 release-stats: ps
927         $(AM_V_GEN): && \
928         am=`wc -l < automake` && \
929         acl=`wc -l < aclocal` && \
930         pmfiles="lib/Automake/*.pm" && \
931         if test . != '$(srcdir)'; then pmfiles="$$pmfiles $(srcdir)/lib/Automake/*.pm"; \
932         else :; fi && \
933         pm=`cat $$pmfiles | wc -l` && \
934         dot_am_files=`ls -1 $(srcdir)/lib/am/*.am | grep -v Makefile.am` && \
935         amf=`echo "$$dot_am_files" | wc -l` && \
936         aml=`cat $$dot_am_files | wc -l` && \
937         m4f=`ls -1 $(srcdir)/m4/*.m4 | wc -l` && \
938         m4l=`cat $(srcdir)/m4/*.m4 | wc -l` && \
939         doc_text=`$(am__cd) doc && LC_ALL=C pstops 0 automake.ps unused.ps 2>&1` && \
940         echo "$$doc_text" && \
941         rm -f doc/unused.ps && \
942         doc=`echo "$$doc_text" | sed -n 's/.*Wrote \([1-9][0-9]*\) pages.*/\1/p'` && \
943         tests="tests/*.test"; \
944         if test . != '$(srcdir)'; then tests="$$tests $(srcdir)/tests/*.test"; \
945         else :; fi && \
946         t=`ls -1 $$tests | wc -l` && \
947         tgen=`grep 'GENERATED AUTOMATICALLY' $$tests | wc -l` && \
948         today=`date +%Y-%m-%d` && \
949         echo "add this to the table in doc/automake.texi after verification:" && \
950         printf '@item %s @tab %-6s @tab %4d @tab %4d @tab %4d @tab %4d %-4s @tab %4d %-4s @tab %3d @tab %d %-4s\n' \
951                       $$today $(VERSION) $$am    $$acl    $$pm   $$aml "($$amf)" $$m4l "($$m4f)" $$doc $$t "($$tgen)"
952 .PHONY: release-stats