1# Make Autoconf.
2
3# Copyright (C) 1999-2004, 2006-2012 Free Software Foundation, Inc.
4
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18# bin/ must be run first, as it builds executables needed for tests.
19# autom4te uses autotest.m4f to generate `testsuite', so build tests last.
20# Rules in man/ use scripts from both bin/ and tests/, so *it* goes last.
21SUBDIRS = bin . lib doc tests man
22
23ACLOCAL_AMFLAGS = -I m4
24
25EXTRA_DIST = ChangeLog.0 ChangeLog.1 ChangeLog.2 ChangeLog.3 \
26	     BUGS COPYINGv3 COPYING.EXCEPTION \
27	     GNUmakefile maint.mk cfg.mk \
28	     build-aux/gendocs.sh \
29	     build-aux/git-version-gen \
30	     build-aux/announce-gen build-aux/gnupload \
31	     build-aux/gitlog-to-changelog \
32	     .prev-version .version
33
34## --------- ##
35## INSTALL.  ##
36## --------- ##
37
38AM_MAKEINFOFLAGS = --no-headers --no-validate --no-split
39
40if MAKE_CASE_SENSITIVE
41pkgdata_DATA = $(srcdir)/INSTALL
42MAINTAINERCLEANFILES = $(srcdir)/INSTALL
43
44# Don't leave blank line at end of file.
45OMIT_TRAILING_EMPTY_LINES = '/^$$/H; /^$$/d; x; s/\n//p; s/\n*//; x'
46# Prefer 'plain quotes' over `makeinfo quotes'.
47CONVERT_QUOTES = "s/\`\([^']*\)'/'\1'/g"
48
49$(srcdir)/INSTALL: $(top_srcdir)/doc/install.texi
50	echo @firstparagraphindent insert				\
51	  | cat - $(top_srcdir)/doc/install.texi > tmp.texi
52	$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS)		\
53	     --plaintext tmp.texi					\
54	  | sed -e $(CONVERT_QUOTES) -e $(OMIT_TRAILING_EMPTY_LINES)	\
55	     > $@-t && mv $@-t $@
56	rm -f tmp.texi
57endif
58
59# Generate the ChangeLog from git history.
60gen_start_date = 2012-01-15 18:00:00 UTC
61.PHONY: gen-ChangeLog
62gen-ChangeLog:
63	if test -d $(top_srcdir)/.git; then \
64	  $(top_srcdir)/build-aux/gitlog-to-changelog \
65	    --since='$(gen_start_date)' > $(distdir)/cl-t \
66	    && rm -f $(distdir)/ChangeLog \
67	    && mv $(distdir)/cl-t $(distdir)/ChangeLog; \
68	fi
69
70# Dummy rule, to pacify automake "gnu" strictness and allow a clean
71# bootstrap.  Creates a dummy ChangeLog (unless one is already present,
72# as might be the case for users of vc-dwim) that will be overridden
73# with a proper one at distribution time.
74ChangeLog:
75	@echo dummy > $@
76
77# Version string management.  There are two files to be aware of:
78# .tarball-version - present only in a distribution tarball, and not in
79#   a checked-out repository.  Created with contents that were learned at
80#   the last time autoconf was run, and used by git-version-gen.  Must not
81#   be present in either $(srcdir) or $(builddir) for git-version-gen to
82#   give accurate answers during normal development with a checked out tree,
83#   but must be present in a tarball when there is no version control system.
84#   Therefore, it cannot be used in any dependencies.  GNUmakefile has
85#   hooks to force a reconfigure at distribution time to get the value
86#   correct, without penalizing normal development with extra reconfigures.
87# .version - present in a checked-out repository and in a distribution
88#   tarball.  At least as current as the most recent .tarball-version
89#   creation.  Usable in dependencies, particularly for files that don't
90#   want to depend on config.h but do want to track version changes.
91BUILT_SOURCES = $(top_srcdir)/.version
92$(top_srcdir)/.version:
93	echo $(VERSION) > $@-t && mv $@-t $@
94
95# Arrange so that .tarball-version appears only in distribution tarballs,
96# never in a checked-out repository.
97dist-hook: gen-ChangeLog
98	echo $(VERSION) > $(distdir)/.tarball-version
99
100# Arrange to remove the symlink to GNUmakefile in VPATH builds.
101# TODO remove this once automake vs. AC_CONFIG_LINKS issue is fixed.
102distclean-local:
103	if test x"$(VPATH)" != x ; then rm -f GNUmakefile ; fi
104
105# Perl coverage statistics.
106PERL_COVERAGE_DB = `pwd`/cover_db
107PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
108PERL_COVER = cover
109
110check-coverage-run: all
111	$(mkinstalldirs) $(PERL_COVERAGE_DB)
112	PERL5OPT="$(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
113	$(MAKE) $(AM_MAKEFLAGS) check
114
115check-coverage-report:
116	@if test ! -d $(PERL_COVERAGE_DB); then \
117	  echo "No coverage database found in \`$(PERL_COVERAGE_DB)'." >&2; \
118	  echo "Please run \`make check-coverage' first" >&2; \
119	  exit 1; \
120	fi
121	$(PERL_COVER) $(PERL_COVERAGE_DB) $(PERL_COVER_FLAGS)
122
123# We don't use direct dependencies here because we'd like to be able
124# to invoke the report even after interrupted check-coverage.
125check-coverage: check-coverage-run
126	$(MAKE) $(AM_MAKEFLAGS) check-coverage-report
127
128clean-local: clean-coverage
129clean-coverage:
130	rm -rf $(PERL_COVERAGE_DB)
131
132.PHONY: check-coverage check-coverage-run check-coverage-report clean-coverage
133