1 ## Process this file with automake to create Makefile.in
3 ## Makefile for Automake.
5 # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004,
6 # 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2, or (at your option)
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ## lib goes first, because it builds Config.pm, used by aclocal and
23 ## automake (run in doc, tests, and in the rebuild rules.)
24 ## `.' goes before doc and tests, because the latter two directories
25 ## run aclocal and automake.
26 SUBDIRS = lib . contrib doc m4 tests
28 bin_SCRIPTS = automake aclocal
30 CLEANFILES = $(bin_SCRIPTS)
31 AUTOMAKESOURCES = automake.in aclocal.in
33 TAGS_FILES = $(AUTOMAKESOURCES)
51 ## Make versioned links. We only run the transform on the root name;
52 ## then we make a versioned link with the transformed base name. This
53 ## seemed like the most reasonable approach.
56 @for p in $(bin_SCRIPTS); do \
57 f="`echo $$p|sed '$(transform)'`"; \
58 fv="$$f-$(APIVERSION)"; \
59 rm -f "$(DESTDIR)$(bindir)/$$fv"; \
60 echo " $(LN) '$(DESTDIR)$(bindir)/$$f' '$(DESTDIR)$(bindir)/$$fv'"; \
61 $(LN) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$fv"; \
65 @for p in $(bin_SCRIPTS); do \
66 f="`echo $$p|sed '$(transform)'`"; \
67 fv="$$f-$(APIVERSION)"; \
68 rm -f "$(DESTDIR)$(bindir)/$$fv"; \
72 ## We can't use configure to do the substitution here; we must do it
73 ## by hand. We use a funny notation here to avoid configure
74 ## substitutions in our text.
76 -e 's,[@]APIVERSION[@],$(APIVERSION),g' \
77 -e 's,[@]PACKAGE[@],$(PACKAGE),g' \
78 -e 's,[@]PACKAGE_BUGREPORT[@],$(PACKAGE_BUGREPORT),g' \
79 -e 's,[@]PACKAGE_URL[@],$(PACKAGE_URL),g' \
80 -e 's,[@]PATH_SEPARATOR[@],$(PATH_SEPARATOR),g' \
81 -e 's,[@]PERL[@],$(PERL),g' \
82 -e 's,[@]PERL_THREADS[@],$(PERL_THREADS),g' \
83 -e 's,[@]SHELL[@],$(SHELL),g' \
84 -e 's,[@]am_AUTOCONF[@],$(am_AUTOCONF),g' \
85 -e 's,[@]am_AUTOM4TE[@],$(am_AUTOM4TE),g' \
86 -e 's,[@]VERSION[@],$(VERSION),g' \
87 -e 's,[@]configure_input[@],Generated from $@.in; do not edit by hand.,g' \
88 -e 's,[@]datadir[@],$(datadir),g'
90 ## These files depend on Makefile so they are rebuilt if $(VERSION),
91 ## $(datadir) or other do_subst'ituted variables change.
92 ## Use chmod a-w to prevent people from editing the wrong file by accident.
95 automake aclocal: Makefile
96 $(AM_V_at)rm -f $@ $@-t
97 $(AM_V_GEN)$(do_subst) $(srcdir)/$@.in >$@-t
98 $(AM_V_at)chmod a+x,a-w $@-t && mv -f $@-t $@
100 ## The master location for INSTALL is lib/INSTALL.
101 ## This is where `make fetch' will install new versions.
102 ## Make sure we also update this copy.
104 $(AM_V_GEN)cp $(srcdir)/lib/INSTALL $@
106 # Run the testsuite with the installed aclocal and automake.
108 am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
110 # Convenience proxy target for the test suites.
112 $(am__cd) tests && $(MAKE) $(AM_MAKEFLAGS) $@
115 ################################################################
117 ## Everything past here is useful to the maintainer, but probably not
121 gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
122 gitlog_to_changelog_options = --since='2011-12-28 00:00:00' \
123 --no-cluster --format '%s%n%n%b'
125 # Automatic generation of the ChangeLog from git history.
127 # When executed from a git checkout, generate the ChangeLog from the git
128 # history. When executed from an extracted distribution tarball, just
129 # copy the distributed ChangeLog in the build directory (and if this
130 # fails, or if no distributed ChangeLog file is present, complain and
133 # We need the apparently useless dependency from another .PHONY target
134 # `am--changelog-regen-hook' to work around a bug of Solaris make, which
135 # doesn't execute the recipe of a target named as an existing file, even
136 # if such target is declared `.PHONY' (yikes!)
138 .PHONY: am--changelog-regen-hook
139 am--changelog-regen-hook:
140 ChangeLog: am--changelog-regen-hook
141 $(AM_V_GEN)set -e; set -u; \
142 ## The ChangeLog should be regenerated unconditionally when working from
143 ## checked-out sources; otherwise, if we're working from a distribution
144 ## tarball, we expect the ChangeLog to be distributed, so check that it
145 ## is indeed present in the source directory.
146 if test -d $(srcdir)/.git; then \
148 && $(gitlog_to_changelog_command) \
149 $(gitlog_to_changelog_options) >$@-t \
153 elif test ! -f $(srcdir)/$@; then \
154 echo "Source tree is not a git checkout, and no pre-existent" \
155 "$@ file has been found there" >&2; \
159 # Ensure tests are world-executable
161 $(am__cd) $(distdir)/tests && chmod a+rx *.test
164 # Perl coverage statistics.
165 PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
166 PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
169 check-coverage-run recheck-coverage-run: all
170 $(mkinstalldirs) $(PERL_COVERAGE_DB)
171 PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
172 WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
173 $(MAKE) $(AM_MAKEFLAGS) `echo $@ | sed 's/-coverage-run//'`
175 check-coverage-report:
176 @if test ! -d "$(PERL_COVERAGE_DB)"; then \
177 echo "No coverage database found in \`$(PERL_COVERAGE_DB)'." >&2; \
178 echo "Please run \`make check-coverage' first" >&2; \
181 $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
183 # We don't use direct dependencies here because we'd like to be able
184 # to invoke the report even after interrupted check-coverage.
185 check-coverage: check-coverage-run
186 $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
188 recheck-coverage: recheck-coverage-run
189 $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
192 rm -rf "$(PERL_COVERAGE_DB)"
193 clean-local: clean-coverage
195 .PHONY: check-coverage recheck-coverage check-coverage-run \
196 recheck-coverage-run check-coverage-report clean-coverage
198 ## Tagging and/or uploading stable and beta releases.
202 version_rx = ^[1-9][0-9]*\.[0-9][0-9]*(\.[0-9][0-9]*)?
203 stable_version_rx = $(version_rx)$$
204 beta_version_rx = $(version_rx)[bdfhjlnprtvxz]$$
205 match_version = echo "$(VERSION)" | $(EGREP) >/dev/null
207 ## Check that we don't have uncommitted or unstaged changes.
208 ## TODO: Maybe the git suite already offers a shortcut to verify if the
209 ## TODO: working directory is "clean" or not? If yes, use that instead
210 ## TODO: of duplicating the logic here.
211 git_must_have_clean_workdir = \
212 $(GIT) rev-parse --verify HEAD >/dev/null \
213 && $(GIT) update-index -q --refresh \
214 && $(GIT) diff-files --quiet \
215 && $(GIT) diff-index --quiet --cached HEAD \
216 || fatal "you have uncommitted or unstaged changes"
218 determine_release_type = \
219 if $(match_version) '$(stable_version_rx)'; then \
220 release_type='Release' dest=ftp; \
221 elif $(match_version) '$(beta_version_rx)'; then \
222 release_type='Beta release' dest=alpha; \
224 fatal "invalid version '$(VERSION)' for a release"; \
227 git-tag-release: maintainer-check
229 fatal () { echo "$@: $$*; not tagging" >&2; exit 1; }; \
230 case '$(AM_TAG_DRYRUN)' in \
231 ""|[nN]|[nN]o|NO) run="";; \
232 *) run="echo Running:";; \
234 $(determine_release_type); \
235 $(git_must_have_clean_workdir); \
236 ## Make sure the NEWS file is up-to-date.
237 sed 1q $(srcdir)/NEWS | grep '$(VERSION)' >/dev/null \
238 || fatal "NEWS not updated"; \
239 ## If all was successful, tag the release in the local repository.
240 $$run $(GIT) tag -s "v$(VERSION)" -m "$$release_type $(VERSION)"
244 fatal () { echo "$@: $$*; not releasing" >&2; exit 1; }; \
245 $(determine_release_type); \
246 dest=$$dest.gnu.org:automake; \
247 $(git_must_have_clean_workdir); \
248 ## Check that we are releasing from a valid tag.
249 tag=`$(GIT) describe` \
250 && case $$tag in "v$(VERSION)") true;; *) false;; esac \
251 || fatal "you can only create a release from a tagged version"; \
252 ## Build and upload the distribution tarball(s).
253 $(MAKE) $(AM_MAKEFLAGS) dist || exit 1; \
254 echo Will upload to $$dest: $(DIST_ARCHIVES); \
255 $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) --to $$dest $(DIST_ARCHIVES)
257 .PHONY: git-upload-release git-tag-release
259 ## Visually comparing differences between the Makefile.in files in
260 ## automake's own build system as generated in two different branches
261 ## might help to catch bugs and blunders. This has already happened a
262 ## few times in the past, when we used to version-control Makefile.in.
265 NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
266 OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
267 am_gitdir='$(abs_top_srcdir)/.git'; \
268 get_autofiles_from_rev () \
271 && echo "$@: will get files from revision $$rev" \
272 && git clone -q --depth 1 "$$am_gitdir" tmp \
274 && git checkout -q "$$rev" \
275 && echo "$@: bootstrapping $$rev" \
276 && $(SHELL) ./bootstrap \
277 && echo "$@: copying files from $$rev" \
278 && makefile_ins=`find . -name Makefile.in` \
279 && (tar cf - configure aclocal.m4 $$makefile_ins) | \
280 (cd .. && $(am__cd) "$$dir" && tar xf -) \
285 ## Before proceeding, ensure the specified revisions truly exist.
286 && git --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
287 && git --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
290 && $(am__cd) $$outdir \
292 && get_autofiles_from_rev $$OLD_COMMIT old \
293 && get_autofiles_from_rev $$NEW_COMMIT new \
295 ## With lots of eye candy; we like our developers pampered and spoiled :-)
296 compare-autodiffs: autodiffs
298 : $${COLORDIFF=colordiff} $${DIFF=diff}; \
300 if test ! -d "$$dir"; then \
301 echo "$@: $$dir: Not a directory" >&2; \
304 mydiff=false mypager=false; \
306 if ($$COLORDIFF -r . .) </dev/null >/dev/null 2>&1; then \
307 mydiff=$$COLORDIFF; \
315 if test "$$mydiff" = false; then \
316 if ($$DIFF -r -u . .); then \
319 echo "$@: no good-enough diff program specified" >&2; \
323 st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
326 .PHONY: autodiffs compare-autodiffs
328 ## Program to use to fetch files.
330 WGET_SV_CVS = $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/
331 WGET_SV_GIT_CF = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
332 WGET_SV_GIT_AC = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
333 WGET_SV_GIT_GL = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
335 ## Files that we fetch and which we compare against.
336 ## The 'lib/COPYING' file must still be synced by hand.
342 gitlog-to-changelog \
345 ## Fetch the latest versions of files we care about.
347 rm -rf Fetchdir > /dev/null 2>&1
349 ## If a get fails then that is a problem.
350 ($(am__cd) Fetchdir && \
351 $(WGET_SV_GIT_CF)config.guess -O config.guess && \
352 $(WGET_SV_GIT_CF)config.sub -O config.sub && \
353 $(WGET_SV_CVS)texinfo/texinfo/doc/texinfo.tex -O texinfo.tex && \
354 $(WGET_SV_GIT_GL)doc/INSTALL -O INSTALL && \
355 $(WGET_SV_GIT_GL)build-aux/gnupload -O gnupload && \
356 $(WGET_SV_GIT_GL)build-aux/gitlog-to-changelog -O gitlog-to-changelog)
357 ## Don't exit after test because we want to give as many errors as
359 @stat=0; for file in $(FETCHFILES); do \
360 if diff -u $(srcdir)/lib/$$file Fetchdir/$$file \
361 >>Fetchdir/update.patch 2>/dev/null; then :; \
364 echo "Updating $(srcdir)/lib/$$file ..."; \
365 cp Fetchdir/$$file $(srcdir)/lib/$$file; \
369 echo "See Fetchdir/update.patch for a log of the changes."; \