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