maintcheck: fix spurious failure in 'maintainer-check-list-of-tests'
[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/cond.m4 \
265   m4/cond-if.m4 \
266   m4/depend.m4 \
267   m4/depout.m4 \
268   m4/dmalloc.m4 \
269   m4/extra-recurs.m4 \
270   m4/gcj.m4 \
271   m4/init.m4 \
272   m4/install-sh.m4 \
273   m4/lead-dot.m4 \
274   m4/lex.m4 \
275   m4/lispdir.m4 \
276   m4/maintainer.m4 \
277   m4/make.m4 \
278   m4/minuso.m4 \
279   m4/missing.m4 \
280   m4/options.m4 \
281   m4/protos.m4 \
282   m4/python.m4 \
283   m4/runlog.m4 \
284   m4/sanity.m4 \
285   m4/silent.m4 \
286   m4/strip.m4 \
287   m4/substnot.m4 \
288   m4/tar.m4 \
289   m4/upc.m4 \
290   m4/vala.m4
291
292 dist_system_ac_DATA = m4/acdir/README
293
294 # We build amversion.m4 here, instead of from config.status,
295 # because config.status is rerun each time one of configure's
296 # dependencies change and amversion.m4 happens to be a configure
297 # dependency.  configure and amversion.m4 would be rebuilt in
298 # loop otherwise.
299 # Use '$(top_srcdir)/m4' for the benefit of non-GNU makes: this is
300 # how amversion.m4 appears in our dependencies.
301 $(top_srcdir)/m4/amversion.m4: $(srcdir)/configure.ac $(srcdir)/m4/amversion.in
302         $(AM_V_at)rm -f $@-t $@
303         $(AM_V_GEN)in=amversion.in \
304           && $(do_subst) <$(srcdir)/m4/amversion.in >$@-t
305         $(generated_file_finalize)
306 EXTRA_DIST += m4/amversion.in
307
308
309 ## ------------ ##
310 ##  Testsuite.  ##
311 ## ------------ ##
312
313 # Run the tests with a proper shell detected at configure time.
314 LOG_COMPILER = $(AM_TEST_RUNNER_SHELL)
315
316 TEST_EXTENSIONS = .pl .sh .tap
317 SH_LOG_COMPILER = $(LOG_COMPILER)
318 TAP_LOG_COMPILER = $(LOG_COMPILER)
319 PL_LOG_COMPILER = $(PERL)
320 AM_PL_LOG_FLAGS = -Mstrict -I $(builddir)/lib -I $(srcdir)/lib -w
321
322 TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) $(srcdir)/lib/tap-driver.sh
323
324 AM_TAP_LOG_DRIVER_FLAGS = --merge
325
326 EXTRA_DIST += t/README t/ax/is t/ax/is_newest
327
328 TESTS = ## Will be updated later.
329
330 # Some testsuite-influential variables should be overridable from the
331 # test scripts, but not from the environment.
332 AM_TESTS_ENVIRONMENT = \
333   for v in \
334     required \
335     am_using_tap \
336     am_serial_tests \
337     am_test_prefer_config_shell \
338     am_original_AUTOMAKE \
339     am_original_ACLOCAL \
340   ; do \
341     eval test x"\$${$$v}" = x || unset $$v; \
342   done;
343 # The 'AM_TESTS_REEXEC=no' setting tells the tests not to needlessly
344 # re-execute themselves with the shell detected at configure time, since
345 # we are already running them under it explicitly in our setup (see e.g.
346 # the definition of TEST_LOG_COMPILER above).
347 AM_TESTS_ENVIRONMENT += AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC;
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 # Hand-written tests for stuff in 'contrib/'.
383 include $(srcdir)/contrib/t/local.am
384 TESTS += $(contrib_TESTS)
385 EXTRA_DIST += $(contrib_TESTS)
386
387 # Static dependencies valid for each test case.
388 check_SCRIPTS = t/wrap/aclocal-$(APIVERSION) t/wrap/automake-$(APIVERSION)
389 dist_check_DATA = \
390   t/ax/test-init.sh  \
391   t/ax/plain-functions.sh  \
392   t/ax/tap-functions.sh
393 nodist_check_DATA = defs-static
394
395 # Few more static dependencies.
396 t/distcheck-missing-m4.log: t/ax/distcheck-hook-m4.am
397 t/distcheck-outdated-m4.log: t/ax/distcheck-hook-m4.am
398 EXTRA_DIST += t/ax/distcheck-hook-m4.am
399
400 defs-static: defs-static.in Makefile
401         $(AM_V_at)rm -f $@ $@-t
402         $(AM_V_GEN)in=defs-static.in\
403           && $(do_subst) <$(srcdir)/defs-static.in >$@-t
404         $(generated_file_finalize)
405 EXTRA_DIST += defs-static.in
406 CLEANFILES += defs-static
407
408 # If two test scripts have the same basename, they will end up sharing
409 # the same log file, leading to all sort of undefined and undesired
410 # behaviours.
411 check-no-repeated-test-name:
412         @LC_ALL=C; export LC_ALL; \
413          lst='$(TEST_LOGS)'; for log in $$lst; do echo $$log; done \
414            | sort | uniq -c | awk '($$1 > 1) { print }' \
415            | sed 's/\.log$$//' | grep . >&2 \
416            && { \
417              echo $@: test names listed above are duplicated >&2; \
418              exit 1; \
419            }; :
420 check-local: check-no-repeated-test-name
421 .PHONY: check-no-repeated-test-name
422
423 ## Checking the list of tests.
424 test_subdirs = t t/pm t/perf contrib/t
425 include $(srcdir)/t/CheckListOfTests.am
426
427 # Run the testsuite with the installed aclocal and automake.
428 installcheck-local: installcheck-testsuite
429 installcheck-testsuite:
430         am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
431
432 clean-local: clean-local-check
433 .PHONY: clean-local-check
434 clean-local-check:
435 ## Directries candidate to be test directories match this wildcard.
436         @globs='t/*.dir t/*/*.dir */t/*.dir */t/*/*.dir'; \
437 ## The 'nullglob' bash option is not portable, so use perl.
438         dirs=`$(PERL) -e "print join(' ', glob('$$globs'));"` || exit 1; \
439         if test -n "$$dirs"; then \
440 ## Errors in find are acceptable, errors in rm are not.
441             find $$dirs -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
442             echo " rm -rf $$dirs"; \
443             rm -rf $$dirs || exit 1; \
444         fi
445
446
447 ## ---------------- ##
448 ##  Documentation.  ##
449 ## ---------------- ##
450
451 info_TEXINFOS = doc/automake.texi doc/automake-history.texi
452 doc_automake_TEXINFOS = doc/fdl.texi
453 doc_automake_history_TEXINFOS = doc/fdl.texi
454
455 man1_MANS = \
456   doc/aclocal.1 \
457   doc/automake.1 \
458   doc/aclocal-$(APIVERSION).1 \
459   doc/automake-$(APIVERSION).1
460
461 $(man1_MANS): $(srcdir)/configure.ac
462
463 CLEANFILES += $(man1_MANS)
464 EXTRA_DIST += doc/help2man
465
466 update_mans = \
467   $(AM_V_GEN): \
468     && $(MKDIR_P) doc \
469     && PATH="$(abs_builddir)/t/wrap$(PATH_SEPARATOR)$$PATH" \
470     && export PATH \
471     && $(PERL) $(srcdir)/doc/help2man --output=$@
472
473 doc/aclocal.1 doc/automake.1:
474         $(AM_V_GEN): \
475           && $(MKDIR_P) doc \
476           && f=`echo $@ | sed 's|.*/||; s|\.1$$||; $(transform)'` \
477           && echo ".so man1/$$f-$(APIVERSION).1" > $@
478
479 doc/aclocal-$(APIVERSION).1: aclocal.in aclocal lib/Automake/Config.pm
480         $(update_mans) aclocal-$(APIVERSION)
481 doc/automake-$(APIVERSION).1: automake.in automake lib/Automake/Config.pm
482         $(update_mans) automake-$(APIVERSION)
483
484
485 ## ---------------------------- ##
486 ##  Example package "amhello".  ##
487 ## ---------------------------- ##
488
489 amhello_sources = \
490   doc/amhello/configure.ac \
491   doc/amhello/Makefile.am \
492   doc/amhello/README \
493   doc/amhello/src/main.c \
494   doc/amhello/src/Makefile.am
495
496 amhello_configury = \
497   aclocal.m4 \
498   autom4te.cache \
499   Makefile.in \
500   config.h.in \
501   configure \
502   depcomp \
503   install-sh \
504   missing \
505   src/Makefile.in
506
507 dist_noinst_DATA = $(amhello_sources)
508 dist_doc_DATA = $(srcdir)/doc/amhello-1.0.tar.gz
509
510 # We depend on configure.ac so that we regenerate the tarball
511 # whenever the Automake version changes.
512 # aclocal-$(APIVERSION) and automake-$(APIVERSION) are generated by
513 # configure in 't/wrap'.
514 $(srcdir)/doc/amhello-1.0.tar.gz: $(amhello_sources) $(srcdir)/configure.ac
515         $(AM_V_GEN): \
516           && PATH="$(abs_top_builddir)/t/wrap$(PATH_SEPARATOR)$$PATH" \
517           && export PATH \
518           && $(am__cd) $(srcdir)/doc/amhello \
519           && ACLOCAL=aclocal-$(APIVERSION) && export ACLOCAL \
520           && AUTOMAKE=automake-$(APIVERSION) && export AUTOMAKE \
521           && AUTOCONF='$(am_AUTOCONF)' && export AUTOCONF \
522           && AUTOM4TE='$(am_AUTOM4TE)' && export AUTOM4TE \
523           && AUTORECONF='$(am_AUTORECONF)' && export AUTORECONF \
524           && AUTOHEADER='$(am_AUTOHEADER)' && export AUTOHEADER \
525           && AUTOUPDATE='$(am_AUTOUPDATE)' && export AUTOUPDATE \
526           && $(am_AUTORECONF) -vfi \
527           && ./configure \
528           && $(MAKE) $(AM_MAKEFLAGS) distcheck \
529           && $(MAKE) $(AM_MAKEFLAGS) distclean \
530           && rm -rf $(amhello_configury) \
531           && mv -f amhello-1.0.tar.gz ..
532
533
534 ## ------------------------------------------------- ##
535 ##  Third-party, obsolescent or experimental stuff.  ##
536 ## ------------------------------------------------- ##
537
538 EXTRA_DIST += \
539   contrib/check-html.am \
540   contrib/multilib/README \
541   contrib/multilib/config-ml.in \
542   contrib/multilib/symlink-tree \
543   contrib/multilib/multilib.am \
544   contrib/multilib/multi.m4 \
545   contrib/README
546
547
548 ## --------------------------------------------------- ##
549 ##  Older files, kept mostly for historical interest.  ##
550 ## --------------------------------------------------- ##
551
552 EXTRA_DIST += \
553   old/ChangeLog-tests \
554   old/ChangeLog.96 \
555   old/ChangeLog.98 \
556   old/ChangeLog.00 \
557   old/ChangeLog.01 \
558   old/ChangeLog.02 \
559   old/ChangeLog.03 \
560   old/ChangeLog.04 \
561   old/ChangeLog.09 \
562   old/ChangeLog.11 \
563   old/TODO
564
565
566 ##########################################################################
567
568 ## Everything past here is useful to the maintainer, but probably not
569 ## to anybody else.
570
571 ##########################################################################
572
573
574 ## --------------------------------------------------------- ##
575 ##  Automatic generation of the ChangeLog from git history.  ##
576 ## --------------------------------------------------------- ##
577
578 gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
579 gitlog_to_changelog_fixes = $(srcdir)/.git-log-fix
580 gitlog_to_changelog_options = --amend=$(gitlog_to_changelog_fixes) \
581                               --since='2011-12-28 00:00:00' \
582                               --no-cluster --format '%s%n%n%b'
583
584 EXTRA_DIST += lib/gitlog-to-changelog
585 EXTRA_DIST += $(gitlog_to_changelog_fixes)
586
587 # When executed from a git checkout, generate the ChangeLog from the git
588 # history.  When executed from an extracted distribution tarball, just
589 # copy the distributed ChangeLog in the build directory (and if this
590 # fails, or if no distributed ChangeLog file is present, complain and
591 # give an error).
592 #
593 # We need the apparently useless dependency from another .PHONY target
594 # 'am--changelog-regen-hook' to work around a bug of Solaris make, which
595 # doesn't execute the recipe of a target named as an existing file, even
596 # if such target is declared '.PHONY' (yikes!)
597 #
598 .PHONY: am--changelog-regen-hook
599 am--changelog-regen-hook:
600 ChangeLog: am--changelog-regen-hook
601         $(AM_V_GEN)set -e; set -u; \
602 ## The ChangeLog should be regenerated unconditionally when working from
603 ## checked-out sources; otherwise, if we're working from a distribution
604 ## tarball, we expect the ChangeLog to be distributed, so check that it
605 ## is indeed present in the source directory.
606         if test -d $(srcdir)/.git; then \
607           rm -f $@-t \
608             && $(gitlog_to_changelog_command) \
609                $(gitlog_to_changelog_options) >$@-t \
610             && chmod a-w $@-t \
611             && mv -f $@-t $@ \
612             || exit 1; \
613         elif test ! -f $(srcdir)/$@; then \
614           echo "Source tree is not a git checkout, and no pre-existent" \
615                "$@ file has been found there" >&2; \
616           exit 1; \
617         fi
618
619
620 ## --------------------------- ##
621 ##  Perl coverage statistics.  ##
622 ## --------------------------- ##
623
624 PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
625 PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
626 PERL_COVER = cover
627
628 check-coverage-run recheck-coverage-run: all
629         $(mkinstalldirs) $(PERL_COVERAGE_DB)
630         PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
631         WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
632         $(MAKE) $(AM_MAKEFLAGS) `echo $@ | sed 's/-coverage-run//'`
633
634 check-coverage-report:
635         @if test ! -d "$(PERL_COVERAGE_DB)"; then \
636           echo "No coverage database found in '$(PERL_COVERAGE_DB)'." >&2; \
637           echo "Please run \"make check-coverage\" first" >&2; \
638           exit 1; \
639         fi
640         $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
641
642 # We don't use direct dependencies here because we'd like to be able
643 # to invoke the report even after interrupted check-coverage.
644 check-coverage: check-coverage-run
645         $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
646
647 recheck-coverage: recheck-coverage-run
648         $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
649
650 clean-coverage:
651         rm -rf "$(PERL_COVERAGE_DB)"
652 clean-local: clean-coverage
653
654 .PHONY: check-coverage recheck-coverage check-coverage-run \
655         recheck-coverage-run check-coverage-report clean-coverage
656
657
658 ## ---------------------------------------------------- ##
659 ##  Tagging and/or uploading stable and beta releases.  ##
660 ## ---------------------------------------------------- ##
661
662 GIT = git
663
664 EXTRA_DIST += lib/gnupload
665
666 version_rx = ^[1-9][0-9]*\.[0-9][0-9]*(\.[0-9][0-9]*)?
667 stable_version_rx = $(version_rx)$$
668 beta_version_rx = $(version_rx)[bdfhjlnprtvxz]$$
669 match_version = echo "$(VERSION)" | $(EGREP) >/dev/null
670
671 ## Check that we don't have uncommitted or unstaged changes.
672 ## TODO: Maybe the git suite already offers a shortcut to verify if the
673 ## TODO: working directory is "clean" or not?  If yes, use that instead
674 ## TODO: of duplicating the logic here.
675 git_must_have_clean_workdir = \
676   $(GIT) rev-parse --verify HEAD >/dev/null \
677     && $(GIT) update-index -q --refresh \
678     && $(GIT) diff-files --quiet \
679     && $(GIT) diff-index --quiet --cached HEAD \
680     || fatal "you have uncommitted or unstaged changes"
681
682 determine_release_type = \
683   if $(match_version) '$(stable_version_rx)'; then \
684     release_type='Release' dest=ftp; \
685   elif $(match_version) '$(beta_version_rx)'; then \
686     release_type='Beta release' dest=alpha; \
687   else \
688     fatal "invalid version '$(VERSION)' for a release"; \
689   fi
690
691 git-tag-release: maintainer-check
692         @set -e; set -u; \
693         fatal () { echo "$@: $$*; not tagging" >&2; exit 1; }; \
694         case '$(AM_TAG_DRYRUN)' in \
695           ""|[nN]|[nN]o|NO) run="";; \
696           *) run="echo Running:";; \
697         esac; \
698         $(determine_release_type); \
699         $(git_must_have_clean_workdir); \
700 ## If all was successful, tag the release in the local repository.
701         $$run $(GIT) tag -s "v$(VERSION)" -m "$$release_type $(VERSION)"
702
703 git-upload-release:
704         @set -e; set -u; \
705         fatal () { echo "$@: $$*; not releasing" >&2; exit 1; }; \
706         $(determine_release_type); \
707         dest=$$dest.gnu.org:automake; \
708         $(git_must_have_clean_workdir); \
709 ## Check that we are releasing from a valid tag.
710         tag=`$(GIT) describe` \
711           && case $$tag in "v$(VERSION)") true;; *) false;; esac \
712           || fatal "you can only create a release from a tagged version"; \
713 ## Build and upload the distribution tarball(s).
714         $(MAKE) $(AM_MAKEFLAGS) dist || exit 1; \
715         echo Will upload to $$dest: $(DIST_ARCHIVES); \
716         $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) --to $$dest $(DIST_ARCHIVES)
717
718 .PHONY: git-upload-release git-tag-release
719
720
721 ## ------------------------------------------------------------------ ##
722 ##  Explore differences of autogenerated files in different commits.  ##
723 ## ------------------------------------------------------------------ ##
724
725 ## Visually comparing differences between the Makefile.in files in
726 ## automake's own build system as generated in two different branches
727 ## might help to catch bugs and blunders.  This has already happened a
728 ## few times in the past, when we used to version-control Makefile.in.
729 autodiffs:
730         @set -u; \
731          NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
732          OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
733          am_gitdir='$(abs_top_srcdir)/.git'; \
734          get_autofiles_from_rev () \
735          { \
736              rev=$$1 dir=$$2 \
737                && echo "$@: will get files from revision $$rev" \
738                && $(GIT) clone -q --depth 1 "$$am_gitdir" tmp \
739                && $(am__cd) tmp \
740                && $(GIT) checkout -q "$$rev" \
741                && echo "$@: bootstrapping $$rev" \
742                && $(SHELL) ./bootstrap.sh \
743                && echo "$@: copying files from $$rev" \
744                && makefile_ins=`find . -name Makefile.in` \
745                && (tar cf - configure aclocal.m4 $$makefile_ins) | \
746                   (cd .. && $(am__cd) "$$dir" && tar xf -) \
747                && cd .. \
748                && rm -rf tmp; \
749          }; \
750          outdir=$@.dir \
751 ## Before proceeding, ensure the specified revisions truly exist.
752            && $(GIT) --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
753            && $(GIT) --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
754            && rm -rf $$outdir \
755            && mkdir $$outdir \
756            && $(am__cd) $$outdir \
757            && mkdir new old \
758            && get_autofiles_from_rev $$OLD_COMMIT old \
759            && get_autofiles_from_rev $$NEW_COMMIT new \
760            && exit 0
761
762 ## With lots of eye candy; we like our developers pampered and spoiled :-)
763 compare-autodiffs: autodiffs
764         @set -u; \
765         : $${COLORDIFF=colordiff} $${DIFF=diff}; \
766         dir=autodiffs.dir; \
767         if test ! -d "$$dir"; then \
768           echo "$@: $$dir: Not a directory" >&2; \
769           exit 1; \
770         fi; \
771         mydiff=false mypager=false; \
772         if test -t 1; then \
773           if ($$COLORDIFF -r . .) </dev/null >/dev/null 2>&1; then \
774             mydiff=$$COLORDIFF; \
775             mypager="less -R"; \
776           else \
777             mypager=less; \
778           fi; \
779         else \
780           mypager=cat; \
781         fi; \
782         if test "$$mydiff" = false; then \
783           if ($$DIFF -r -u . .); then \
784             mydiff=$$DIFF; \
785           else \
786             echo "$@: no good-enough diff program specified" >&2; \
787             exit 1; \
788           fi; \
789         fi; \
790         st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
791         rm -rf $$dir; \
792         exit $$st
793 .PHONY: autodiffs compare-autodiffs
794
795
796 ## --------------------------------------------------------------------- ##
797 ##  Synchronize third-party files that are committed in our repository.  ##
798 ## --------------------------------------------------------------------- ##
799
800 ## Program to use to fetch files.
801 WGET = wget
802 WGET_SV_CVS = $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/
803 WGET_SV_GIT_CF = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
804 WGET_SV_GIT_AC = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
805 WGET_SV_GIT_GL = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
806
807 ## Files that we fetch and which we compare against.
808 ## The 'lib/COPYING' file must still be synced by hand.
809 FETCHFILES = \
810 INSTALL \
811 config.guess \
812 config.sub \
813 gnupload \
814 gitlog-to-changelog \
815 texinfo.tex \
816 update-copyright
817
818 ## Fetch the latest versions of files we care about.
819 fetch:
820         rm -rf Fetchdir > /dev/null 2>&1
821         mkdir Fetchdir
822 ## If a get fails then that is a problem.
823         ($(am__cd) Fetchdir && \
824         $(WGET_SV_GIT_CF)config.guess -O config.guess && \
825         $(WGET_SV_GIT_CF)config.sub -O config.sub && \
826         $(WGET_SV_CVS)texinfo/texinfo/doc/texinfo.tex -O texinfo.tex && \
827         $(WGET_SV_GIT_GL)doc/INSTALL -O INSTALL && \
828         $(WGET_SV_GIT_GL)build-aux/gnupload -O gnupload && \
829         $(WGET_SV_GIT_GL)build-aux/update-copyright -O update-copyright && \
830         $(WGET_SV_GIT_GL)build-aux/gitlog-to-changelog -O gitlog-to-changelog)
831 ## Don't exit after test because we want to give as many errors as
832 ## possible.
833         @stat=0; for file in $(FETCHFILES); do \
834           if diff -u $(srcdir)/lib/$$file Fetchdir/$$file \
835                   >>Fetchdir/update.patch 2>/dev/null; then :; \
836           else \
837             stat=1; \
838             echo "Updating $(srcdir)/lib/$$file ..."; \
839             cp Fetchdir/$$file $(srcdir)/lib/$$file; \
840           fi; \
841         done; \
842         test $$stat = 0 || \
843           echo "See Fetchdir/update.patch for a log of the changes."; \
844         exit $$stat
845 .PHONY: fetch
846
847
848 ## ------------------------------------------------ ##
849 ##  Update copyright years of all committed files.  ##
850 ## ------------------------------------------------ ##
851
852 EXTRA_DIST += lib/update-copyright
853
854 update_copyright_env = \
855   UPDATE_COPYRIGHT_FORCE=1 \
856   UPDATE_COPYRIGHT_USE_INTERVALS=2
857
858 .PHONY: update-copyright
859 update-copyright:
860         $(AM_V_GEN)set -e; \
861         current_year=`date +%Y` && test -n "$$current_year" \
862           || { echo "$@: cannot get current year" >&2; exit 1; }; \
863         sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" \
864           bootstrap.sh configure.ac; \
865         excluded_re=`echo $(FETCHFILES) \
866           | sed -e 's|^|lib/|' -e 's| | lib/|g' -e 's, ,|,g'`; \
867         $(GIT) ls-files \
868           | grep -Ev '^(lib/)?(COPYING|INSTALL)$$' \
869           | grep -Ev "^($$excluded_re)$$" \
870           | $(update_copyright_env) xargs $(srcdir)/lib/$@