tests: "am_using_tap=yes" -> "am_test_protocol=tap"
[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-2012 Free Software Foundation, Inc.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20 ## Might be updated later.
21 CLEANFILES =
22 DISTCLEANFILES =
23 MAINTAINERCLEANFILES =
24 EXTRA_DIST =
25
26 ## ------------ ##
27 ##  Top level.  ##
28 ## ------------ ##
29
30 # We want a handful of substitutions to be fully-expanded by make;
31 # then use config.status to substitute the remainder where a single
32 # expansion is sufficient.  We use a funny notation here to avoid
33 # configure substitutions in our text.
34 do_subst = ( sed \
35   -e "s,[@]configure_input[@],Generated from $$in; do not edit by hand.,g" \
36   -e 's,[@]datadir[@],$(datadir),g' \
37   -e 's,[@]amdir[@],$(amdir),g' \
38   -e 's,[@]bindir[@],$(bindir),g' \
39   -e 's,[@]docdir[@],$(docdir),g' \
40   -e 's,[@]pkgvdatadir[@],$(pkgvdatadir),g' \
41   -e 's,[@]scriptdir[@],$(scriptdir),g' \
42   -e 's,[@]automake_acdir[@],$(automake_acdir),g' \
43   -e 's,[@]system_acdir[@],$(system_acdir),g' \
44 ## Hack to avoid a spurious substitution in the Automake script (part 1).
45   -e 's,[@]am__isrc[@],!!@!!am__isrc!!@!!,g' \
46   | $(SHELL) ./config.status --file=- \
47 ## Hack to avoid a spurious substitution in the Automake script (part 2).
48   | sed -e 's,!!@!!am__isrc!!@!!,@''am__isrc@,g' \
49   )
50
51 # Generated  files shouldn't contain unexpanded '@substitutions@', and
52 # should be made read-only, to prevent them from being edited by mistake
53 # instead of the file the are generated from.
54 generated_file_finalize = $(AM_V_at) \
55   if LC_ALL=C grep '@[a-zA-Z0-9_][a-zA-Z0-9_]*@' $@-t; then \
56     echo "$@ contains unexpanded substitution (see lines above)"; \
57     exit 1; \
58   fi; \
59   chmod a-w $@-t && mv -f $@-t $@
60
61 bin_SCRIPTS = automake aclocal
62
63 CLEANFILES += $(bin_SCRIPTS)
64 AUTOMAKESOURCES = automake.in aclocal.in
65
66 TAGS_FILES = $(AUTOMAKESOURCES)
67
68 EXTRA_DIST += \
69   $(AUTOMAKESOURCES) \
70   bootstrap.sh \
71   GNUmakefile \
72   syntax-checks.mk \
73   HACKING
74
75 ## Make versioned links.  We only run the transform on the root name;
76 ## then we make a versioned link with the transformed base name.  This
77 ## seemed like the most reasonable approach.
78 install-exec-hook:
79         @$(POST_INSTALL)
80         @for p in $(bin_SCRIPTS); do \
81           f="`echo $$p|sed '$(transform)'`"; \
82           fv="$$f-$(APIVERSION)"; \
83           rm -f "$(DESTDIR)$(bindir)/$$fv"; \
84           echo " $(LN) '$(DESTDIR)$(bindir)/$$f' '$(DESTDIR)$(bindir)/$$fv'"; \
85           $(LN) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$fv"; \
86         done
87
88 uninstall-hook:
89         @for p in $(bin_SCRIPTS); do \
90           f="`echo $$p|sed '$(transform)'`"; \
91           fv="$$f-$(APIVERSION)"; \
92           rm -f "$(DESTDIR)$(bindir)/$$fv"; \
93         done
94
95 ## These files depend on Makefile so they are rebuilt if $(VERSION),
96 ## $(datadir) or other do_subst'ituted variables change.
97 automake: automake.in
98 aclocal: aclocal.in
99 automake aclocal: Makefile
100         $(AM_V_at)rm -f $@ $@-t
101         $(AM_V_GEN)in=$@.in; $(do_subst) <$(srcdir)/$@.in >$@-t
102 ## We can't use '$(generated_file_finalize)' here, because currently
103 ## Automake contains occurrences of unexpanded @substitutions@ in
104 ## comments, and that is perfectly legit.
105         $(AM_V_at)chmod a+x,a-w $@-t && mv -f $@-t $@
106
107 ## The master location for INSTALL is lib/INSTALL.
108 ## This is where "make fetch" will install new versions.
109 ## Make sure we also update this copy.
110 INSTALL: lib/INSTALL
111         $(AM_V_GEN)cp $(srcdir)/lib/INSTALL $@
112
113 # We don't use the default name for the autom4te cache directory,
114 # so we need this.
115 maintainer-clean-local:
116         rm -rf .autom4te.cache
117
118
119 ## -------------------------------------------------------------------- ##
120 ##  Auxiliary scripts and files for use with "automake --add-missing".  ##
121 ## -------------------------------------------------------------------- ##
122
123 dist_pkgvdata_DATA = \
124   lib/COPYING \
125   lib/INSTALL \
126   lib/texinfo.tex
127
128 ## These must all be executable when installed.  However, if we use
129 ## _SCRIPTS, then the program transform will be applied, which is not
130 ## what we want.  So we make them executable by hand.
131 dist_script_DATA = \
132   lib/config.guess \
133   lib/config.sub \
134   lib/install-sh \
135   lib/mdate-sh \
136   lib/missing \
137   lib/mkinstalldirs \
138   lib/elisp-comp \
139   lib/ylwrap \
140   lib/depcomp \
141   lib/compile \
142   lib/py-compile \
143   lib/ar-lib \
144   lib/test-driver \
145   lib/tap-driver.sh \
146   lib/tap-driver.pl
147
148 install-data-hook:
149         @$(POST_INSTALL)
150         @for f in $(dist_script_DATA); do echo $$f; done \
151           | sed 's,^lib/,,' \
152           | ( st=0; \
153               while read f; do \
154                 echo " chmod +x '$(DESTDIR)$(scriptdir)/$$f'"; \
155                 chmod +x "$(DESTDIR)$(scriptdir)/$$f" || st=1; \
156               done; \
157               exit $$st )
158
159 installcheck-local: installcheck-executable-scripts
160 installcheck-executable-scripts:
161         @for f in $(dist_script_DATA); do echo $$f; done \
162           | sed 's,^lib/,,' \
163           | while read f; do \
164               path="$(pkgvdatadir)/$$f"; \
165               test -x "$$path" || echo $$path; \
166             done \
167           | sed 's/$$/: not executable/' \
168           | grep . 1>&2 && exit 1; exit 0
169
170
171 ## ---------------------------------------------------- ##
172 ##  Private perl modules used by automake and aclocal.  ##
173 ## ---------------------------------------------------- ##
174
175 perllibdir = $(pkgvdatadir)/Automake
176 dist_perllib_DATA = \
177   lib/Automake/ChannelDefs.pm \
178   lib/Automake/Channels.pm \
179   lib/Automake/Condition.pm \
180   lib/Automake/Configure_ac.pm \
181   lib/Automake/DisjConditions.pm \
182   lib/Automake/FileUtils.pm \
183   lib/Automake/General.pm \
184   lib/Automake/Getopt.pm \
185   lib/Automake/Item.pm \
186   lib/Automake/ItemDef.pm \
187   lib/Automake/Location.pm \
188   lib/Automake/Options.pm \
189   lib/Automake/Rule.pm \
190   lib/Automake/RuleDef.pm \
191   lib/Automake/Variable.pm \
192   lib/Automake/VarDef.pm \
193   lib/Automake/Version.pm \
194   lib/Automake/XFile.pm \
195   lib/Automake/Wrap.pm
196
197 nodist_perllib_DATA = lib/Automake/Config.pm
198 CLEANFILES += $(nodist_perllib_DATA)
199
200 lib/Automake/Config.pm: lib/Automake/Config.in Makefile
201         $(AM_V_at)rm -f $@ $@-t
202         $(AM_V_at)test -d lib/Automake || $(MKDIR_P) lib/Automake
203         $(AM_V_GEN)in=Config.in \
204           && $(do_subst) <$(srcdir)/lib/Automake/Config.in >$@-t
205         $(generated_file_finalize)
206 EXTRA_DIST += lib/Automake/Config.in
207
208
209 ## --------------------- ##
210 ##  Makefile fragments.  ##
211 ## --------------------- ##
212
213 dist_am_DATA = \
214   lib/am/check.am \
215   lib/am/check2.am \
216   lib/am/clean-hdr.am \
217   lib/am/clean.am \
218   lib/am/compile.am \
219   lib/am/configure.am \
220   lib/am/data.am \
221   lib/am/dejagnu.am \
222   lib/am/depend.am \
223   lib/am/depend2.am \
224   lib/am/distdir.am \
225   lib/am/footer.am \
226   lib/am/header-vars.am \
227   lib/am/header.am \
228   lib/am/install.am \
229   lib/am/inst-vars.am \
230   lib/am/java.am \
231   lib/am/lang-compile.am \
232   lib/am/lex.am \
233   lib/am/library.am \
234   lib/am/libs.am \
235   lib/am/libtool.am \
236   lib/am/lisp.am \
237   lib/am/ltlib.am \
238   lib/am/ltlibrary.am \
239   lib/am/mans-vars.am \
240   lib/am/mans.am \
241   lib/am/program.am \
242   lib/am/progs.am \
243   lib/am/python.am \
244   lib/am/remake-hdr.am \
245   lib/am/scripts.am \
246   lib/am/subdirs.am \
247   lib/am/tags.am \
248   lib/am/texi-vers.am \
249   lib/am/texibuild.am \
250   lib/am/texinfos.am \
251   lib/am/vala.am \
252   lib/am/yacc.am
253
254
255 ## ------------------------------ ##
256 ##  Automake-provided m4 macros.  ##
257 ## ------------------------------ ##
258
259 dist_automake_ac_DATA = \
260   m4/amversion.m4 \
261   m4/ar-lib.m4 \
262   m4/as.m4 \
263   m4/auxdir.m4 \
264   m4/ccstdc.m4 \
265   m4/cond.m4 \
266   m4/cond-if.m4 \
267   m4/depend.m4 \
268   m4/depout.m4 \
269   m4/dmalloc.m4 \
270   m4/gcj.m4 \
271   m4/header.m4 \
272   m4/init.m4 \
273   m4/install-sh.m4 \
274   m4/lead-dot.m4 \
275   m4/lex.m4 \
276   m4/lispdir.m4 \
277   m4/maintainer.m4 \
278   m4/make.m4 \
279   m4/minuso.m4 \
280   m4/missing.m4 \
281   m4/mkdirp.m4 \
282   m4/obsol-gt.m4 \
283   m4/obsol-lt.m4 \
284   m4/obsolete.m4 \
285   m4/options.m4 \
286   m4/protos.m4 \
287   m4/python.m4 \
288   m4/runlog.m4 \
289   m4/sanity.m4 \
290   m4/silent.m4 \
291   m4/strip.m4 \
292   m4/substnot.m4 \
293   m4/tar.m4 \
294   m4/upc.m4 \
295   m4/vala.m4
296
297 dist_system_ac_DATA = m4/acdir/README
298
299 # We build amversion.m4 here, instead of from config.status,
300 # because config.status is rerun each time one of configure's
301 # dependencies change and amversion.m4 happens to be a configure
302 # dependency.  configure and amversion.m4 would be rebuilt in
303 # loop otherwise.
304 # Use '$(top_srcdir)/m4' for the benefit of non-GNU makes: this is
305 # how amversion.m4 appears in our dependencies.
306 $(top_srcdir)/m4/amversion.m4: $(srcdir)/configure.ac $(srcdir)/m4/amversion.in
307         $(AM_V_at)rm -f $@-t $@
308         $(AM_V_GEN)in=amversion.in \
309           && $(do_subst) <$(srcdir)/m4/amversion.in >$@-t
310         $(generated_file_finalize)
311 EXTRA_DIST += m4/amversion.in
312
313
314 ## ------------ ##
315 ##  Testsuite.  ##
316 ## ------------ ##
317
318 # Run the tests with a proper shell detected at configure time.
319 LOG_COMPILER = $(AM_TEST_RUNNER_SHELL)
320
321 TEST_EXTENSIONS = .pl .sh .tap
322 SH_LOG_COMPILER = $(LOG_COMPILER)
323 TAP_LOG_COMPILER = $(LOG_COMPILER)
324 PL_LOG_COMPILER = $(PERL)
325 AM_PL_LOG_FLAGS = -Mstrict -I $(builddir)/lib -I $(srcdir)/lib -w
326
327 TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) $(srcdir)/lib/tap-driver.sh
328
329 AM_TAP_LOG_DRIVER_FLAGS = --merge
330
331 EXTRA_DIST += t/README t/ax/is t/ax/is_newest
332
333 TESTS = ## Will be updated later.
334
335 # Some testsuite-influential variables should be overridable from the
336 # test scripts, but not from the environment.
337 AM_TESTS_ENVIRONMENT = \
338   for v in \
339     required \
340     am_test_protocol \
341     am_serial_tests \
342     am_test_prefer_config_shell \
343     am_original_AUTOMAKE \
344     am_original_ACLOCAL \
345     am_test_lib_sourced \
346     test_lib_sourced \
347   ; do \
348     eval test x"\$${$$v}" = x || unset $$v; \
349   done;
350 # We want warning messages and explanations for skipped tests to go to
351 # the console if possible, so set up 'stderr_fileno_' properly.
352 AM_TESTS_FD_REDIRECT = 9>&2
353 AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_;
354
355 # For sourcing of extra "shell libraries" by our test scripts.  As per
356 # POSIX, sourcing a file with '.' will cause it to be looked up in $PATH
357 # in case it is given with a relative name containing no slashes.
358 AM_TESTS_ENVIRONMENT += \
359   if test $(srcdir) != .; then \
360     PATH='$(abs_srcdir)/t/ax'$(PATH_SEPARATOR)$$PATH; \
361   fi; \
362   PATH='$(abs_builddir)/t/ax'$(PATH_SEPARATOR)$$PATH; \
363   export PATH;
364
365 # Hand-written tests.
366
367 include $(srcdir)/t/list-of-tests.mk
368
369 TESTS += $(handwritten_TESTS)
370 EXTRA_DIST += $(handwritten_TESTS)
371
372 # Automatically-generated tests wrapping hand-written ones.
373 # Also, automatically-computed dependencies for tests.
374
375 include $(srcdir)/t/testsuite-part.am
376
377 TESTS += $(generated_TESTS)
378 EXTRA_DIST += $(generated_TESTS)
379
380 $(srcdir)/t/testsuite-part.am:
381         $(AM_V_at)rm -f t/testsuite-part.tmp $@
382         $(AM_V_GEN)$(PERL) $(srcdir)/gen-testsuite-part \
383           --srcdir $(srcdir) > t/testsuite-part.tmp
384         $(AM_V_at)chmod a-w t/testsuite-part.tmp
385         $(AM_V_at)mv -f t/testsuite-part.tmp $@
386 EXTRA_DIST += gen-testsuite-part
387
388 ## The dependecies declared here are not truly complete, but such
389 ## completeness would cause more issues than it would solve.  See
390 ## automake bug#11347.
391 $(generated_TESTS): $(srcdir)/gen-testsuite-part
392 $(srcdir)/t/testsuite-part.am: $(srcdir)/gen-testsuite-part Makefile.am
393
394 # Static dependencies valid for each test case (also further
395 # extended later).  Note that use 'noinst_' rather than 'check_'
396 # as the prefix, because we really want them to be built by
397 # "make all".  This makes it easier to run the test cases by
398 # hand after having simply configured and built the package.
399
400 nodist_noinst_SCRIPTS = \
401   t/wrap/aclocal-$(APIVERSION) \
402   t/wrap/automake-$(APIVERSION)
403
404 dist_noinst_DATA = \
405   t/ax/test-lib.sh \
406   t/ax/am-test-lib.sh \
407   t/ax/tap-functions.sh
408
409 # Few more static dependencies.
410 t/distcheck-missing-m4.log: t/ax/distcheck-hook-m4.am
411 t/distcheck-outdated-m4.log: t/ax/distcheck-hook-m4.am
412 EXTRA_DIST += t/ax/distcheck-hook-m4.am
413
414 t/ax/test-defs.sh: t/ax/test-defs.in Makefile
415         $(AM_V_at)rm -f $@ $@-t
416         $(AM_V_GEN)in=t/ax/test-defs.in \
417           && $(do_subst) <$(srcdir)/$$in >$@-t
418         $(generated_file_finalize)
419 EXTRA_DIST += t/ax/test-defs.in
420 CLEANFILES += t/ax/test-defs.sh
421 nodist_noinst_DATA = t/ax/test-defs.sh
422
423 runtest: runtest.in Makefile
424         $(AM_V_at)rm -f $@ $@-t
425         $(AM_V_GEN)in=runtest.in \
426           && $(MKDIR_P) t/ax \
427           && $(do_subst) <$(srcdir)/runtest.in >$@-t \
428           && chmod a+x $@-t
429         $(generated_file_finalize)
430 EXTRA_DIST += runtest.in
431 CLEANFILES += runtest
432 noinst_SCRIPTS = runtest
433
434 # If two test scripts have the same basename, they will end up sharing
435 # the same log file, leading to all sort of undefined and undesired
436 # behaviours.
437 check-no-repeated-test-name:
438         @LC_ALL=C; export LC_ALL; \
439          lst='$(TEST_LOGS)'; for log in $$lst; do echo $$log; done \
440            | sort | uniq -c | awk '($$1 > 1) { print }' \
441            | sed 's/\.log$$//' | grep . >&2 \
442            && { \
443              echo $@: test names listed above are duplicated >&2; \
444              exit 1; \
445            }; :
446 check-local: check-no-repeated-test-name
447 .PHONY: check-no-repeated-test-name
448
449 # Check that our test cases are syntactically correct.
450 # See automake bug#11898.
451 check-tests-syntax:
452         @st=0; \
453         err () { echo "$@: $$*" >&2; st=1; }; \
454 ## The user might do something like "make check TESTS=t/foo" or
455 ## "make check TESTS_LOGS=t/foo.log" and expect (say) the test
456 ## 't/foo.sh' to be run; this has worked well until today, and
457 ## we want to continue supporting this use case.
458         bases=`for log in : $(TEST_LOGS); do echo $$log; done \
459           | sed -e '/^:$$/d' -e 's/\.log$$//'`; \
460         for bas in $$bases; do \
461           for suf in sh tap pl; do \
462             tst=$$bas.$$suf; \
463 ## Emulate VPATH search.
464             if test -f $$tst; then \
465               break; \
466             elif test -f $(srcdir)/$$tst; then \
467               tst=$(srcdir)/$$tst; \
468               break; \
469             else \
470               tst=''; \
471             fi; \
472           done; \
473           test -n "$$tst" || err "couldn't find test '$$bas'"; \
474 ## Don't check that perl tests are valid shell scripts!
475           test $$suf = pl && continue; \
476           $(AM_V_P) && echo " $(AM_TEST_RUNNER_SHELL) -n $$tst"; \
477           $(AM_TEST_RUNNER_SHELL) -n "$$tst" \
478             || err "test '$$tst' syntactically invalid"; \
479         done; \
480         exit $$st
481 check-local: check-tests-syntax
482 .PHONY: check-tests-syntax
483
484 ## Checking the list of tests.
485 test_subdirs = t t/pm
486 include $(srcdir)/t/CheckListOfTests.am
487
488 # Run the testsuite with the installed aclocal and automake.
489 installcheck-local: installcheck-testsuite
490 installcheck-testsuite:
491         am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
492
493 # Performance tests.
494 .PHONY: perf
495 perf: all
496         $(MAKE) $(AM_MAKEFLAGS) TEST_SUITE_LOG='$(PERF_TEST_SUITE_LOG)' \
497                                 TESTS='$(perf_TESTS)' check
498 PERF_TEST_SUITE_LOG = t/perf/test-suite.log
499 CLEANFILES += $(PERF_TEST_SUITE_LOG)
500 EXTRA_DIST += $(perf_TESTS)
501
502 clean-local: clean-local-check
503 .PHONY: clean-local-check
504 clean-local-check:
505         -set x t/*.dir; shift; \
506          if test "$$#,$$1" = "1,*.dir"; then \
507            : there is no test directory to clean; \
508          else \
509            find "$$@" -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
510            rm -rf "$$@"; \
511          fi;
512
513
514 ## ---------------- ##
515 ##  Documentation.  ##
516 ## ---------------- ##
517
518 info_TEXINFOS = doc/automake.texi doc/automake-history.texi
519 doc_automake_TEXINFOS = doc/fdl.texi
520 doc_automake_history_TEXINFOS = doc/fdl.texi
521
522 man1_MANS = \
523   doc/aclocal.1 \
524   doc/automake.1 \
525   doc/aclocal-$(APIVERSION).1 \
526   doc/automake-$(APIVERSION).1
527
528 $(man1_MANS): $(srcdir)/configure.ac
529
530 CLEANFILES += $(man1_MANS)
531 EXTRA_DIST += doc/help2man
532
533 update_mans = \
534   $(AM_V_GEN): \
535     && $(MKDIR_P) doc \
536     && PATH="$(abs_builddir)/t/wrap$(PATH_SEPARATOR)$$PATH" \
537     && export PATH \
538     && $(PERL) $(srcdir)/doc/help2man --output=$@
539
540 doc/aclocal.1 doc/automake.1:
541         $(AM_V_GEN): \
542           && $(MKDIR_P) doc \
543           && f=`echo $@ | sed 's|.*/||; s|\.1$$||; $(transform)'` \
544           && echo ".so man1/$$f-$(APIVERSION).1" > $@
545
546 doc/aclocal-$(APIVERSION).1: aclocal.in aclocal lib/Automake/Config.pm
547         $(update_mans) aclocal-$(APIVERSION)
548 doc/automake-$(APIVERSION).1: automake.in automake lib/Automake/Config.pm
549         $(update_mans) automake-$(APIVERSION)
550
551
552 ## ---------------------------- ##
553 ##  Example package "amhello".  ##
554 ## ---------------------------- ##
555
556 amhello_sources = \
557   doc/amhello/configure.ac \
558   doc/amhello/Makefile.am \
559   doc/amhello/README \
560   doc/amhello/src/main.c \
561   doc/amhello/src/Makefile.am
562
563 amhello_configury = \
564   aclocal.m4 \
565   autom4te.cache \
566   Makefile.in \
567   config.h.in \
568   configure \
569   depcomp \
570   install-sh \
571   missing \
572   src/Makefile.in
573
574 dist_noinst_DATA += $(amhello_sources)
575 dist_doc_DATA = $(srcdir)/doc/amhello-1.0.tar.gz
576
577 # We depend on configure.ac so that we regenerate the tarball
578 # whenever the Automake version changes.
579 # aclocal-$(APIVERSION) and automake-$(APIVERSION) are generated by
580 # configure in 't/wrap'.
581 $(srcdir)/doc/amhello-1.0.tar.gz: $(amhello_sources) $(srcdir)/configure.ac
582         $(AM_V_GEN): \
583           && PATH="$(abs_top_builddir)/t/wrap$(PATH_SEPARATOR)$$PATH" \
584           && export PATH \
585           && $(am__cd) $(srcdir)/doc/amhello \
586           && ACLOCAL=aclocal-$(APIVERSION) && export ACLOCAL \
587           && AUTOMAKE=automake-$(APIVERSION) && export AUTOMAKE \
588           && AUTOCONF='$(am_AUTOCONF)' && export AUTOCONF \
589           && AUTOM4TE='$(am_AUTOM4TE)' && export AUTOM4TE \
590           && AUTORECONF='$(am_AUTORECONF)' && export AUTORECONF \
591           && AUTOHEADER='$(am_AUTOHEADER)' && export AUTOHEADER \
592           && AUTOUPDATE='$(am_AUTOUPDATE)' && export AUTOUPDATE \
593           && $(am_AUTORECONF) -vfi \
594           && ./configure \
595           && $(MAKE) $(AM_MAKEFLAGS) distcheck \
596           && $(MAKE) $(AM_MAKEFLAGS) distclean \
597           && rm -rf $(amhello_configury) \
598           && mv -f amhello-1.0.tar.gz ..
599
600
601 ## ------------------------------------------------- ##
602 ##  Third-party, obsolescent or experimental stuff.  ##
603 ## ------------------------------------------------- ##
604
605 EXTRA_DIST += \
606   contrib/check-html.am \
607   contrib/multilib/README \
608   contrib/multilib/config-ml.in \
609   contrib/multilib/symlink-tree \
610   contrib/multilib/multilib.am \
611   contrib/multilib/multi.m4 \
612   contrib/README
613
614
615 ## --------------------------------------------------- ##
616 ##  Older files, kept mostly for historical interest.  ##
617 ## --------------------------------------------------- ##
618
619 EXTRA_DIST += \
620   old/ChangeLog-tests \
621   old/ChangeLog.96 \
622   old/ChangeLog.98 \
623   old/ChangeLog.00 \
624   old/ChangeLog.01 \
625   old/ChangeLog.02 \
626   old/ChangeLog.03 \
627   old/ChangeLog.04 \
628   old/ChangeLog.09 \
629   old/ChangeLog.11 \
630   old/TODO
631
632
633 ##########################################################################
634
635 ## Everything past here is useful to the maintainer, but probably not
636 ## to anybody else.
637
638 ##########################################################################
639
640
641 ## --------------------------------------------------------- ##
642 ##  Automatic generation of the ChangeLog from git history.  ##
643 ## --------------------------------------------------------- ##
644
645 gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
646 gitlog_to_changelog_fixes = $(srcdir)/.git-log-fix
647 gitlog_to_changelog_options = --amend=$(gitlog_to_changelog_fixes) \
648                               --since='2011-12-28 00:00:00' \
649                               --no-cluster --format '%s%n%n%b'
650
651 EXTRA_DIST += lib/gitlog-to-changelog
652 EXTRA_DIST += $(gitlog_to_changelog_fixes)
653
654 # When executed from a git checkout, generate the ChangeLog from the git
655 # history.  When executed from an extracted distribution tarball, just
656 # copy the distributed ChangeLog in the build directory (and if this
657 # fails, or if no distributed ChangeLog file is present, complain and
658 # give an error).
659 #
660 # We need the apparently useless dependency from another .PHONY target
661 # 'am--changelog-regen-hook' to work around a bug of Solaris make, which
662 # doesn't execute the recipe of a target named as an existing file, even
663 # if such target is declared '.PHONY' (yikes!)
664 #
665 .PHONY: am--changelog-regen-hook
666 am--changelog-regen-hook:
667 ChangeLog: am--changelog-regen-hook
668         $(AM_V_GEN)set -e; set -u; \
669 ## The ChangeLog should be regenerated unconditionally when working from
670 ## checked-out sources; otherwise, if we're working from a distribution
671 ## tarball, we expect the ChangeLog to be distributed, so check that it
672 ## is indeed present in the source directory.
673         if test -d $(srcdir)/.git; then \
674           rm -f $@-t \
675             && $(gitlog_to_changelog_command) \
676                $(gitlog_to_changelog_options) >$@-t \
677             && chmod a-w $@-t \
678             && mv -f $@-t $@ \
679             || exit 1; \
680         elif test ! -f $(srcdir)/$@; then \
681           echo "Source tree is not a git checkout, and no pre-existent" \
682                "$@ file has been found there" >&2; \
683           exit 1; \
684         fi
685
686
687 ## --------------------------- ##
688 ##  Perl coverage statistics.  ##
689 ## --------------------------- ##
690
691 PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
692 PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
693 PERL_COVER = cover
694
695 check-coverage-run recheck-coverage-run: all
696         $(mkinstalldirs) $(PERL_COVERAGE_DB)
697         PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
698         WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
699         $(MAKE) $(AM_MAKEFLAGS) `echo $@ | sed 's/-coverage-run//'`
700
701 check-coverage-report:
702         @if test ! -d "$(PERL_COVERAGE_DB)"; then \
703           echo "No coverage database found in '$(PERL_COVERAGE_DB)'." >&2; \
704           echo "Please run \"make check-coverage\" first" >&2; \
705           exit 1; \
706         fi
707         $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
708
709 # We don't use direct dependencies here because we'd like to be able
710 # to invoke the report even after interrupted check-coverage.
711 check-coverage: check-coverage-run
712         $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
713
714 recheck-coverage: recheck-coverage-run
715         $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
716
717 clean-coverage:
718         rm -rf "$(PERL_COVERAGE_DB)"
719 clean-local: clean-coverage
720
721 .PHONY: check-coverage recheck-coverage check-coverage-run \
722         recheck-coverage-run check-coverage-report clean-coverage
723
724
725 ## ---------------------------------------------------- ##
726 ##  Tagging and/or uploading stable and beta releases.  ##
727 ## ---------------------------------------------------- ##
728
729 GIT = git
730
731 EXTRA_DIST += lib/gnupload
732
733 version_rx = ^[1-9][0-9]*\.[0-9][0-9]*(\.[0-9][0-9]*)?
734 stable_version_rx = $(version_rx)$$
735 beta_version_rx = $(version_rx)[bdfhjlnprtvxz]$$
736 match_version = echo "$(VERSION)" | $(EGREP) >/dev/null
737
738 ## Check that we don't have uncommitted or unstaged changes.
739 ## TODO: Maybe the git suite already offers a shortcut to verify if the
740 ## TODO: working directory is "clean" or not?  If yes, use that instead
741 ## TODO: of duplicating the logic here.
742 git_must_have_clean_workdir = \
743   $(GIT) rev-parse --verify HEAD >/dev/null \
744     && $(GIT) update-index -q --refresh \
745     && $(GIT) diff-files --quiet \
746     && $(GIT) diff-index --quiet --cached HEAD \
747     || fatal "you have uncommitted or unstaged changes"
748
749 determine_release_type = \
750   if $(match_version) '$(stable_version_rx)'; then \
751     release_type='Release' dest=ftp; \
752   elif $(match_version) '$(beta_version_rx)'; then \
753     release_type='Beta release' dest=alpha; \
754   else \
755     fatal "invalid version '$(VERSION)' for a release"; \
756   fi
757
758 git-tag-release: maintainer-check
759         @set -e; set -u; \
760         fatal () { echo "$@: $$*; not tagging" >&2; exit 1; }; \
761         case '$(AM_TAG_DRYRUN)' in \
762           ""|[nN]|[nN]o|NO) run="";; \
763           *) run="echo Running:";; \
764         esac; \
765         $(determine_release_type); \
766         $(git_must_have_clean_workdir); \
767 ## If all was successful, tag the release in the local repository.
768         $$run $(GIT) tag -s "v$(VERSION)" -m "$$release_type $(VERSION)"
769
770 git-upload-release:
771         @set -e; set -u; \
772         fatal () { echo "$@: $$*; not releasing" >&2; exit 1; }; \
773         $(determine_release_type); \
774         dest=$$dest.gnu.org:automake; \
775         $(git_must_have_clean_workdir); \
776 ## Check that we are releasing from a valid tag.
777         tag=`$(GIT) describe` \
778           && case $$tag in "v$(VERSION)") true;; *) false;; esac \
779           || fatal "you can only create a release from a tagged version"; \
780 ## Build and upload the distribution tarball(s).
781         $(MAKE) $(AM_MAKEFLAGS) dist || exit 1; \
782         echo Will upload to $$dest: $(DIST_ARCHIVES); \
783         $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) --to $$dest $(DIST_ARCHIVES)
784
785 .PHONY: git-upload-release git-tag-release
786
787
788 ## ------------------------------------------------------------------ ##
789 ##  Explore differences of autogenerated files in different commits.  ##
790 ## ------------------------------------------------------------------ ##
791
792 ## Visually comparing differences between the Makefile.in files in
793 ## automake's own build system as generated in two different branches
794 ## might help to catch bugs and blunders.  This has already happened a
795 ## few times in the past, when we used to version-control Makefile.in.
796 autodiffs:
797         @set -u; \
798          NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
799          OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
800          am_gitdir='$(abs_top_srcdir)/.git'; \
801          get_autofiles_from_rev () \
802          { \
803              rev=$$1 dir=$$2 \
804                && echo "$@: will get files from revision $$rev" \
805                && $(GIT) clone -q --depth 1 "$$am_gitdir" tmp \
806                && $(am__cd) tmp \
807                && $(GIT) checkout -q "$$rev" \
808                && echo "$@: bootstrapping $$rev" \
809                && $(SHELL) ./bootstrap.sh \
810                && echo "$@: copying files from $$rev" \
811                && makefile_ins=`find . -name Makefile.in` \
812                && (tar cf - configure aclocal.m4 $$makefile_ins) | \
813                   (cd .. && $(am__cd) "$$dir" && tar xf -) \
814                && cd .. \
815                && rm -rf tmp; \
816          }; \
817          outdir=$@.dir \
818 ## Before proceeding, ensure the specified revisions truly exist.
819            && $(GIT) --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
820            && $(GIT) --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
821            && rm -rf $$outdir \
822            && mkdir $$outdir \
823            && $(am__cd) $$outdir \
824            && mkdir new old \
825            && get_autofiles_from_rev $$OLD_COMMIT old \
826            && get_autofiles_from_rev $$NEW_COMMIT new \
827            && exit 0
828
829 ## With lots of eye candy; we like our developers pampered and spoiled :-)
830 compare-autodiffs: autodiffs
831         @set -u; \
832         : $${COLORDIFF=colordiff} $${DIFF=diff}; \
833         dir=autodiffs.dir; \
834         if test ! -d "$$dir"; then \
835           echo "$@: $$dir: Not a directory" >&2; \
836           exit 1; \
837         fi; \
838         mydiff=false mypager=false; \
839         if test -t 1; then \
840           if ($$COLORDIFF -r . .) </dev/null >/dev/null 2>&1; then \
841             mydiff=$$COLORDIFF; \
842             mypager="less -R"; \
843           else \
844             mypager=less; \
845           fi; \
846         else \
847           mypager=cat; \
848         fi; \
849         if test "$$mydiff" = false; then \
850           if ($$DIFF -r -u . .); then \
851             mydiff=$$DIFF; \
852           else \
853             echo "$@: no good-enough diff program specified" >&2; \
854             exit 1; \
855           fi; \
856         fi; \
857         st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
858         rm -rf $$dir; \
859         exit $$st
860 .PHONY: autodiffs compare-autodiffs
861
862
863 ## --------------------------------------------------------------------- ##
864 ##  Synchronize third-party files that are committed in our repository.  ##
865 ## --------------------------------------------------------------------- ##
866
867 ## Program to use to fetch files.
868 WGET = wget
869 WGET_SV_CVS = $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/
870 WGET_SV_GIT_CF = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
871 WGET_SV_GIT_AC = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
872 WGET_SV_GIT_GL = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
873
874 ## Files that we fetch and which we compare against.
875 ## The 'lib/COPYING' file must still be synced by hand.
876 FETCHFILES = \
877 INSTALL \
878 config.guess \
879 config.sub \
880 gnupload \
881 gitlog-to-changelog \
882 texinfo.tex \
883 update-copyright
884
885 ## Fetch the latest versions of files we care about.
886 fetch:
887         rm -rf Fetchdir > /dev/null 2>&1
888         mkdir Fetchdir
889 ## If a get fails then that is a problem.
890         ($(am__cd) Fetchdir && \
891         $(WGET_SV_GIT_CF)config.guess -O config.guess && \
892         $(WGET_SV_GIT_CF)config.sub -O config.sub && \
893         $(WGET_SV_CVS)texinfo/texinfo/doc/texinfo.tex -O texinfo.tex && \
894         $(WGET_SV_GIT_GL)doc/INSTALL -O INSTALL && \
895         $(WGET_SV_GIT_GL)build-aux/gnupload -O gnupload && \
896         $(WGET_SV_GIT_GL)build-aux/update-copyright -O update-copyright && \
897         $(WGET_SV_GIT_GL)build-aux/gitlog-to-changelog -O gitlog-to-changelog)
898 ## Don't exit after test because we want to give as many errors as
899 ## possible.
900         @stat=0; for file in $(FETCHFILES); do \
901           if diff -u $(srcdir)/lib/$$file Fetchdir/$$file \
902                   >>Fetchdir/update.patch 2>/dev/null; then :; \
903           else \
904             stat=1; \
905             echo "Updating $(srcdir)/lib/$$file ..."; \
906             cp Fetchdir/$$file $(srcdir)/lib/$$file; \
907           fi; \
908         done; \
909         test $$stat = 0 || \
910           echo "See Fetchdir/update.patch for a log of the changes."; \
911         exit $$stat
912 .PHONY: fetch
913
914
915 ## ------------------------------------------------ ##
916 ##  Update copyright years of all committed files.  ##
917 ## ------------------------------------------------ ##
918
919 EXTRA_DIST += lib/update-copyright
920
921 update_copyright_env = \
922   UPDATE_COPYRIGHT_FORCE=1 \
923   UPDATE_COPYRIGHT_USE_INTERVALS=2
924
925 .PHONY: update-copyright
926 update-copyright:
927         $(AM_V_GEN)set -e; \
928         current_year=`date +%Y` && test -n "$$current_year" \
929           || { echo "$@: cannot get current year" >&2; exit 1; }; \
930         sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" \
931           bootstrap.sh configure.ac; \
932         excluded_re=`echo $(FETCHFILES) \
933           | sed -e 's|^|lib/|' -e 's| | lib/|g' -e 's, ,|,g'`; \
934         $(GIT) ls-files \
935           | grep -Ev '^(lib/)?(COPYING|INSTALL)$$' \
936           | grep -Ev "^($$excluded_re)$$" \
937           | $(update_copyright_env) xargs $(srcdir)/lib/$@