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