build: auxiliary testsuite files/scripts built by "make all"
[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_using_tap \
341     am_serial_tests \
342     am_test_prefer_config_shell \
343     am_original_AUTOMAKE \
344     am_original_ACLOCAL \
345   ; do \
346     eval test x"\$${$$v}" = x || unset $$v; \
347   done;
348 # We want warning messages and explanations for skipped tests to go to
349 # the console if possible, so set up 'stderr_fileno_' properly.
350 AM_TESTS_FD_REDIRECT = 9>&2
351 AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_;
352
353 # Hand-written tests.
354
355 include $(srcdir)/t/list-of-tests.mk
356
357 TESTS += $(handwritten_TESTS)
358 EXTRA_DIST += $(handwritten_TESTS)
359
360 # Automatically-generated tests wrapping hand-written ones.
361 # Also, automatically-computed dependencies for tests.
362
363 include $(srcdir)/t/testsuite-part.am
364
365 TESTS += $(generated_TESTS)
366 EXTRA_DIST += $(generated_TESTS)
367
368 $(srcdir)/t/testsuite-part.am:
369         $(AM_V_at)rm -f t/testsuite-part.tmp $@
370         $(AM_V_GEN)$(PERL) $(srcdir)/gen-testsuite-part \
371           --srcdir $(srcdir) > t/testsuite-part.tmp
372         $(AM_V_at)chmod a-w t/testsuite-part.tmp
373         $(AM_V_at)mv -f t/testsuite-part.tmp $@
374 EXTRA_DIST += gen-testsuite-part
375
376 ## The dependecies declared here are not truly complete, but such
377 ## completeness would cause more issues than it would solve.  See
378 ## automake bug#11347.
379 $(generated_TESTS): $(srcdir)/gen-testsuite-part
380 $(srcdir)/t/testsuite-part.am: $(srcdir)/gen-testsuite-part Makefile.am
381
382 # Static dependencies valid for each test case (also further
383 # extended later).  Note that use 'noinst_' rather than 'check_'
384 # as the prefix, because we really want them to be built by
385 # "make all".  This makes it easier to run the test cases by
386 # hand after having simply configured and built the package.
387
388 nodist_noinst_SCRIPTS = \
389   t/wrap/aclocal-$(APIVERSION) \
390   t/wrap/automake-$(APIVERSION)
391 dist_noinst_DATA = \
392   t/ax/test-init.sh \
393   t/ax/plain-functions.sh \
394   t/ax/tap-functions.sh
395
396 # Few more static dependencies.
397 t/distcheck-missing-m4.log: t/ax/distcheck-hook-m4.am
398 t/distcheck-outdated-m4.log: t/ax/distcheck-hook-m4.am
399 EXTRA_DIST += t/ax/distcheck-hook-m4.am
400
401 defs-static: defs-static.in Makefile
402         $(AM_V_at)rm -f $@ $@-t
403         $(AM_V_GEN)in=defs-static.in\
404           && $(do_subst) <$(srcdir)/defs-static.in >$@-t
405         $(generated_file_finalize)
406 EXTRA_DIST += defs-static.in
407 CLEANFILES += defs-static
408 nodist_noinst_DATA = defs-static
409
410 runtest: runtest.in Makefile
411         $(AM_V_at)rm -f $@ $@-t
412         $(AM_V_GEN)in=runtest.in \
413           && $(MKDIR_P) t/ax \
414           && $(do_subst) <$(srcdir)/runtest.in >$@-t \
415           && chmod a+x $@-t
416         $(generated_file_finalize)
417 EXTRA_DIST += runtest.in
418 CLEANFILES += runtest
419 noinst_SCRIPTS = runtest
420
421 # If two test scripts have the same basename, they will end up sharing
422 # the same log file, leading to all sort of undefined and undesired
423 # behaviours.
424 check-no-repeated-test-name:
425         @LC_ALL=C; export LC_ALL; \
426          lst='$(TEST_LOGS)'; for log in $$lst; do echo $$log; done \
427            | sort | uniq -c | awk '($$1 > 1) { print }' \
428            | sed 's/\.log$$//' | grep . >&2 \
429            && { \
430              echo $@: test names listed above are duplicated >&2; \
431              exit 1; \
432            }; :
433 check-local: check-no-repeated-test-name
434 .PHONY: check-no-repeated-test-name
435
436 # Check that our test cases are syntactically correct.
437 # See automake bug#11898.
438 check-tests-syntax:
439         @st=0; \
440         err () { echo "$@: $$*" >&2; st=1; }; \
441 ## The user might do something like "make check TESTS=t/foo" or
442 ## "make check TESTS_LOGS=t/foo.log" and expect (say) the test
443 ## 't/foo.sh' to be run; this has worked well until today, and
444 ## we want to continue supporting this use case.
445         bases=`for log in : $(TEST_LOGS); do echo $$log; done \
446           | sed -e '/^:$$/d' -e 's/\.log$$//'`; \
447         for bas in $$bases; do \
448           for suf in sh tap pl; do \
449             tst=$$bas.$$suf; \
450 ## Emulate VPATH search.
451             if test -f $$tst; then \
452               break; \
453             elif test -f $(srcdir)/$$tst; then \
454               tst=$(srcdir)/$$tst; \
455               break; \
456             else \
457               tst=''; \
458             fi; \
459           done; \
460           test -n "$$tst" || err "couldn't find test '$$bas'"; \
461 ## Don't check that perl tests are valid shell scripts!
462           test $$suf = pl && continue; \
463           $(AM_V_P) && echo " $(AM_TEST_RUNNER_SHELL) -n $$tst"; \
464           $(AM_TEST_RUNNER_SHELL) -n "$$tst" \
465             || err "test '$$tst' syntactically invalid"; \
466         done; \
467         exit $$st
468 check-local: check-tests-syntax
469 .PHONY: check-tests-syntax
470
471 ## Checking the list of tests.
472 test_subdirs = t t/pm
473 include $(srcdir)/t/CheckListOfTests.am
474
475 # Run the testsuite with the installed aclocal and automake.
476 installcheck-local: installcheck-testsuite
477 installcheck-testsuite:
478         am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
479
480 # Performance tests.
481 .PHONY: perf
482 perf: all
483         $(MAKE) $(AM_MAKEFLAGS) TEST_SUITE_LOG='$(PERF_TEST_SUITE_LOG)' \
484                                 TESTS='$(perf_TESTS)' check
485 PERF_TEST_SUITE_LOG = t/perf/test-suite.log
486 CLEANFILES += $(PERF_TEST_SUITE_LOG)
487 EXTRA_DIST += $(perf_TESTS)
488
489 clean-local: clean-local-check
490 .PHONY: clean-local-check
491 clean-local-check:
492         -set x t/*.dir; shift; \
493          if test "$$#,$$1" = "1,*.dir"; then \
494            : there is no test directory to clean; \
495          else \
496            find "$$@" -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
497            rm -rf "$$@"; \
498          fi;
499
500
501 ## ---------------- ##
502 ##  Documentation.  ##
503 ## ---------------- ##
504
505 info_TEXINFOS = doc/automake.texi doc/automake-history.texi
506 doc_automake_TEXINFOS = doc/fdl.texi
507 doc_automake_history_TEXINFOS = doc/fdl.texi
508
509 man1_MANS = \
510   doc/aclocal.1 \
511   doc/automake.1 \
512   doc/aclocal-$(APIVERSION).1 \
513   doc/automake-$(APIVERSION).1
514
515 $(man1_MANS): $(srcdir)/configure.ac
516
517 CLEANFILES += $(man1_MANS)
518 EXTRA_DIST += doc/help2man
519
520 update_mans = \
521   $(AM_V_GEN): \
522     && $(MKDIR_P) doc \
523     && PATH="$(abs_builddir)/t/wrap$(PATH_SEPARATOR)$$PATH" \
524     && export PATH \
525     && $(PERL) $(srcdir)/doc/help2man --output=$@
526
527 doc/aclocal.1 doc/automake.1:
528         $(AM_V_GEN): \
529           && $(MKDIR_P) doc \
530           && f=`echo $@ | sed 's|.*/||; s|\.1$$||; $(transform)'` \
531           && echo ".so man1/$$f-$(APIVERSION).1" > $@
532
533 doc/aclocal-$(APIVERSION).1: aclocal.in aclocal lib/Automake/Config.pm
534         $(update_mans) aclocal-$(APIVERSION)
535 doc/automake-$(APIVERSION).1: automake.in automake lib/Automake/Config.pm
536         $(update_mans) automake-$(APIVERSION)
537
538
539 ## ---------------------------- ##
540 ##  Example package "amhello".  ##
541 ## ---------------------------- ##
542
543 amhello_sources = \
544   doc/amhello/configure.ac \
545   doc/amhello/Makefile.am \
546   doc/amhello/README \
547   doc/amhello/src/main.c \
548   doc/amhello/src/Makefile.am
549
550 amhello_configury = \
551   aclocal.m4 \
552   autom4te.cache \
553   Makefile.in \
554   config.h.in \
555   configure \
556   depcomp \
557   install-sh \
558   missing \
559   src/Makefile.in
560
561 dist_noinst_DATA += $(amhello_sources)
562 dist_doc_DATA = $(srcdir)/doc/amhello-1.0.tar.gz
563
564 # We depend on configure.ac so that we regenerate the tarball
565 # whenever the Automake version changes.
566 # aclocal-$(APIVERSION) and automake-$(APIVERSION) are generated by
567 # configure in 't/wrap'.
568 $(srcdir)/doc/amhello-1.0.tar.gz: $(amhello_sources) $(srcdir)/configure.ac
569         $(AM_V_GEN): \
570           && PATH="$(abs_top_builddir)/t/wrap$(PATH_SEPARATOR)$$PATH" \
571           && export PATH \
572           && $(am__cd) $(srcdir)/doc/amhello \
573           && ACLOCAL=aclocal-$(APIVERSION) && export ACLOCAL \
574           && AUTOMAKE=automake-$(APIVERSION) && export AUTOMAKE \
575           && AUTOCONF='$(am_AUTOCONF)' && export AUTOCONF \
576           && AUTOM4TE='$(am_AUTOM4TE)' && export AUTOM4TE \
577           && AUTORECONF='$(am_AUTORECONF)' && export AUTORECONF \
578           && AUTOHEADER='$(am_AUTOHEADER)' && export AUTOHEADER \
579           && AUTOUPDATE='$(am_AUTOUPDATE)' && export AUTOUPDATE \
580           && $(am_AUTORECONF) -vfi \
581           && ./configure \
582           && $(MAKE) $(AM_MAKEFLAGS) distcheck \
583           && $(MAKE) $(AM_MAKEFLAGS) distclean \
584           && rm -rf $(amhello_configury) \
585           && mv -f amhello-1.0.tar.gz ..
586
587
588 ## ------------------------------------------------- ##
589 ##  Third-party, obsolescent or experimental stuff.  ##
590 ## ------------------------------------------------- ##
591
592 EXTRA_DIST += \
593   contrib/check-html.am \
594   contrib/multilib/README \
595   contrib/multilib/config-ml.in \
596   contrib/multilib/symlink-tree \
597   contrib/multilib/multilib.am \
598   contrib/multilib/multi.m4 \
599   contrib/README
600
601
602 ## --------------------------------------------------- ##
603 ##  Older files, kept mostly for historical interest.  ##
604 ## --------------------------------------------------- ##
605
606 EXTRA_DIST += \
607   old/ChangeLog-tests \
608   old/ChangeLog.96 \
609   old/ChangeLog.98 \
610   old/ChangeLog.00 \
611   old/ChangeLog.01 \
612   old/ChangeLog.02 \
613   old/ChangeLog.03 \
614   old/ChangeLog.04 \
615   old/ChangeLog.09 \
616   old/ChangeLog.11 \
617   old/TODO
618
619
620 ##########################################################################
621
622 ## Everything past here is useful to the maintainer, but probably not
623 ## to anybody else.
624
625 ##########################################################################
626
627
628 ## --------------------------------------------------------- ##
629 ##  Automatic generation of the ChangeLog from git history.  ##
630 ## --------------------------------------------------------- ##
631
632 gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
633 gitlog_to_changelog_fixes = $(srcdir)/.git-log-fix
634 gitlog_to_changelog_options = --amend=$(gitlog_to_changelog_fixes) \
635                               --since='2011-12-28 00:00:00' \
636                               --no-cluster --format '%s%n%n%b'
637
638 EXTRA_DIST += lib/gitlog-to-changelog
639 EXTRA_DIST += $(gitlog_to_changelog_fixes)
640
641 # When executed from a git checkout, generate the ChangeLog from the git
642 # history.  When executed from an extracted distribution tarball, just
643 # copy the distributed ChangeLog in the build directory (and if this
644 # fails, or if no distributed ChangeLog file is present, complain and
645 # give an error).
646 #
647 # We need the apparently useless dependency from another .PHONY target
648 # 'am--changelog-regen-hook' to work around a bug of Solaris make, which
649 # doesn't execute the recipe of a target named as an existing file, even
650 # if such target is declared '.PHONY' (yikes!)
651 #
652 .PHONY: am--changelog-regen-hook
653 am--changelog-regen-hook:
654 ChangeLog: am--changelog-regen-hook
655         $(AM_V_GEN)set -e; set -u; \
656 ## The ChangeLog should be regenerated unconditionally when working from
657 ## checked-out sources; otherwise, if we're working from a distribution
658 ## tarball, we expect the ChangeLog to be distributed, so check that it
659 ## is indeed present in the source directory.
660         if test -d $(srcdir)/.git; then \
661           rm -f $@-t \
662             && $(gitlog_to_changelog_command) \
663                $(gitlog_to_changelog_options) >$@-t \
664             && chmod a-w $@-t \
665             && mv -f $@-t $@ \
666             || exit 1; \
667         elif test ! -f $(srcdir)/$@; then \
668           echo "Source tree is not a git checkout, and no pre-existent" \
669                "$@ file has been found there" >&2; \
670           exit 1; \
671         fi
672
673
674 ## --------------------------- ##
675 ##  Perl coverage statistics.  ##
676 ## --------------------------- ##
677
678 PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
679 PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
680 PERL_COVER = cover
681
682 check-coverage-run recheck-coverage-run: all
683         $(mkinstalldirs) $(PERL_COVERAGE_DB)
684         PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
685         WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
686         $(MAKE) $(AM_MAKEFLAGS) `echo $@ | sed 's/-coverage-run//'`
687
688 check-coverage-report:
689         @if test ! -d "$(PERL_COVERAGE_DB)"; then \
690           echo "No coverage database found in '$(PERL_COVERAGE_DB)'." >&2; \
691           echo "Please run \"make check-coverage\" first" >&2; \
692           exit 1; \
693         fi
694         $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
695
696 # We don't use direct dependencies here because we'd like to be able
697 # to invoke the report even after interrupted check-coverage.
698 check-coverage: check-coverage-run
699         $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
700
701 recheck-coverage: recheck-coverage-run
702         $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
703
704 clean-coverage:
705         rm -rf "$(PERL_COVERAGE_DB)"
706 clean-local: clean-coverage
707
708 .PHONY: check-coverage recheck-coverage check-coverage-run \
709         recheck-coverage-run check-coverage-report clean-coverage
710
711
712 ## ---------------------------------------------------- ##
713 ##  Tagging and/or uploading stable and beta releases.  ##
714 ## ---------------------------------------------------- ##
715
716 GIT = git
717
718 EXTRA_DIST += lib/gnupload
719
720 version_rx = ^[1-9][0-9]*\.[0-9][0-9]*(\.[0-9][0-9]*)?
721 stable_version_rx = $(version_rx)$$
722 beta_version_rx = $(version_rx)[bdfhjlnprtvxz]$$
723 match_version = echo "$(VERSION)" | $(EGREP) >/dev/null
724
725 ## Check that we don't have uncommitted or unstaged changes.
726 ## TODO: Maybe the git suite already offers a shortcut to verify if the
727 ## TODO: working directory is "clean" or not?  If yes, use that instead
728 ## TODO: of duplicating the logic here.
729 git_must_have_clean_workdir = \
730   $(GIT) rev-parse --verify HEAD >/dev/null \
731     && $(GIT) update-index -q --refresh \
732     && $(GIT) diff-files --quiet \
733     && $(GIT) diff-index --quiet --cached HEAD \
734     || fatal "you have uncommitted or unstaged changes"
735
736 determine_release_type = \
737   if $(match_version) '$(stable_version_rx)'; then \
738     release_type='Release' dest=ftp; \
739   elif $(match_version) '$(beta_version_rx)'; then \
740     release_type='Beta release' dest=alpha; \
741   else \
742     fatal "invalid version '$(VERSION)' for a release"; \
743   fi
744
745 git-tag-release: maintainer-check
746         @set -e; set -u; \
747         fatal () { echo "$@: $$*; not tagging" >&2; exit 1; }; \
748         case '$(AM_TAG_DRYRUN)' in \
749           ""|[nN]|[nN]o|NO) run="";; \
750           *) run="echo Running:";; \
751         esac; \
752         $(determine_release_type); \
753         $(git_must_have_clean_workdir); \
754 ## If all was successful, tag the release in the local repository.
755         $$run $(GIT) tag -s "v$(VERSION)" -m "$$release_type $(VERSION)"
756
757 git-upload-release:
758         @set -e; set -u; \
759         fatal () { echo "$@: $$*; not releasing" >&2; exit 1; }; \
760         $(determine_release_type); \
761         dest=$$dest.gnu.org:automake; \
762         $(git_must_have_clean_workdir); \
763 ## Check that we are releasing from a valid tag.
764         tag=`$(GIT) describe` \
765           && case $$tag in "v$(VERSION)") true;; *) false;; esac \
766           || fatal "you can only create a release from a tagged version"; \
767 ## Build and upload the distribution tarball(s).
768         $(MAKE) $(AM_MAKEFLAGS) dist || exit 1; \
769         echo Will upload to $$dest: $(DIST_ARCHIVES); \
770         $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) --to $$dest $(DIST_ARCHIVES)
771
772 .PHONY: git-upload-release git-tag-release
773
774
775 ## ------------------------------------------------------------------ ##
776 ##  Explore differences of autogenerated files in different commits.  ##
777 ## ------------------------------------------------------------------ ##
778
779 ## Visually comparing differences between the Makefile.in files in
780 ## automake's own build system as generated in two different branches
781 ## might help to catch bugs and blunders.  This has already happened a
782 ## few times in the past, when we used to version-control Makefile.in.
783 autodiffs:
784         @set -u; \
785          NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
786          OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
787          am_gitdir='$(abs_top_srcdir)/.git'; \
788          get_autofiles_from_rev () \
789          { \
790              rev=$$1 dir=$$2 \
791                && echo "$@: will get files from revision $$rev" \
792                && $(GIT) clone -q --depth 1 "$$am_gitdir" tmp \
793                && $(am__cd) tmp \
794                && $(GIT) checkout -q "$$rev" \
795                && echo "$@: bootstrapping $$rev" \
796                && $(SHELL) ./bootstrap.sh \
797                && echo "$@: copying files from $$rev" \
798                && makefile_ins=`find . -name Makefile.in` \
799                && (tar cf - configure aclocal.m4 $$makefile_ins) | \
800                   (cd .. && $(am__cd) "$$dir" && tar xf -) \
801                && cd .. \
802                && rm -rf tmp; \
803          }; \
804          outdir=$@.dir \
805 ## Before proceeding, ensure the specified revisions truly exist.
806            && $(GIT) --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
807            && $(GIT) --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
808            && rm -rf $$outdir \
809            && mkdir $$outdir \
810            && $(am__cd) $$outdir \
811            && mkdir new old \
812            && get_autofiles_from_rev $$OLD_COMMIT old \
813            && get_autofiles_from_rev $$NEW_COMMIT new \
814            && exit 0
815
816 ## With lots of eye candy; we like our developers pampered and spoiled :-)
817 compare-autodiffs: autodiffs
818         @set -u; \
819         : $${COLORDIFF=colordiff} $${DIFF=diff}; \
820         dir=autodiffs.dir; \
821         if test ! -d "$$dir"; then \
822           echo "$@: $$dir: Not a directory" >&2; \
823           exit 1; \
824         fi; \
825         mydiff=false mypager=false; \
826         if test -t 1; then \
827           if ($$COLORDIFF -r . .) </dev/null >/dev/null 2>&1; then \
828             mydiff=$$COLORDIFF; \
829             mypager="less -R"; \
830           else \
831             mypager=less; \
832           fi; \
833         else \
834           mypager=cat; \
835         fi; \
836         if test "$$mydiff" = false; then \
837           if ($$DIFF -r -u . .); then \
838             mydiff=$$DIFF; \
839           else \
840             echo "$@: no good-enough diff program specified" >&2; \
841             exit 1; \
842           fi; \
843         fi; \
844         st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
845         rm -rf $$dir; \
846         exit $$st
847 .PHONY: autodiffs compare-autodiffs
848
849
850 ## --------------------------------------------------------------------- ##
851 ##  Synchronize third-party files that are committed in our repository.  ##
852 ## --------------------------------------------------------------------- ##
853
854 ## Program to use to fetch files.
855 WGET = wget
856 WGET_SV_CVS = $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/
857 WGET_SV_GIT_CF = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
858 WGET_SV_GIT_AC = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
859 WGET_SV_GIT_GL = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
860
861 ## Files that we fetch and which we compare against.
862 ## The 'lib/COPYING' file must still be synced by hand.
863 FETCHFILES = \
864 INSTALL \
865 config.guess \
866 config.sub \
867 gnupload \
868 gitlog-to-changelog \
869 texinfo.tex \
870 update-copyright
871
872 ## Fetch the latest versions of files we care about.
873 fetch:
874         rm -rf Fetchdir > /dev/null 2>&1
875         mkdir Fetchdir
876 ## If a get fails then that is a problem.
877         ($(am__cd) Fetchdir && \
878         $(WGET_SV_GIT_CF)config.guess -O config.guess && \
879         $(WGET_SV_GIT_CF)config.sub -O config.sub && \
880         $(WGET_SV_CVS)texinfo/texinfo/doc/texinfo.tex -O texinfo.tex && \
881         $(WGET_SV_GIT_GL)doc/INSTALL -O INSTALL && \
882         $(WGET_SV_GIT_GL)build-aux/gnupload -O gnupload && \
883         $(WGET_SV_GIT_GL)build-aux/update-copyright -O update-copyright && \
884         $(WGET_SV_GIT_GL)build-aux/gitlog-to-changelog -O gitlog-to-changelog)
885 ## Don't exit after test because we want to give as many errors as
886 ## possible.
887         @stat=0; for file in $(FETCHFILES); do \
888           if diff -u $(srcdir)/lib/$$file Fetchdir/$$file \
889                   >>Fetchdir/update.patch 2>/dev/null; then :; \
890           else \
891             stat=1; \
892             echo "Updating $(srcdir)/lib/$$file ..."; \
893             cp Fetchdir/$$file $(srcdir)/lib/$$file; \
894           fi; \
895         done; \
896         test $$stat = 0 || \
897           echo "See Fetchdir/update.patch for a log of the changes."; \
898         exit $$stat
899 .PHONY: fetch
900
901
902 ## ------------------------------------------------ ##
903 ##  Update copyright years of all committed files.  ##
904 ## ------------------------------------------------ ##
905
906 EXTRA_DIST += lib/update-copyright
907
908 update_copyright_env = \
909   UPDATE_COPYRIGHT_FORCE=1 \
910   UPDATE_COPYRIGHT_USE_INTERVALS=2
911
912 .PHONY: update-copyright
913 update-copyright:
914         $(AM_V_GEN)set -e; \
915         current_year=`date +%Y` && test -n "$$current_year" \
916           || { echo "$@: cannot get current year" >&2; exit 1; }; \
917         sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" \
918           bootstrap.sh configure.ac; \
919         excluded_re=`echo $(FETCHFILES) \
920           | sed -e 's|^|lib/|' -e 's| | lib/|g' -e 's, ,|,g'`; \
921         $(GIT) ls-files \
922           | grep -Ev '^(lib/)?(COPYING|INSTALL)$$' \
923           | grep -Ev "^($$excluded_re)$$" \
924           | $(update_copyright_env) xargs $(srcdir)/lib/$@