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