changelog: don't cluster multiple entries under the same "date line"
[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 TEST_SUBDIRS = tests lib/Automake/tests
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   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 ################################################################
107 ##
108 ## Everything past here is useful to the maintainer, but probably not
109 ## to anybody else
110 ##
111
112 gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
113 gitlog_to_changelog_options = --since='2011-12-28 00:00:00' \
114                               --no-cluster --format '%s%n%n%b'
115
116 # Automatic generation of the ChangeLog from git history.
117 #
118 # When executed from a git checkout, generate the ChangeLog from the git
119 # history.  When executed from an extracted distribution tarball, just
120 # copy the distributed ChangeLog in the build directory (and if this
121 # fails, or if no distributed ChangeLog file is present, complain and
122 # give an error).
123 #
124 # We need the apparently useless dependency from another .PHONY target
125 # `am--changelog-regen-hook' to work around a bug of Solaris make, which
126 # doesn't execute the recipe of a target named as an existing file, even
127 # if such target is declared `.PHONY' (yikes!)
128 #
129 .PHONY: am--changelog-regen-hook
130 am--changelog-regen-hook:
131 ChangeLog: am--changelog-regen-hook
132         $(AM_V_GEN)set -e; set -u; \
133 ## The ChangeLog should be regenerated unconditionally when working from
134 ## checked-out sources; otherwise, if we're working from a distribution
135 ## tarball, we expect the ChangeLog to be distributed, so check that it
136 ## is indeed present in the source directory.
137         if test -d $(srcdir)/.git; then \
138           rm -f $@-t \
139             && $(gitlog_to_changelog_command) \
140                $(gitlog_to_changelog_options) >$@-t \
141             && chmod a-w $@-t \
142             && mv -f $@-t $@ \
143             || exit 1; \
144         elif test ! -f $(srcdir)/$@; then \
145           echo "Source tree is not a git checkout, and no pre-existent" \
146                "$@ file has been found there" >&2; \
147           exit 1; \
148         fi
149
150 # Ensure tests are world-executable
151 dist-hook:
152         cd $(distdir)/tests && chmod a+rx *.test
153
154 # Some simple checks, and then ordinary check.  These are only really
155 # guaranteed to work on my machine.
156 syntax_check_rules = \
157 sc_test_names \
158 sc_diff_automake_in_automake \
159 sc_diff_aclocal_in_automake \
160 sc_perl_syntax \
161 sc_no_brace_variable_expansions \
162 sc_rm_minus_f \
163 sc_no_for_variable_in_macro \
164 sc_mkinstalldirs \
165 sc_pre_normal_post_install_uninstall \
166 sc_perl_no_undef \
167 sc_perl_no_split_regex_space \
168 sc_cd_in_backquotes \
169 sc_cd_relative_dir \
170 sc_perl_at_uscore_in_scalar_context \
171 sc_perl_local_no_parens \
172 sc_perl_local \
173 sc_AMDEP_TRUE_in_automake_in \
174 sc_tests_make_without_am_makeflags \
175 sc_tests_plain_make \
176 sc_tests_plain_autoconf \
177 sc_tests_plain_autoupdate \
178 sc_tests_plain_automake \
179 sc_tests_plain_autom4te \
180 sc_tests_plain_autoheader \
181 sc_tests_plain_autoreconf \
182 sc_tests_here_document_format \
183 sc_tests_Exit_not_exit \
184 sc_tests_automake_fails \
185 sc_tests_plain_aclocal \
186 sc_tests_plain_perl \
187 sc_tests_required_after_defs \
188 sc_tests_overriding_macros_on_cmdline \
189 sc_tests_plain_sleep \
190 sc_tests_plain_egrep_fgrep \
191 sc_tests_PATH_SEPARATOR \
192 sc_mkdir_p \
193 sc_perl_at_substs \
194 sc_unquoted_DESTDIR \
195 sc_tabs_in_texi \
196 sc_at_in_texi
197
198 $(syntax_check_rules): automake aclocal
199 maintainer-check: $(syntax_check_rules)
200 .PHONY: maintainer-check $(syntax_check_rules)
201
202 ## Check that the list of tests given in the Makefile is equal to the
203 ## list of all test scripts in the Automake testsuite.
204 .PHONY: maintainer-check-list-of-tests
205 maintainer-check-list-of-tests:
206         @fail= failcom='exit 1'; \
207         for f in x $$MAKEFLAGS; do \
208           case $$f in \
209             *=* | --[!k]*);; \
210             *k*) failcom='fail=yes';; \
211           esac; \
212         done; \
213         for subdir in $(TEST_SUBDIRS); do \
214           (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@) || eval $$failcom; \
215         done; \
216         test -z "$$fail"
217
218 maintainer-check: maintainer-check-list-of-tests
219
220 ## Look for test whose names can cause spurious failures when used as
221 ## first argument to AC_INIT (chiefly because they might contain an
222 ## m4/m4sugar builtin or macro name).
223 m4_builtins = \
224   __gnu__ \
225   __unix__ \
226   bpatsubst \
227   bregexp \
228   builtin \
229   changecom \
230   changequote \
231   changeword \
232   debugfile \
233   debugmode \
234   decr \
235   define \
236   defn \
237   divert \
238   divnum \
239   dnl \
240   dumpdef \
241   errprint \
242   esyscmd \
243   eval \
244   format \
245   ifdef \
246   ifelse \
247   include \
248   incr \
249   index \
250   indir \
251   len \
252   m4exit \
253   m4wrap \
254   maketemp \
255   mkstemp \
256   patsubst \
257   popdef \
258   pushdef \
259   regexp \
260   shift \
261   sinclude \
262   substr \
263   symbols \
264   syscmd \
265   sysval \
266   traceoff \
267   traceon \
268   translit \
269   undefine \
270   undivert
271 sc_test_names:
272         @m4_builtin_rx=`echo $(m4_builtins) | sed 's/ /|/g'`; \
273          m4_macro_rx="\\<($$m4_builtin_rx)\\>|\\<_?(A[CUMHS]|m4)_"; \
274          if ls tests/*.test | LC_ALL=C grep -E "$$m4_macro_rx"; then \
275            echo "the names of the tests above can be problematic" 1>&2; \
276            echo "Avoid test names that contain names of m4 macros" 1>&2; \
277            exit 1; \
278          fi
279
280 ## These check avoids accidental configure substitutions in the source.
281 ## There are exactly 9 lines that should be modified from automake.in to
282 ## automake, and 10 lines that should be modified from aclocal.in to
283 ## aclocal; these wors out to 32 and 34 lines of diffs, respectively.
284 sc_diff_automake_in_automake:
285         @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 32; then \
286           echo "found too many diffs between automake.in and automake" 1>&2; \
287           diff -c $(srcdir)/automake.in automake; \
288           exit 1; \
289         fi
290 sc_diff_aclocal_in_aclocal:
291         @if test `diff $(srcdir)/aclocal.in aclocal | wc -l` -ne 34; then \
292           echo "found too many diffs between aclocal.in and aclocal" 1>&2; \
293           diff -c $(srcdir)/aclocal.in aclocal; \
294           exit 1; \
295         fi
296
297 ## Syntax check with default Perl (on my machine, Perl 5).
298 sc_perl_syntax:
299         @perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w automake
300         @perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w aclocal
301
302 ## expect no instances of '${...}'.  However, $${...} is ok, since that
303 ## is a shell construct, not a Makefile construct.
304 sc_no_brace_variable_expansions:
305         @if grep -F '$${' $(srcdir)/lib/am/[a-z]*.am | \
306                grep -F -v '$$$$'; then \
307           echo "Found too many uses of '\$${' in the lines above." 1>&2; \
308           exit 1;                               \
309         else :; fi
310
311 ## Make sure `rm' is called with `-f'.
312 sc_rm_minus_f:
313         @if grep -v '^#' $(srcdir)/lib/am/[a-z]*.am $(srcdir)/tests/*.test | \
314             grep -E '\<rm ([^-]|\-[^f ]*\>)'; then \
315           echo "Suspicious 'rm' invocation." 1>&2; \
316           exit 1;                               \
317         else :; fi
318
319 ## Never use something like `for file in $(FILES)', this doesn't work
320 ## if FILES is empty or if it contains shell meta characters (e.g. $ is
321 ## commonly used in Java filenames).
322 sc_no_for_variable_in_macro:
323         @if grep 'for .* in \$$(' $(srcdir)/lib/am/[a-z]*.am; then \
324           echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
325           exit 1; \
326         else :; fi
327
328 ## Make sure all invocations of mkinstalldirs are correct.
329 sc_mkinstalldirs:
330         @if grep -n 'mkinstalldirs' $(srcdir)/lib/am/[a-z]*.am | \
331               grep -F -v '$$(mkinstalldirs)'; then \
332           echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
333           exit 1; \
334         else :; fi
335
336 ## Make sure all calls to PRE/NORMAL/POST_INSTALL/UNINSTALL
337 sc_pre_normal_post_install_uninstall:
338         @if grep -E -n '\((PRE|NORMAL|POST)_(|UN)INSTALL\)' \
339                  $(srcdir)/lib/am/[a-z]*.am | \
340               grep -v ':##' | grep -v ':        @\$$('; then \
341           echo "Found incorrect use of PRE/NORMAL/POST_INSTALL/UNINSTALL in the lines above" 1>&2; \
342           exit 1; \
343         else :; fi
344
345 ## We never want to use "undef", only "delete", but for $/.
346 sc_perl_no_undef:
347         @if grep -n -w 'undef ' $(srcdir)/automake.in | \
348               grep -F -v 'undef $$/'; then \
349           echo "Found undef in automake.in; use delete instead" 1>&2; \
350           exit 1; \
351         fi
352
353 ## We never want split (/ /,...), only split (' ', ...).
354 sc_perl_no_split_regex_space:
355         @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
356           echo "Found bad split in the lines above." 1>&2; \
357           exit 1; \
358         fi
359
360 ## Look for cd within backquotes
361 sc_cd_in_backquotes:
362         @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in \
363               $(srcdir)/lib/am/*.am; then \
364           echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
365           exit 1; \
366         fi
367
368 ## Look for cd to a relative directory (may be influenced by CDPATH).
369 ## Skip some known directories that are OK.
370 sc_cd_relative_dir:
371         @if grep -n '^[^#]*cd ' $(srcdir)/automake.in \
372               $(srcdir)/lib/am/*.am | \
373               grep -v 'echo.*cd ' | \
374               grep -v 'am__cd =' | \
375               grep -v '^[^#]*cd [./]' | \
376               grep -v '^[^#]*cd \$$(top_builddir)' | \
377               grep -v '^[^#]*cd "\$$\$$am__cwd' | \
378               grep -v '^[^#]*cd \$$(abs' | \
379               grep -v '^[^#]*cd "\$$(DESTDIR)'; then \
380           echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
381           exit 1; \
382         fi
383
384 ## Using @_ in a scalar context is most probably a programming error.
385 sc_perl_at_uscore_in_scalar_context:
386         @if grep -Hn '[^@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' $(srcdir)/automake.in; then \
387           echo "Using @_ in a scalar context in the lines above." 1>&2; \
388           exit 1; \
389         fi
390
391 ## Forbid using parens with `local' to ease counting.
392 sc_perl_local_no_parens:
393         @if grep '^[ \t]*local *(' $(srcdir)/automake.in; then \
394           echo "Don't use \`local' with parens: use several \`local' above." >&2; \
395           exit 1; \
396         fi
397
398 ## Allow only few variables to be localized in Automake.
399 sc_perl_local:
400         @if egrep -v '^[ \t]*local \$$[_~]( *=|;)' $(srcdir)/automake.in | \
401                 grep '^[ \t]*local [^*]'; then \
402           echo "Please avoid \`local'." 1>&2; \
403           exit 1; \
404         fi
405
406 ## Don't let AMDEP_TRUE substitution appear in automake.in.
407 sc_AMDEP_TRUE_in_automake_in:
408         @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
409           echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
410           exit 1; \
411         fi
412
413 ## Tests should never call make directly.
414 sc_tests_make_without_am_makeflags:
415         @if grep '^[^#].*(MAKE) ' $(srcdir)/lib/am/*.am $(srcdir)/automake.in |\
416                 grep -v 'AM_MAKEFLAGS'; then \
417           echo 'Use $$(MAKE) $$(AM_MAKEFLAGS).' 1>&2; \
418           exit 1; \
419         fi
420
421 ## Tests should never call make directly.
422 sc_tests_plain_make:
423         @if grep -v '^#' $(srcdir)/tests/*.test | $(EGREP) ':[  ]*make( |$$)'; then \
424           echo 'Do not run "make" in the above tests.  Use "$$MAKE" instead.' 1>&2; \
425           exit 1; \
426         fi
427
428 ## Tests should never call autoconf directly.
429 sc_tests_plain_autoconf:
430         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoconf\>'; then \
431           echo 'Do not run "autoconf" in the above tests.  Use "$$AUTOCONF" instead.' 1>&2; \
432           exit 1; \
433         fi
434
435 ## Tests should never call autoupdate directly.
436 sc_tests_plain_autoupdate:
437         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoupdate\>'; then \
438           echo 'Do not run "autoupdate" in the above tests.  Use "$$AUTOUPDATE" instead.' 1>&2; \
439           exit 1; \
440         fi
441
442 ## Tests should never call automake directly.
443 sc_tests_plain_automake:
444         @if grep -v '^#' $(srcdir)/tests/*.test | grep -E ':[   ]*automake\>([^:]|$$)'; then \
445           echo 'Do not run "automake" in the above tests.  Use "$$AUTOMAKE" instead.' 1>&2;  \
446           exit 1; \
447         fi
448
449 ## Tests should never call autoheader directly.
450 sc_tests_plain_autoheader:
451         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoheader\>'; then \
452           echo 'Do not run "automake" in the above tests.  Use "$$AUTOHEADER" instead.' 1>&2;  \
453           exit 1; \
454         fi
455
456 ## Tests should never call autoreconf directly.
457 sc_tests_plain_autoreconf:
458         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoreconf\>'; then \
459           echo 'Do not run "automake" in the above tests.  Use "$$AUTORECONF" instead.' 1>&2;  \
460           exit 1; \
461         fi
462
463 ## Tests should never call autom4te directly.
464 sc_tests_plain_autom4te:
465         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autom4te\>'; then \
466           echo 'Do not run "automake" in the above tests.  Use "$$AUTOM4TE" instead.' 1>&2;  \
467           exit 1; \
468         fi
469
470 ## Tests should only use END and EOF for here documents
471 ## (so that the next test is effective).
472 sc_tests_here_document_format:
473         @if grep '<<' $(srcdir)/tests/*.test | grep -v 'END' | grep -v 'EOF'; then \
474           echo 'Use here documents with "END" and "EOF" only, for greppability.' 1>&2; \
475           exit 1; \
476         fi
477
478 ## Tests should never call exit directly, but use Exit.
479 ## This is so that the exit status is transported correctly across the 0 trap.
480 ## Ignore comments, testsuite self tests, and one perl line in ext2.test.
481 sc_tests_Exit_not_exit:
482         @found=false; for file in $(srcdir)/tests/*.test; do \
483           case $$file in */self-check-*.test) continue;; esac; \
484           res=`sed -n -e '/^#/d; /^\$$PERL/d' -e '/<<.*END/,/^END/b' \
485                       -e '/<<.*EOF/,/^EOF/b' -e '/exit [$$0-9]/p' $$file`; \
486           if test -n "$$res"; then \
487             echo "$$file:$$res"; \
488             found=true; \
489           fi; \
490         done; \
491         if $$found; then \
492           echo 'Do not call plain "exit", use "Exit" instead, in above tests.' 1>&2; \
493           exit 1; \
494         fi
495
496 ## Use AUTOMAKE_fails when appropriate
497 sc_tests_automake_fails:
498         @if grep -v '^#' $(srcdir)/tests/*.test | grep '\$$AUTOMAKE.*&&.*[eE]xit'; then \
499           echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2;  \
500           exit 1; \
501         fi
502
503 ## Tests should never call aclocal directly.
504 sc_tests_plain_aclocal:
505         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*aclocal\>'; then \
506           echo 'Do not run "aclocal" in the above tests.  Use "$$ACLOCAL" instead.' 1>&2;  \
507           exit 1; \
508         fi
509
510 ## Tests should never call perl directly.
511 sc_tests_plain_perl:
512         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*perl\>'; then \
513           echo 'Do not run "perl" in the above tests.  Use "$$PERL" instead.' 1>&2; \
514           exit 1; \
515         fi
516
517 ## Setting `required' after sourcing `./defs' is a bug.
518 sc_tests_required_after_defs:
519         @for file in $(srcdir)/tests/*.test; do \
520           if out=`sed -n '/defs/,$${/required=/p;}' $$file`; test -n "$$out"; then \
521             echo 'Do not set "required" after sourcing "defs" in '"$$file: $$out" 1>&2; \
522             exit 1; \
523           fi; \
524         done
525
526 ## Overriding a Makefile macro on the command line is not portable when
527 ## recursive targets are used.  Better use an envvar.  SHELL is an
528 ## exception, POSIX says it can't come from the environment.  V, DESTDIR,
529 ## DISTCHECK_CONFIGURE_FLAGS and DISABLE_HARD_ERRORS are exceptions, too,
530 ## as package authors are urged not to initialize them anywhere.
531 sc_tests_overriding_macros_on_cmdline:
532         @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(srcdir)/tests/*.test; then \
533           echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
534           echo ' in the above lines, it is more portable.' 1>&2; \
535           exit 1; \
536         fi
537 ## Also try to account for usages like "$MAKE || st=$?".
538         @if sed -e 's/ || .*//' -e 's/ && .*//' \
539                 -e 's/ DESTDIR=[^ ]*/ /' -e 's/ SHELL=[^ ]*/ /' \
540                 -e 's/ V=[^ ]*/ /' -e 's/ DISABLE_HARD_ERRORS=[^ ]*/ /' \
541 ## DISTCHECK_CONFIGURE_FLAGS is allowed to contain whitespace in its
542 ## definition, so the more complex substitutions below.
543                 -e "s/ DISTCHECK_CONFIGURE_FLAGS='[^']*'/ /" \
544                 -e 's/ DISTCHECK_CONFIGURE_FLAGS="[^"]*"/ /' \
545                 -e 's/ DISTCHECK_CONFIGURE_FLAGS=[^ ]/ /' \
546               $(srcdir)/tests/*.test | grep '\$$MAKE .*='; then \
547           echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
548           echo 'it is more portable.' 1>&2; \
549           exit 1; \
550         fi
551         @if grep 'SHELL=.*\$$MAKE' $(srcdir)/tests/*.test; then \
552           echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 1>&2; \
553           echo 'the above lines.' 1>&2; \
554           exit 1; \
555         fi
556
557 ## Never use `sleep 1' to create files with different timestamps.
558 ## Use `$sleep' instead.  Some filesystems (e.g., Windows') have only
559 ## a 2sec resolution.
560 sc_tests_plain_sleep:
561         @if grep -E '\bsleep +[12345]\b' $(srcdir)/tests/*.test; then \
562           echo 'Do not use "sleep x" in the above tests.  Use "$$sleep" instead.' 1>&2; \
563           exit 1; \
564         fi
565
566 ## fgrep and egrep are not required by POSIX.
567 sc_tests_plain_egrep_fgrep:
568         @if grep -E '\b[ef]grep\b' $(srcdir)/tests/*.test ; then \
569           echo 'Do not use egrep or fgrep in test cases.  Use $$FGREP or $$EGREP.' 1>&2; \
570           exit 1; \
571         fi
572         @if grep -E '\b[ef]grep\b' $(srcdir)/lib/am/*.am $(srcdir)/m4/*.m4; then \
573           echo 'Do not use egrep or fgrep in the above files, they are not portable.' 1>&2; \
574           exit 1; \
575         fi
576
577 ## Using `:' as a PATH separator is not portable.
578 sc_tests_PATH_SEPARATOR:
579         @if grep -E '\bPATH=.*:.*' $(srcdir)/tests/*.test ; then \
580           echo "Use \`\$$PATH_SEPARATOR', not \`:', in PATH definitions above." 1>&2; \
581           exit 1; \
582         fi
583
584 sc_mkdir_p:
585         @if grep 'mkdir_p' $(srcdir)/automake.in \
586               $(srcdir)/lib/am/*.am $(srcdir)/tests/*.test; then \
587           echo 'Do not use mkdir_p in the above files, use MKDIR_P.' 1>&2; \
588           exit 1; \
589         fi
590
591 ## Try to make sure all @...@ substitutions are covered by our
592 ## substitution rule.
593 sc_perl_at_substs:
594         @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
595           echo "Unresolved @...@ substitution in aclocal" 1>&2; \
596           exit 1; \
597         fi
598         @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' automake | wc -l` -ne 0; then \
599           echo "Unresolved @...@ substitution in automake" 1>&2; \
600           exit 1; \
601         fi
602
603 sc_unquoted_DESTDIR:
604         @if grep -E "[^\'\"]\\\$$\(DESTDIR" $(srcdir)/lib/am/*.am; then \
605           echo 'Suspicious unquoted DESTDIR uses.' 1>&2 ; \
606           exit 1; \
607         fi
608
609 sc_tabs_in_texi:
610         @if grep '      ' $(srcdir)/doc/automake.texi; then \
611           echo 'Do not use tabs in the manual.' 1>&2; \
612           exit 1; \
613         fi
614
615 sc_at_in_texi:
616         @if grep -E '([^@]|^)@([         ][^@]|$$)' $(srcdir)/doc/automake.texi; \
617         then \
618           echo 'Unescaped @.' 1>&2; \
619           exit 1; \
620         fi
621
622
623 git-dist: maintainer-check
624 ## Make sure the NEWS file is up-to-date.
625         @if sed 1q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \
626           echo "NEWS not updated; not releasing" 1>&2; \
627           exit 1;                               \
628         fi
629 ## Build the distribution.  We expect the developer to have already run
630 ## "make check" and "make distcheck" on his own (as required in the
631 ## HACKING file, section "Release procedure").
632         $(MAKE) $(AM_MAKEFLAGS) dist
633 ## Finally, if anything was successful, commit the last changes and tag
634 ## the release in the repository.  We don't use RCS keywords so it's OK
635 ## to distribute the files before they were committed.
636         cd $(srcdir) && git commit -a -s && \
637            git tag -s "v$(VERSION)" -m "Release $(VERSION)"
638
639 git-release: git-dist
640         case $(VERSION) in \
641           *[a-z]) dest=alpha;; \
642           *)      dest=ftp;; \
643         esac; \
644         $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) \
645           --to $$dest.gnu.org:automake $(DIST_ARCHIVES)
646
647 .PHONY: git-release git-dist
648
649 ## Visually comparing differences between the Makefile.in files in
650 ## automake's own build system as generated in two different branches
651 ## might help to catch bugs and blunders.  This has already happened a
652 ## few times in the past, when we used to version-control Makefile.in.
653 autodiffs:
654         @set -u; \
655          NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
656          OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
657          am_gitdir='$(abs_top_srcdir)/.git'; \
658          get_autofiles_from_rev () \
659          { \
660              rev=$$1 dir=$$2 \
661                && echo "$@: will get files from revision $$rev" \
662                && git clone -q --depth 1 "$$am_gitdir" tmp \
663                && cd tmp \
664                && git checkout -q "$$rev" \
665                && echo "$@: bootstrapping $$rev" \
666                && $(SHELL) ./bootstrap \
667                && echo "$@: copying files from $$rev" \
668                && makefile_ins=`find . -name Makefile.in` \
669                && (tar cf - configure aclocal.m4 $$makefile_ins) | \
670                   (cd .. && cd "$$dir" && tar xf -) \
671                && cd .. \
672                && rm -rf tmp; \
673          }; \
674          outdir=$@.dir \
675 ## Before proceeding, ensure the specified revisions truly exist.
676            && git --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
677            && git --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
678            && rm -rf $$outdir \
679            && mkdir $$outdir \
680            && cd $$outdir \
681            && mkdir new old \
682            && get_autofiles_from_rev $$OLD_COMMIT old \
683            && get_autofiles_from_rev $$NEW_COMMIT new \
684            && exit 0
685 ## With lots of eye candy; we like our developers pampered and spoiled :-)
686 compare-autodiffs: autodiffs
687         @set -u; \
688         : $${COLORDIFF=colordiff} $${DIFF=diff}; \
689         dir=autodiffs.dir; \
690         if test ! -d "$$dir"; then \
691           echo "$@: $$dir: Not a directory" >&2; \
692           exit 1; \
693         fi; \
694         mydiff=false mypager=false; \
695         if test -t 1; then \
696           if ($$COLORDIFF -r . .) </dev/null >/dev/null 2>&1; then \
697             mydiff=$$COLORDIFF; \
698             mypager="less -R"; \
699           else \
700             mypager=less; \
701           fi; \
702         else \
703           mypager=cat; \
704         fi; \
705         if test "$$mydiff" = false; then \
706           if ($$DIFF -r -u . .); then \
707             mydiff=$$DIFF; \
708           else \
709             echo "$@: no good-enough diff program specified" >&2; \
710             exit 1; \
711           fi; \
712         fi; \
713         st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
714         rm -rf $$dir; \
715         exit $$st
716 .PHONY: autodiffs compare-autodiffs
717
718 ## Program to use to fetch files.
719 WGET = wget
720 WGET_SV_CVS = $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/
721 WGET_SV_GIT_CF = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
722 WGET_SV_GIT_AC = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
723 WGET_SV_GIT_GL = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
724 WGET_GCC = $(WGET) 'http://gcc.gnu.org/viewcvs/*checkout*/trunk/'
725
726 ## Files that we fetch and which we compare against.
727 ## FIXME should be a lot more here
728 FETCHFILES = \
729 INSTALL \
730 config-ml.in \
731 config.guess \
732 config.sub \
733 gnupload \
734 gitlog-to-changelog \
735 symlink-tree \
736 texinfo.tex
737
738 ## Fetch the latest versions of files we care about.
739 fetch:
740         rm -rf Fetchdir > /dev/null 2>&1
741         mkdir Fetchdir
742 ## If a get fails then that is a problem.
743         (cd Fetchdir && \
744         $(WGET_SV_GIT_CF)config.guess -O config.guess && \
745         $(WGET_SV_GIT_CF)config.sub -O config.sub && \
746         $(WGET_SV_CVS)texinfo/texinfo/doc/texinfo.tex -O texinfo.tex && \
747         $(WGET_SV_GIT_GL)doc/INSTALL -O INSTALL && \
748         $(WGET_SV_GIT_GL)build-aux/gnupload -O gnupload && \
749         $(WGET_SV_GIT_GL)build-aux/gitlog-to-changelog -O gitlog-to-changelog && \
750         $(WGET_GCC)config-ml.in -O config-ml.in && \
751         $(WGET_GCC)symlink-tree -O symlink-tree)
752 ## Don't exit after test because we want to give as many errors as
753 ## possible.
754         @stat=0; for file in $(FETCHFILES); do \
755           if diff -u $(srcdir)/lib/$$file Fetchdir/$$file \
756                   >>Fetchdir/update.patch 2>/dev/null; then :; \
757           else \
758             stat=1; \
759             echo "Updating $(srcdir)/lib/$$file..."; \
760             cp Fetchdir/$$file $(srcdir)/lib/$$file; \
761           fi; \
762         done; \
763         test $$stat = 0 || \
764           echo "See Fetchdir/update.patch for a log of the changes."; \
765         exit $$stat
766 .PHONY: fetch
767
768 ## Generate release statistics, for the table in automake.texi.
769 ## This has to be run in an up to date build tree, but there must
770 ## be no temp files nor unused other files lying around!
771 release-stats: ps
772         $(AM_V_GEN): && \
773         am=`wc -l < automake` && \
774         acl=`wc -l < aclocal` && \
775         pmfiles="lib/Automake/*.pm" && \
776         if test . != '$(srcdir)'; then pmfiles="$$pmfiles $(srcdir)/lib/Automake/*.pm"; \
777         else :; fi && \
778         pm=`cat $$pmfiles | wc -l` && \
779         dot_am_files=`ls -1 $(srcdir)/lib/am/*.am | grep -v Makefile.am` && \
780         amf=`echo "$$dot_am_files" | wc -l` && \
781         aml=`cat $$dot_am_files | wc -l` && \
782         m4f=`ls -1 $(srcdir)/m4/*.m4 | wc -l` && \
783         m4l=`cat $(srcdir)/m4/*.m4 | wc -l` && \
784         doc_text=`cd doc && LC_ALL=C pstops 0 automake.ps unused.ps 2>&1` && \
785         echo "$$doc_text" && \
786         rm -f doc/unused.ps && \
787         doc=`echo "$$doc_text" | sed -n 's/.*Wrote \([1-9][0-9]*\) pages.*/\1/p'` && \
788         tests="tests/*.test"; \
789         if test . != '$(srcdir)'; then tests="$$tests $(srcdir)/tests/*.test"; \
790         else :; fi && \
791         t=`ls -1 $$tests | wc -l` && \
792         tgen=`ls -1 $$tests | grep '.-p\.test' | wc -l` && \
793         today=`date +%Y-%m-%d` && \
794         echo "add this to the table in doc/automake.texi after verification:" && \
795         printf '@item %s @tab %-6s @tab %4d @tab %4d @tab %4d @tab %4d %-4s @tab %4d %-4s @tab %3d @tab %d %-4s\n' \
796                       $$today $(VERSION) $$am    $$acl    $$pm   $$aml "($$amf)" $$m4l "($$m4f)" $$doc $$t "($$tgen)"
797 .PHONY: release-stats