build: require GNU make in order to run the maintainer checks
[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, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004,
6 # 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software
7 # Foundation, Inc.
8
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)
12 # any later version.
13
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.
18
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/>.
21
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
27
28 bin_SCRIPTS = automake aclocal
29
30 CLEANFILES = $(bin_SCRIPTS)
31 AUTOMAKESOURCES = automake.in aclocal.in
32
33 TAGS_FILES = $(AUTOMAKESOURCES)
34
35 EXTRA_DIST = \
36   GNUmakefile \
37   syntax-checks.mk \
38   HACKING \
39   ChangeLog.96 \
40   ChangeLog.98 \
41   ChangeLog.00 \
42   ChangeLog.01 \
43   ChangeLog.02 \
44   ChangeLog.03 \
45   ChangeLog.04 \
46   ChangeLog.09 \
47   ChangeLog.11 \
48   bootstrap \
49   $(AUTOMAKESOURCES)
50
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.
54 install-exec-hook:
55         @$(POST_INSTALL)
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; \
62         done
63
64 uninstall-hook:
65         @for p in $(bin_SCRIPTS); do \
66           f="`echo $$p|sed '$(transform)'`"; \
67           fv="$$f-$(APIVERSION)"; \
68           rm -f $(DESTDIR)$(bindir)/$$fv; \
69         done
70
71
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.
75 do_subst = sed \
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'
89
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.
93 automake: automake.in
94 aclocal: aclocal.in
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 $@
99
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.
103 INSTALL: lib/INSTALL
104         $(AM_V_GEN)cp $(srcdir)/lib/INSTALL $@
105
106 # Run the testsuite with the installed aclocal and automake.
107 installcheck-local:
108         am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
109
110 # Convenience proxy target for the test suites.
111 recheck:
112         $(am__cd) tests && $(MAKE) $(AM_MAKEFLAGS) $@
113 .PHONY: recheck
114
115 ################################################################
116 ##
117 ## Everything past here is useful to the maintainer, but probably not
118 ## to anybody else
119 ##
120
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'
124
125 # Automatic generation of the ChangeLog from git history.
126 #
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
131 # give an error).
132 #
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!)
137 #
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 \
147           rm -f $@-t \
148             && $(gitlog_to_changelog_command) \
149                $(gitlog_to_changelog_options) >$@-t \
150             && chmod a-w $@-t \
151             && mv -f $@-t $@ \
152             || exit 1; \
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; \
156           exit 1; \
157         fi
158
159 # Ensure tests are world-executable
160 dist-hook:
161         $(am__cd) $(distdir)/tests && chmod a+rx *.test
162
163
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
167 PERL_COVER = cover
168
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//'`
174
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; \
179           exit 1; \
180         fi
181         $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
182
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
187
188 recheck-coverage: recheck-coverage-run
189         $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
190
191 clean-coverage:
192         rm -rf "$(PERL_COVERAGE_DB)"
193 clean-local: clean-coverage
194
195 .PHONY: check-coverage recheck-coverage check-coverage-run \
196         recheck-coverage-run check-coverage-report clean-coverage
197
198 git-dist: maintainer-check
199 ## Make sure the NEWS file is up-to-date.
200         @if sed 1q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \
201           echo "NEWS not updated; not releasing" 1>&2; \
202           exit 1;                               \
203         fi
204 ## Build the distribution.  We expect the developer to have already run
205 ## "make check" and "make distcheck" on his own (as required in the
206 ## HACKING file, section "Release procedure").
207         $(MAKE) $(AM_MAKEFLAGS) dist
208 ## Finally, if anything was successful, commit the last changes and tag
209 ## the release in the repository.  We don't use RCS keywords so it's OK
210 ## to distribute the files before they were committed.
211         $(am__cd) $(srcdir) && git commit -a -s && \
212            git tag -s "v$(VERSION)" -m "Release $(VERSION)"
213
214 git-release: git-dist
215         case $(VERSION) in \
216           *[a-z]) dest=alpha;; \
217           *)      dest=ftp;; \
218         esac; \
219         $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) \
220           --to $$dest.gnu.org:automake $(DIST_ARCHIVES)
221
222 ## Visually comparing differences between the Makefile.in files in
223 ## automake's own build system as generated in two different branches
224 ## might help to catch bugs and blunders.  This has already happened a
225 ## few times in the past, when we used to version-control Makefile.in.
226 autodiffs:
227         @set -u; \
228          NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
229          OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
230          am_gitdir='$(abs_top_srcdir)/.git'; \
231          get_autofiles_from_rev () \
232          { \
233              rev=$$1 dir=$$2 \
234                && echo "$@: will get files from revision $$rev" \
235                && git clone -q --depth 1 "$$am_gitdir" tmp \
236                && cd tmp \
237                && git checkout -q "$$rev" \
238                && echo "$@: bootstrapping $$rev" \
239                && $(SHELL) ./bootstrap \
240                && echo "$@: copying files from $$rev" \
241                && makefile_ins=`find . -name Makefile.in` \
242                && (tar cf - configure aclocal.m4 $$makefile_ins) | \
243                   (cd .. && cd "$$dir" && tar xf -) \
244                && cd .. \
245                && rm -rf tmp; \
246          }; \
247          outdir=$@.dir \
248 ## Before proceeding, ensure the specified revisions truly exist.
249            && git --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
250            && git --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
251            && rm -rf $$outdir \
252            && mkdir $$outdir \
253            && cd $$outdir \
254            && mkdir new old \
255            && get_autofiles_from_rev $$OLD_COMMIT old \
256            && get_autofiles_from_rev $$NEW_COMMIT new \
257            && exit 0
258 ## With lots of eye candy; we like our developers pampered and spoiled :-)
259 compare-autodiffs: autodiffs
260         @set -u; \
261         : $${COLORDIFF=colordiff} $${DIFF=diff}; \
262         dir=autodiffs.dir; \
263         if test ! -d "$$dir"; then \
264           echo "$@: $$dir: Not a directory" >&2; \
265           exit 1; \
266         fi; \
267         mydiff=false mypager=false; \
268         if test -t 1; then \
269           if ($$COLORDIFF -r . .) </dev/null >/dev/null 2>&1; then \
270             mydiff=$$COLORDIFF; \
271             mypager="less -R"; \
272           else \
273             mypager=less; \
274           fi; \
275         else \
276           mypager=cat; \
277         fi; \
278         if test "$$mydiff" = false; then \
279           if ($$DIFF -r -u . .); then \
280             mydiff=$$DIFF; \
281           else \
282             echo "$@: no good-enough diff program specified" >&2; \
283             exit 1; \
284           fi; \
285         fi; \
286         st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
287         rm -rf $$dir; \
288         exit $$st
289 .PHONY: autodiffs compare-autodiffs
290
291 ## Program to use to fetch files.
292 WGET = wget
293 WGET_SV_CVS = $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/
294 WGET_SV_GIT_CF = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
295 WGET_SV_GIT_AC = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
296 WGET_SV_GIT_GL = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
297
298 ## Files that we fetch and which we compare against.
299 ## FIXME should be a lot more here
300 FETCHFILES = \
301 INSTALL \
302 config.guess \
303 config.sub \
304 gnupload \
305 gitlog-to-changelog \
306 texinfo.tex
307
308 ## Fetch the latest versions of files we care about.
309 fetch:
310         rm -rf Fetchdir > /dev/null 2>&1
311         mkdir Fetchdir
312 ## If a get fails then that is a problem.
313         ($(am__cd) Fetchdir && \
314         $(WGET_SV_GIT_CF)config.guess -O config.guess && \
315         $(WGET_SV_GIT_CF)config.sub -O config.sub && \
316         $(WGET_SV_CVS)texinfo/texinfo/doc/texinfo.tex -O texinfo.tex && \
317         $(WGET_SV_GIT_GL)doc/INSTALL -O INSTALL && \
318         $(WGET_SV_GIT_GL)build-aux/gnupload -O gnupload && \
319         $(WGET_SV_GIT_GL)build-aux/gitlog-to-changelog -O gitlog-to-changelog)
320 ## Don't exit after test because we want to give as many errors as
321 ## possible.
322         @stat=0; for file in $(FETCHFILES); do \
323           if diff -u $(srcdir)/lib/$$file Fetchdir/$$file \
324                   >>Fetchdir/update.patch 2>/dev/null; then :; \
325           else \
326             stat=1; \
327             echo "Updating $(srcdir)/lib/$$file ..."; \
328             cp Fetchdir/$$file $(srcdir)/lib/$$file; \
329           fi; \
330         done; \
331         test $$stat = 0 || \
332           echo "See Fetchdir/update.patch for a log of the changes."; \
333         exit $$stat
334 .PHONY: fetch
335
336 ## Generate release statistics, for the table in automake.texi.
337 ## This has to be run in an up to date build tree, but there must
338 ## be no temp files nor unused other files lying around!
339 release-stats: ps
340         $(AM_V_GEN): && \
341         am=`wc -l < automake` && \
342         acl=`wc -l < aclocal` && \
343         pmfiles="lib/Automake/*.pm" && \
344         if test . != '$(srcdir)'; then pmfiles="$$pmfiles $(srcdir)/lib/Automake/*.pm"; \
345         else :; fi && \
346         pm=`cat $$pmfiles | wc -l` && \
347         dot_am_files=`ls -1 $(srcdir)/lib/am/*.am | grep -v Makefile.am` && \
348         amf=`echo "$$dot_am_files" | wc -l` && \
349         aml=`cat $$dot_am_files | wc -l` && \
350         m4f=`ls -1 $(srcdir)/m4/*.m4 | wc -l` && \
351         m4l=`cat $(srcdir)/m4/*.m4 | wc -l` && \
352         doc_text=`$(am__cd) doc && LC_ALL=C pstops 0 automake.ps unused.ps 2>&1` && \
353         echo "$$doc_text" && \
354         rm -f doc/unused.ps && \
355         doc=`echo "$$doc_text" | sed -n 's/.*Wrote \([1-9][0-9]*\) pages.*/\1/p'` && \
356         tests="tests/*.test"; \
357         if test . != '$(srcdir)'; then tests="$$tests $(srcdir)/tests/*.test"; \
358         else :; fi && \
359         t=`ls -1 $$tests | wc -l` && \
360         tgen=`grep 'GENERATED AUTOMATICALLY' $$tests | wc -l` && \
361         today=`date +%Y-%m-%d` && \
362         echo "add this to the table in doc/automake.texi after verification:" && \
363         printf '@item %s @tab %-6s @tab %4d @tab %4d @tab %4d @tab %4d %-4s @tab %4d %-4s @tab %3d @tab %d %-4s\n' \
364                       $$today $(VERSION) $$am    $$acl    $$pm   $$aml "($$amf)" $$m4l "($$m4f)" $$doc $$t "($$tgen)"
365 .PHONY: release-stats