maint: remove most recursion in automake's own 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 ## '.' goes before tests, because this latter directory runs
21 ## aclocal and automake.
22 SUBDIRS = . tests
23
24 ## Might be updated later.
25 CLEANFILES =
26 DISTCLEANFILES =
27 MAINTAINERCLEANFILES =
28 EXTRA_DIST =
29
30 ## ------------ ##
31 ##  Top level.  ##
32 ## ------------ ##
33
34 bin_SCRIPTS = automake aclocal
35
36 CLEANFILES += $(bin_SCRIPTS)
37 AUTOMAKESOURCES = automake.in aclocal.in
38
39 TAGS_FILES = $(AUTOMAKESOURCES)
40
41 EXTRA_DIST += \
42   $(AUTOMAKESOURCES) \
43   bootstrap \
44   GNUmakefile \
45   syntax-checks.mk \
46   HACKING
47
48 ## Make versioned links.  We only run the transform on the root name;
49 ## then we make a versioned link with the transformed base name.  This
50 ## seemed like the most reasonable approach.
51 install-exec-hook:
52         @$(POST_INSTALL)
53         @for p in $(bin_SCRIPTS); do \
54           f="`echo $$p|sed '$(transform)'`"; \
55           fv="$$f-$(APIVERSION)"; \
56           rm -f "$(DESTDIR)$(bindir)/$$fv"; \
57           echo " $(LN) '$(DESTDIR)$(bindir)/$$f' '$(DESTDIR)$(bindir)/$$fv'"; \
58           $(LN) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$fv"; \
59         done
60
61 uninstall-hook:
62         @for p in $(bin_SCRIPTS); do \
63           f="`echo $$p|sed '$(transform)'`"; \
64           fv="$$f-$(APIVERSION)"; \
65           rm -f "$(DESTDIR)$(bindir)/$$fv"; \
66         done
67
68 ## We can't use configure to do the substitution here; we must do it
69 ## by hand.  We use a funny notation here to avoid configure
70 ## substitutions in our text.
71 do_subst = sed \
72   -e 's,[@]APIVERSION[@],$(APIVERSION),g' \
73   -e 's,[@]PACKAGE[@],$(PACKAGE),g' \
74   -e 's,[@]PACKAGE_BUGREPORT[@],$(PACKAGE_BUGREPORT),g' \
75   -e 's,[@]PACKAGE_URL[@],$(PACKAGE_URL),g' \
76   -e 's,[@]PATH_SEPARATOR[@],$(PATH_SEPARATOR),g' \
77   -e 's,[@]PERL[@],$(PERL),g' \
78   -e 's,[@]PERL_THREADS[@],$(PERL_THREADS),g' \
79   -e 's,[@]SHELL[@],$(SHELL),g' \
80   -e 's,[@]am_AUTOCONF[@],$(am_AUTOCONF),g' \
81   -e 's,[@]am_AUTOM4TE[@],$(am_AUTOM4TE),g' \
82   -e 's,[@]VERSION[@],$(VERSION),g' \
83   -e 's,[@]configure_input[@],Generated from $@.in; do not edit by hand.,g' \
84   -e 's,[@]datadir[@],$(datadir),g'
85
86 ## These files depend on Makefile so they are rebuilt if $(VERSION),
87 ## $(datadir) or other do_subst'ituted variables change.
88 ## Use chmod a-w to prevent people from editing the wrong file by accident.
89 automake: automake.in
90 aclocal: aclocal.in
91 automake aclocal: Makefile
92         $(AM_V_at)rm -f $@ $@-t
93         $(AM_V_GEN)$(do_subst) $(srcdir)/$@.in >$@-t
94         $(AM_V_at)chmod a+x,a-w $@-t && mv -f $@-t $@
95
96 ## The master location for INSTALL is lib/INSTALL.
97 ## This is where "make fetch" will install new versions.
98 ## Make sure we also update this copy.
99 INSTALL: lib/INSTALL
100         $(AM_V_GEN)cp $(srcdir)/lib/INSTALL $@
101
102 # Convenience proxy target for the test suites.
103 recheck:
104         $(am__cd) tests && $(MAKE) $(AM_MAKEFLAGS) $@
105 .PHONY: recheck
106
107 # We don't use the default name for the autom4te cache directory,
108 # so we need this.
109 maintainer-clean-local:
110         rm -rf .autom4te.cache
111
112
113 ## -------------------------------------------------------------------- ##
114 ##  Auxiliary scripts and files for use with "automake --add-missing".  ##
115 ## -------------------------------------------------------------------- ##
116
117 dist_pkgvdata_DATA = \
118   lib/COPYING \
119   lib/INSTALL \
120   lib/texinfo.tex
121
122 ## These must all be executable when installed.  However, if we use
123 ## _SCRIPTS, then the program transform will be applied, which is not
124 ## what we want.  So we make them executable by hand.
125 dist_script_DATA = \
126   lib/config.guess \
127   lib/config.sub \
128   lib/install-sh \
129   lib/mdate-sh \
130   lib/missing \
131   lib/mkinstalldirs \
132   lib/elisp-comp \
133   lib/ylwrap \
134   lib/depcomp \
135   lib/compile \
136   lib/py-compile \
137   lib/ar-lib \
138   lib/test-driver \
139   lib/tap-driver.sh \
140   lib/tap-driver.pl
141
142 install-data-hook:
143         @$(POST_INSTALL)
144         @for f in $(dist_script_DATA); do echo $$f; done \
145           | sed 's,^lib/,,' \
146           | ( st=0; \
147               while read f; do \
148                 echo " chmod +x '$(DESTDIR)$(scriptdir)/$$f'"; \
149                 chmod +x "$(DESTDIR)$(scriptdir)/$$f" || st=1; \
150               done; \
151               exit $$st )
152
153 installcheck-local:
154         @for f in $(dist_script_DATA); do echo $$f; done \
155           | sed 's,^lib/,,' \
156           | while read f; do \
157               path="$(pkgvdatadir)/$$f"; \
158               test -x "$$path" || echo $$path; \
159             done \
160           | sed 's/$$/: not executable/' \
161           | grep . 1>&2 && exit 1; exit 0
162
163
164 ## ---------------------------------------------------- ##
165 ##  Private perl modules used by automake and aclocal.  ##
166 ## ---------------------------------------------------- ##
167
168 perllibdir = $(pkgvdatadir)/Automake
169 dist_perllib_DATA = \
170   lib/Automake/ChannelDefs.pm \
171   lib/Automake/Channels.pm \
172   lib/Automake/Condition.pm \
173   lib/Automake/Configure_ac.pm \
174   lib/Automake/DisjConditions.pm \
175   lib/Automake/FileUtils.pm \
176   lib/Automake/General.pm \
177   lib/Automake/Getopt.pm \
178   lib/Automake/Item.pm \
179   lib/Automake/ItemDef.pm \
180   lib/Automake/Location.pm \
181   lib/Automake/Options.pm \
182   lib/Automake/Rule.pm \
183   lib/Automake/RuleDef.pm \
184   lib/Automake/Variable.pm \
185   lib/Automake/VarDef.pm \
186   lib/Automake/Version.pm \
187   lib/Automake/XFile.pm \
188   lib/Automake/Wrap.pm
189
190 nodist_perllib_DATA = lib/Automake/Config.pm
191 CLEANFILES += $(nodist_perllib_DATA)
192
193 ## This file depends on Makefile so it is rebuilt if $(VERSION),
194 ## $(datadir) or other do_subst'ituted variables change.
195 ## Use chmod a-w to prevent people from editing the wrong file by accident.
196 lib/Automake/Config.pm: lib/Automake/Config.in Makefile
197         $(AM_V_at)rm -f $@ $@-t
198         $(AM_V_at)test -d lib/Automake || $(MKDIR_P) lib/Automake
199         $(AM_V_GEN)sed <$(srcdir)/lib/Automake/Config.in >$@-t \
200           -e 's,[@]APIVERSION[@],$(APIVERSION),g' \
201           -e 's,[@]PACKAGE[@],$(PACKAGE),g' \
202           -e 's,[@]PACKAGE_BUGREPORT[@],$(PACKAGE_BUGREPORT),g' \
203           -e 's,[@]PERL[@],$(PERL),g' \
204           -e 's,[@]PERL_THREADS[@],$(PERL_THREADS),g' \
205           -e 's,[@]SHELL[@],$(SHELL),g' \
206           -e 's,[@]VERSION[@],$(VERSION),g' \
207           -e "s,[@]configure_input[@],Generated from Config.in; do not edit by hand.,g" \
208           -e 's,[@]datadir[@],$(datadir),g'
209         $(AM_V_at)chmod a-w $@-t && mv -f $@-t $@
210 EXTRA_DIST += lib/Automake/Config.in
211
212
213 ## --------------------- ##
214 ##  Makefile fragments.  ##
215 ## --------------------- ##
216
217 dist_am_DATA = \
218   lib/am/check.am \
219   lib/am/check2.am \
220   lib/am/clean-hdr.am \
221   lib/am/clean.am \
222   lib/am/compile.am \
223   lib/am/configure.am \
224   lib/am/data.am \
225   lib/am/dejagnu.am \
226   lib/am/depend.am \
227   lib/am/depend2.am \
228   lib/am/distdir.am \
229   lib/am/footer.am \
230   lib/am/header-vars.am \
231   lib/am/header.am \
232   lib/am/install.am \
233   lib/am/inst-vars.am \
234   lib/am/java.am \
235   lib/am/lang-compile.am \
236   lib/am/lex.am \
237   lib/am/library.am \
238   lib/am/libs.am \
239   lib/am/libtool.am \
240   lib/am/lisp.am \
241   lib/am/ltlib.am \
242   lib/am/ltlibrary.am \
243   lib/am/mans-vars.am \
244   lib/am/mans.am \
245   lib/am/program.am \
246   lib/am/progs.am \
247   lib/am/python.am \
248   lib/am/remake-hdr.am \
249   lib/am/scripts.am \
250   lib/am/subdirs.am \
251   lib/am/tags.am \
252   lib/am/texi-vers.am \
253   lib/am/texibuild.am \
254   lib/am/texinfos.am \
255   lib/am/vala.am \
256   lib/am/yacc.am
257
258
259 ## ------------------------------ ##
260 ##  Automake-provided m4 macros.  ##
261 ## ------------------------------ ##
262
263 dist_automake_ac_DATA = \
264   m4/amversion.m4 \
265   m4/ar-lib.m4 \
266   m4/as.m4 \
267   m4/auxdir.m4 \
268   m4/ccstdc.m4 \
269   m4/cond.m4 \
270   m4/cond-if.m4 \
271   m4/depend.m4 \
272   m4/depout.m4 \
273   m4/dmalloc.m4 \
274   m4/gcj.m4 \
275   m4/header.m4 \
276   m4/init.m4 \
277   m4/install-sh.m4 \
278   m4/lead-dot.m4 \
279   m4/lex.m4 \
280   m4/lispdir.m4 \
281   m4/maintainer.m4 \
282   m4/make.m4 \
283   m4/minuso.m4 \
284   m4/missing.m4 \
285   m4/mkdirp.m4 \
286   m4/obsol-gt.m4 \
287   m4/obsol-lt.m4 \
288   m4/obsolete.m4 \
289   m4/options.m4 \
290   m4/protos.m4 \
291   m4/python.m4 \
292   m4/runlog.m4 \
293   m4/sanity.m4 \
294   m4/silent.m4 \
295   m4/strip.m4 \
296   m4/substnot.m4 \
297   m4/tar.m4 \
298   m4/upc.m4 \
299   m4/vala.m4
300
301 dist_system_ac_DATA = m4/acdir/README
302
303 # We build amversion.m4 here, instead of from config.status,
304 # because config.status is rerun each time one of configure's
305 # dependencies change and amversion.m4 happens to be a configure
306 # dependency.  configure and amversion.m4 would be rebuilt in
307 # loop otherwise.
308 # Use '$(top_srcdir)/m4' for the benefit of non-GNU makes: this is
309 # how amversion.m4 appears in our dependencies.
310 $(top_srcdir)/m4/amversion.m4: $(srcdir)/configure.ac $(srcdir)/m4/amversion.in
311         $(AM_V_at)sed \
312             -e 's,[@]VERSION[@],$(VERSION),g' \
313             -e 's,[@]APIVERSION[@],$(APIVERSION),g' \
314             -e "s,[@]configure_input[@],Generated from amversion.in; do not edit by hand.,g" \
315             $(srcdir)/m4/amversion.in > $@-t
316         $(AM_V_at)chmod a-w $@-t && mv -f $@-t $@
317 EXTRA_DIST += m4/amversion.in
318
319
320 ## ---------------- ##
321 ##  Documentation.  ##
322 ## ---------------- ##
323
324 info_TEXINFOS = doc/automake.texi doc/automake-history.texi
325 doc_automake_TEXINFOS = doc/fdl.texi
326 doc_automake_history_TEXINFOS = doc/fdl.texi
327
328 dist_man1_MANS = \
329   $(srcdir)/doc/aclocal.1 \
330   $(srcdir)/doc/automake.1 \
331   $(srcdir)/doc/aclocal-$(APIVERSION).1 \
332   $(srcdir)/doc/automake-$(APIVERSION).1
333
334 $(dist_man1_MANS): $(srcdir)/configure.ac
335
336 MAINTAINERCLEANFILES += $(dist_man1_MANS)
337
338 update_mans = \
339   $(AM_V_GEN): \
340     && $(MAKE) $(AM_MAKEFLAGS) lib/Automake/Config.pm \
341     && PATH="$(abs_builddir)/tests/wrap$(PATH_SEPARATOR)$$PATH" \
342     && export PATH \
343     && $(HELP2MAN) --output=$@
344
345 $(srcdir)/doc/aclocal.1 $(srcdir)/doc/automake.1:
346         $(AM_V_GEN): \
347           && f=`echo $@ | sed 's|.*/||; s|\.1$$||; $(transform)'` \
348           && echo ".so man1/$$f-$(APIVERSION).1" > $@
349
350 $(srcdir)/doc/aclocal-$(APIVERSION).1: $(srcdir)/aclocal.in
351         $(update_mans) aclocal-$(APIVERSION)
352 $(srcdir)/doc/automake-$(APIVERSION).1: $(srcdir)/automake.in
353         $(update_mans) automake-$(APIVERSION)
354
355
356 ## ---------------------------- ##
357 ##  Example package "amhello".  ##
358 ## ---------------------------- ##
359
360 amhello_sources = \
361   doc/amhello/configure.ac \
362   doc/amhello/Makefile.am \
363   doc/amhello/README \
364   doc/amhello/src/main.c \
365   doc/amhello/src/Makefile.am
366
367 amhello_configury = \
368   aclocal.m4 \
369   autom4te.cache \
370   Makefile.in \
371   config.h.in \
372   configure \
373   depcomp \
374   install-sh \
375   missing \
376   src/Makefile.in
377
378 dist_noinst_DATA = $(amhello_sources)
379 dist_doc_DATA = $(srcdir)/doc/amhello-1.0.tar.gz
380
381 # We depend on configure.ac so that we regenerate the tarball
382 # whenever the Automake version changes.
383 # aclocal-$(APIVERSION) and automake-$(APIVERSION) are generated by
384 # configure in tests/.
385 $(srcdir)/doc/amhello-1.0.tar.gz: $(amhello_sources) $(srcdir)/configure.ac
386         $(AM_V_GEN): \
387           && PATH="$(abs_top_builddir)/tests/wrap$(PATH_SEPARATOR)$$PATH" \
388           && export PATH \
389           && $(am__cd) $(srcdir)/doc/amhello \
390           && ACLOCAL=aclocal-$(APIVERSION) && export ACLOCAL \
391           && AUTOMAKE=automake-$(APIVERSION) && export AUTOMAKE \
392           && AUTOCONF='$(am_AUTOCONF)' && export AUTOCONF \
393           && AUTOM4TE='$(am_AUTOM4TE)' && export AUTOM4TE \
394           && AUTORECONF='$(am_AUTORECONF)' && export AUTORECONF \
395           && AUTOHEADER='$(am_AUTOHEADER)' && export AUTOHEADER \
396           && AUTOUPDATE='$(am_AUTOUPDATE)' && export AUTOUPDATE \
397           && $(am_AUTORECONF) -vfi \
398           && ./configure \
399           && $(MAKE) $(AM_MAKEFLAGS) distcheck \
400           && $(MAKE) $(AM_MAKEFLAGS) distclean \
401           && rm -rf $(amhello_configury) \
402           && mv -f amhello-1.0.tar.gz ..
403
404
405 ## ------------------------------------------------- ##
406 ##  Third-party, obsolescent or experimental stuff.  ##
407 ## ------------------------------------------------- ##
408
409 EXTRA_DIST += \
410   contrib/check-html.am \
411   contrib/multilib/README \
412   contrib/multilib/config-ml.in \
413   contrib/multilib/symlink-tree \
414   contrib/multilib/multilib.am \
415   contrib/multilib/multi.m4 \
416   contrib/README
417
418
419 ## --------------------------------------------------- ##
420 ##  Older files, kept mostly for historical interest.  ##
421 ## --------------------------------------------------- ##
422
423 EXTRA_DIST += \
424   old/ChangeLog-tests \
425   old/ChangeLog.96 \
426   old/ChangeLog.98 \
427   old/ChangeLog.00 \
428   old/ChangeLog.01 \
429   old/ChangeLog.02 \
430   old/ChangeLog.03 \
431   old/ChangeLog.04 \
432   old/ChangeLog.09 \
433   old/ChangeLog.11 \
434   old/TODO
435
436
437 ##########################################################################
438
439 ## Everything past here is useful to the maintainer, but probably not
440 ## to anybody else.
441
442 ##########################################################################
443
444
445 ## --------------------------------------------------------- ##
446 ##  Automatic generation of the ChangeLog from git history.  ##
447 ## --------------------------------------------------------- ##
448
449 gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
450 gitlog_to_changelog_fixes = $(srcdir)/.git-log-fix
451 gitlog_to_changelog_options = --amend=$(gitlog_to_changelog_fixes) \
452                               --since='2011-12-28 00:00:00' \
453                               --no-cluster --format '%s%n%n%b'
454
455 EXTRA_DIST += lib/gitlog-to-changelog
456 EXTRA_DIST += $(gitlog_to_changelog_fixes)
457
458 # When executed from a git checkout, generate the ChangeLog from the git
459 # history.  When executed from an extracted distribution tarball, just
460 # copy the distributed ChangeLog in the build directory (and if this
461 # fails, or if no distributed ChangeLog file is present, complain and
462 # give an error).
463 #
464 # We need the apparently useless dependency from another .PHONY target
465 # 'am--changelog-regen-hook' to work around a bug of Solaris make, which
466 # doesn't execute the recipe of a target named as an existing file, even
467 # if such target is declared '.PHONY' (yikes!)
468 #
469 .PHONY: am--changelog-regen-hook
470 am--changelog-regen-hook:
471 ChangeLog: am--changelog-regen-hook
472         $(AM_V_GEN)set -e; set -u; \
473 ## The ChangeLog should be regenerated unconditionally when working from
474 ## checked-out sources; otherwise, if we're working from a distribution
475 ## tarball, we expect the ChangeLog to be distributed, so check that it
476 ## is indeed present in the source directory.
477         if test -d $(srcdir)/.git; then \
478           rm -f $@-t \
479             && $(gitlog_to_changelog_command) \
480                $(gitlog_to_changelog_options) >$@-t \
481             && chmod a-w $@-t \
482             && mv -f $@-t $@ \
483             || exit 1; \
484         elif test ! -f $(srcdir)/$@; then \
485           echo "Source tree is not a git checkout, and no pre-existent" \
486                "$@ file has been found there" >&2; \
487           exit 1; \
488         fi
489
490 # Ensure tests are world-executable.
491 # FIXME: this should be turned into a maintainer check...
492 dist-hook:
493         $(am__cd) $(distdir)/tests && chmod a+rx *.test
494
495
496 ## --------------------------- ##
497 ##  Perl coverage statistics.  ##
498 ## --------------------------- ##
499
500 PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
501 PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
502 PERL_COVER = cover
503
504 check-coverage-run recheck-coverage-run: all
505         $(mkinstalldirs) $(PERL_COVERAGE_DB)
506         PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
507         WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
508         $(MAKE) $(AM_MAKEFLAGS) `echo $@ | sed 's/-coverage-run//'`
509
510 check-coverage-report:
511         @if test ! -d "$(PERL_COVERAGE_DB)"; then \
512           echo "No coverage database found in '$(PERL_COVERAGE_DB)'." >&2; \
513           echo "Please run \"make check-coverage\" first" >&2; \
514           exit 1; \
515         fi
516         $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
517
518 # We don't use direct dependencies here because we'd like to be able
519 # to invoke the report even after interrupted check-coverage.
520 check-coverage: check-coverage-run
521         $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
522
523 recheck-coverage: recheck-coverage-run
524         $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
525
526 clean-coverage:
527         rm -rf "$(PERL_COVERAGE_DB)"
528 clean-local: clean-coverage
529
530 .PHONY: check-coverage recheck-coverage check-coverage-run \
531         recheck-coverage-run check-coverage-report clean-coverage
532
533
534 ## ---------------------------------------------------- ##
535 ##  Tagging and/or uploading stable and beta releases.  ##
536 ## ---------------------------------------------------- ##
537
538 GIT = git
539
540 EXTRA_DIST += lib/gnupload
541
542 version_rx = ^[1-9][0-9]*\.[0-9][0-9]*(\.[0-9][0-9]*)?
543 stable_version_rx = $(version_rx)$$
544 beta_version_rx = $(version_rx)[bdfhjlnprtvxz]$$
545 match_version = echo "$(VERSION)" | $(EGREP) >/dev/null
546
547 ## Check that we don't have uncommitted or unstaged changes.
548 ## TODO: Maybe the git suite already offers a shortcut to verify if the
549 ## TODO: working directory is "clean" or not?  If yes, use that instead
550 ## TODO: of duplicating the logic here.
551 git_must_have_clean_workdir = \
552   $(GIT) rev-parse --verify HEAD >/dev/null \
553     && $(GIT) update-index -q --refresh \
554     && $(GIT) diff-files --quiet \
555     && $(GIT) diff-index --quiet --cached HEAD \
556     || fatal "you have uncommitted or unstaged changes"
557
558 determine_release_type = \
559   if $(match_version) '$(stable_version_rx)'; then \
560     release_type='Release' dest=ftp; \
561   elif $(match_version) '$(beta_version_rx)'; then \
562     release_type='Beta release' dest=alpha; \
563   else \
564     fatal "invalid version '$(VERSION)' for a release"; \
565   fi
566
567 git-tag-release: maintainer-check
568         @set -e; set -u; \
569         fatal () { echo "$@: $$*; not tagging" >&2; exit 1; }; \
570         case '$(AM_TAG_DRYRUN)' in \
571           ""|[nN]|[nN]o|NO) run="";; \
572           *) run="echo Running:";; \
573         esac; \
574         $(determine_release_type); \
575         $(git_must_have_clean_workdir); \
576 ## Make sure the NEWS file is up-to-date.
577         sed 1q $(srcdir)/NEWS | grep '$(VERSION)' >/dev/null \
578           || fatal "NEWS not updated"; \
579 ## If all was successful, tag the release in the local repository.
580         $$run $(GIT) tag -s "v$(VERSION)" -m "$$release_type $(VERSION)"
581
582 git-upload-release:
583         @set -e; set -u; \
584         fatal () { echo "$@: $$*; not releasing" >&2; exit 1; }; \
585         $(determine_release_type); \
586         dest=$$dest.gnu.org:automake; \
587         $(git_must_have_clean_workdir); \
588 ## Check that we are releasing from a valid tag.
589         tag=`$(GIT) describe` \
590           && case $$tag in "v$(VERSION)") true;; *) false;; esac \
591           || fatal "you can only create a release from a tagged version"; \
592 ## Build and upload the distribution tarball(s).
593         $(MAKE) $(AM_MAKEFLAGS) dist || exit 1; \
594         echo Will upload to $$dest: $(DIST_ARCHIVES); \
595         $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) --to $$dest $(DIST_ARCHIVES)
596
597 .PHONY: git-upload-release git-tag-release
598
599
600 ## ------------------------------------------------------------------ ##
601 ##  Explore differences of autogenerated files in different commits.  ##
602 ## ------------------------------------------------------------------ ##
603
604 ## Visually comparing differences between the Makefile.in files in
605 ## automake's own build system as generated in two different branches
606 ## might help to catch bugs and blunders.  This has already happened a
607 ## few times in the past, when we used to version-control Makefile.in.
608 autodiffs:
609         @set -u; \
610          NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
611          OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
612          am_gitdir='$(abs_top_srcdir)/.git'; \
613          get_autofiles_from_rev () \
614          { \
615              rev=$$1 dir=$$2 \
616                && echo "$@: will get files from revision $$rev" \
617                && $(GIT) clone -q --depth 1 "$$am_gitdir" tmp \
618                && $(am__cd) tmp \
619                && $(GIT) checkout -q "$$rev" \
620                && echo "$@: bootstrapping $$rev" \
621                && $(SHELL) ./bootstrap \
622                && echo "$@: copying files from $$rev" \
623                && makefile_ins=`find . -name Makefile.in` \
624                && (tar cf - configure aclocal.m4 $$makefile_ins) | \
625                   (cd .. && $(am__cd) "$$dir" && tar xf -) \
626                && cd .. \
627                && rm -rf tmp; \
628          }; \
629          outdir=$@.dir \
630 ## Before proceeding, ensure the specified revisions truly exist.
631            && $(GIT) --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
632            && $(GIT) --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
633            && rm -rf $$outdir \
634            && mkdir $$outdir \
635            && $(am__cd) $$outdir \
636            && mkdir new old \
637            && get_autofiles_from_rev $$OLD_COMMIT old \
638            && get_autofiles_from_rev $$NEW_COMMIT new \
639            && exit 0
640
641 ## With lots of eye candy; we like our developers pampered and spoiled :-)
642 compare-autodiffs: autodiffs
643         @set -u; \
644         : $${COLORDIFF=colordiff} $${DIFF=diff}; \
645         dir=autodiffs.dir; \
646         if test ! -d "$$dir"; then \
647           echo "$@: $$dir: Not a directory" >&2; \
648           exit 1; \
649         fi; \
650         mydiff=false mypager=false; \
651         if test -t 1; then \
652           if ($$COLORDIFF -r . .) </dev/null >/dev/null 2>&1; then \
653             mydiff=$$COLORDIFF; \
654             mypager="less -R"; \
655           else \
656             mypager=less; \
657           fi; \
658         else \
659           mypager=cat; \
660         fi; \
661         if test "$$mydiff" = false; then \
662           if ($$DIFF -r -u . .); then \
663             mydiff=$$DIFF; \
664           else \
665             echo "$@: no good-enough diff program specified" >&2; \
666             exit 1; \
667           fi; \
668         fi; \
669         st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
670         rm -rf $$dir; \
671         exit $$st
672 .PHONY: autodiffs compare-autodiffs
673
674
675 ## --------------------------------------------------------------------- ##
676 ##  Synchronize third-party files that are committed in our repository.  ##
677 ## --------------------------------------------------------------------- ##
678
679 ## Program to use to fetch files.
680 WGET = wget
681 WGET_SV_CVS = $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/
682 WGET_SV_GIT_CF = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
683 WGET_SV_GIT_AC = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
684 WGET_SV_GIT_GL = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
685
686 ## Files that we fetch and which we compare against.
687 ## The 'lib/COPYING' file must still be synced by hand.
688 FETCHFILES = \
689 INSTALL \
690 config.guess \
691 config.sub \
692 gnupload \
693 gitlog-to-changelog \
694 texinfo.tex \
695 update-copyright
696
697 ## Fetch the latest versions of files we care about.
698 fetch:
699         rm -rf Fetchdir > /dev/null 2>&1
700         mkdir Fetchdir
701 ## If a get fails then that is a problem.
702         ($(am__cd) Fetchdir && \
703         $(WGET_SV_GIT_CF)config.guess -O config.guess && \
704         $(WGET_SV_GIT_CF)config.sub -O config.sub && \
705         $(WGET_SV_CVS)texinfo/texinfo/doc/texinfo.tex -O texinfo.tex && \
706         $(WGET_SV_GIT_GL)doc/INSTALL -O INSTALL && \
707         $(WGET_SV_GIT_GL)build-aux/gnupload -O gnupload && \
708         $(WGET_SV_GIT_GL)build-aux/update-copyright -O update-copyright && \
709         $(WGET_SV_GIT_GL)build-aux/gitlog-to-changelog -O gitlog-to-changelog)
710 ## Don't exit after test because we want to give as many errors as
711 ## possible.
712         @stat=0; for file in $(FETCHFILES); do \
713           if diff -u $(srcdir)/lib/$$file Fetchdir/$$file \
714                   >>Fetchdir/update.patch 2>/dev/null; then :; \
715           else \
716             stat=1; \
717             echo "Updating $(srcdir)/lib/$$file ..."; \
718             cp Fetchdir/$$file $(srcdir)/lib/$$file; \
719           fi; \
720         done; \
721         test $$stat = 0 || \
722           echo "See Fetchdir/update.patch for a log of the changes."; \
723         exit $$stat
724 .PHONY: fetch
725
726
727 ## ------------------------------------------------ ##
728 ##  Update copyright years of all committed files.  ##
729 ## ------------------------------------------------ ##
730
731 EXTRA_DIST += lib/update-copyright
732
733 update_copyright_env = \
734   UPDATE_COPYRIGHT_FORCE=1 \
735   UPDATE_COPYRIGHT_USE_INTERVALS=2
736
737 .PHONY: update-copyright
738 update-copyright:
739         $(AM_V_GEN)excluded_re=`echo $(FETCHFILES) \
740           | sed -e 's|^|lib/|' -e 's| | lib/|g' -e 's, ,|,g'`; \
741         $(GIT) ls-files \
742           | grep -Ev '^(lib/)?(COPYING|INSTALL)$$' \
743           | grep -Ev "^($$excluded_re)$$" \
744           | $(update_copyright_env) xargs $(srcdir)/lib/$@