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