1 ## Process this file with automake to create Makefile.in
3 ## Makefile for Automake.
5 ## Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002 Free
6 ## Software Foundation, Inc.
8 ## This program is free software; you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation; either version 2, or (at your option)
13 ## This program is distributed in the hope that it will be useful,
14 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ## GNU General Public License for more details.
18 ## You should have received a copy of the GNU General Public License
19 ## along with this program; if not, write to the Free Software
20 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 ## We need `.' in SUBDIRS because we want `check' to build `.' before
25 SUBDIRS = . m4 lib tests
27 bin_SCRIPTS = automake aclocal
28 info_TEXINFOS = automake.texi
31 TAGS_FILES = automake.in aclocal.in
33 # The following requires a fixed version of the Emacs 19.30 etags.
34 ETAGS_ARGS = --lang=none \
35 --regex='/^@node[ \t]+\([^,]+\)/\1/' $(srcdir)/automake.texi
36 TAGS_DEPENDENCIES = automake.texi
38 EXTRA_DIST = ChangeLog.1996 ChangeLog.1998 ChangeLog.2000 ChangeLog.2001
40 ## Make versioned links. We only run the transform on the root name;
41 ## then we make a versioned link with the transformed base name. This
42 ## seemed like the most reasonable approach.
45 @for p in $(bin_SCRIPTS); do \
46 f="`echo $$p|sed '$(transform)'`"; \
47 fv="$$f-$(APIVERSION)"; \
48 rm -f $(DESTDIR)$(bindir)/$$fv; \
49 echo " ln $(DESTDIR)$(bindir)/$$f $(DESTDIR)$(bindir)/$$fv"; \
50 ln $(DESTDIR)$(bindir)/$$f $(DESTDIR)$(bindir)/$$fv; \
54 @for p in $(bin_SCRIPTS); do \
55 f="`echo $$p|sed '$(transform)'`"; \
56 fv="$$f-$(APIVERSION)"; \
57 rm -f $(DESTDIR)$(bindir)/$$fv; \
60 ################################################################
62 ## Everything past here is useful to the maintainer, but probably not
66 # Some simple checks, and then ordinary check. These are only really
67 # guaranteed to work on my machine.
68 maintainer-check: automake aclocal
69 ## This check avoids accidental configure substitutions in the source.
70 ## There are exactly 7 lines that should be modified. This works out
71 ## to 22 lines of diffs.
72 @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 28; then \
73 echo "found too many diffs between automake.in and automake"; 1>&2; \
74 diff -c $(srcdir)/automake.in automake; \
77 ## Syntax check with default Perl (on my machine, Perl 5).
78 perllibdir=$(srcdir)/lib $(PERL) -c -w automake
79 perllibdir=$(srcdir)/lib $(PERL) -c -w aclocal
80 ## expect no instances of '${...}'. However, $${...} is ok, since that
81 ## is a shell construct, not a Makefile construct.
82 @if grep -F '$${' $(srcdir)/lib/am/[a-z]*.am | \
83 grep -F -v '$$$$'; then \
84 echo "Found too many uses of '\$${' in the lines above." 1>&2; \
87 ## Make sure `rm' is called with `-f'.
88 @if grep -E '\<rm ([^-]|\-[^f ]*\>)' \
89 $(srcdir)/lib/am/[a-z]*.am $(srcdir)/tests/*.test | \
91 echo "Suspicious 'rm' invocation." 1>&2; \
94 ## Make sure all invocations of mkinstalldirs are correct.
95 @if grep -n 'mkinstalldirs' $(srcdir)/lib/am/[a-z]*.am | \
96 grep -F -v '$$(mkinstalldirs)'; then \
97 echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
100 ## We never want to use "undef", only "delete", but for $/.
101 @if grep -n -w 'undef ' $(srcdir)/automake.in | \
102 grep -F -v 'undef $$/'; then \
103 echo "Found undef in automake.in; use delete instead" 1>&2; \
106 ## We never want split (/ /,...), only split (' ', ...).
107 @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
108 echo "Found bad split in the lines above." 1>&2; \
111 ## Look for cd within backquotes
112 @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in \
113 $(srcdir)/lib/am/*.am; then \
114 echo "Consider using $$$$(am__cd) in the line above." 1>&2; \
117 ## Using @_ in a scalar context is most probably a programming error.
118 @if grep -Hn '[^) ] *= *@_' $(srcdir)/automake.in; then \
119 echo "Using @_ in a scalar context in the lines above." 1>&2; \
122 ## Forbid using parens with `local' to ease counting.
123 @if grep '^[ \t]*local *(' $(srcdir)/automake.in; then \
124 echo "Don't use \`local' with parens: use several \`local' above." >&2; \
127 ## Up to now we manage to limit to 1 use of local, but for `local $_;'.
128 @locals=`grep -v '^[ \t]*local \$$_;' $(srcdir)/automake.in | \
129 grep -c '^[ \t]*local [^*]'`; \
132 echo "Wow, congrats! There are no \`local' now!." >&2; \
133 echo "Please update Makefile.am (maintainer-check)." >&2; \
138 echo "Too many \`local'! Are you sure you need $$locals of them?" >&2; \
139 echo "Up to now 1 was enough." >&2; \
143 ## Don't let AMDEP_TRUE substitution appear in automake.in.
144 @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
145 echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
148 ## Tests should never call make directly.
149 @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[ ]*make'; then \
150 echo 'Do not run "make" in the above tests. Use "$$MAKE" instead.' 1>&2; \
153 ## Tests should never call autoconf directly.
154 @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[ ]*autoconf'; then \
155 echo 'Do not run "autoconf" in the above tests. Use "$$AUTOCONF" instead.' 1>&2; \
158 ## Tests should never call automake directly.
159 @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[ ]*automake'; then \
160 echo 'Do not run "automake" in the above tests. Use "$$AUTOMAKE" instead.' 1>&2; \
163 ## Tests should never call aclocal directly.
164 @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[ ]*aclocal'; then \
165 echo 'Do not run "aclocal" in the above tests. Use "$$ACLOCAL" instead.' 1>&2; \
168 ## Tests should never call perl directly.
169 @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[ ]*perl'; then \
170 echo 'Do not run "perl" in the above tests. Use "$$PERL" instead.' 1>&2; \
173 ## Overriding a Makefile macro on the command line is not portable when
174 ## recursive targets are used. Better use an envvar. SHELL is an exception,
175 ## POSIX says it can't come from the environment.
176 @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(srcdir)/tests/*.test; then \
177 echo 'Rewrite "$$MAKE foo=bar SHELL=/bin/sh" as "foo=bar $$MAKE -e SHELL=/bin/sh"' 1>&2; \
178 echo ' in the above lines, it is more portable.' 1>&2; \
181 @if grep -v SHELL $(srcdir)/tests/*.test | grep '\$$MAKE .*=' ; then \
182 echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e SHELL=/bin/sh" in the above lines,' 1>&2; \
183 echo 'it is more portable.' 1>&2; \
186 ## On NetBSD (1.5) and OSF, the $SHELL variable is still inherited from
188 @if grep '$$MAKE.*-e' $(srcdir)/tests/*.test | grep -v '-e.*SHELL' ; then \
189 echo 'Always overwrite SHELL when using "$$MAKE -e".' 1>&2; \
190 echo 'Use "$$MAKE -e SHELL=/bin/sh" in the above lines.' 1>&2; \
193 @if grep 'SHELL=.*\$$MAKE' $(srcdir)/tests/*.test; then \
194 echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=/bin/sh" in' 1>&2; \
195 echo 'the above lines.' 1>&2; \
198 ## Never use `sleep 1' to create files with different timestamps.
199 ## Use `sleep 2' instead. Some filesystems (e.g., Windows') have only
200 ## a 2sec resolution.
201 @if grep -E '\bsleep +1\b' $(srcdir)/tests/*.test; then \
202 echo 'Do not use "sleep 1" in the above tests. Use "sleep 2" instead.' 1>&2; \
207 # Tag before making distribution. Also, don't make a distribution if
208 # checks fail. Also, make sure the NEWS file is up-to-date.
209 cvs-dist: maintainer-check distcheck
210 @if sed 1q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \
211 echo "NEWS not updated; not releasing" 1>&2; \
214 cd $(srcdir) && cvs -q tag `echo "Release-$(VERSION)" | sed 's/\./-/g'`
218 thisver=`echo "Release-$(VERSION)" | sed 's/\./-/g'`; \
219 if test -z "$$OLDVERSION"; then \
220 prevno=`echo "$(VERSION)" - 0.01 | bc | sed 's/^\./0./'`; \
221 else prevno="$$OLDVERSION"; fi; \
222 prevver=Release-`echo $$prevno | sed 's/\./-/g'`; \
223 cvs -f rdiff -c -r $$prevver -r $$thisver $(PACKAGE) \
224 > $(PACKAGE)-$$prevno-$(VERSION).diff
226 ## Check our path lengths.
229 ## FIXME there's got to be a better way! pathchk should take the list
230 ## of files on stdin, at least.
231 find . -print | xargs pathchk -p); \
233 chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir); \
236 ## Program to use to fetch files.
239 ## Files that we fetch and which we compare against.
240 ## FIXME should be a lot more here
241 FETCHFILES = config.guess config.sub texinfo.tex Automake/XFile.pm INSTALL
243 ## Fetch the latest versions of files we care about.
245 rm -rf Fetchdir > /dev/null 2>&1
246 mkdir Fetchdir; mkdir Fetchdir/Automake
247 ## If a get fails then that is a problem.
249 $(WGET) ftp://ftp.gnu.org/gnu/config/config.guess; \
250 $(WGET) ftp://ftp.gnu.org/gnu/config/config.sub; \
251 $(WGET) ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex; \
252 $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/autoconf/autoconf/lib/Autom4te/XFile.pm?content-type=text/plain -O Automake/XFile.pm; \
253 $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/autoconf/autoconf/INSTALL?content-type=text/plain -O INSTALL)
254 perl -pi -e 's/Autom4te::/Automake::/g' Fetchdir/Automake/XFile.pm
255 ## Don't exit after test because we want to give as many errors as
257 @stat=0; for file in $(FETCHFILES); do \
258 if diff -u $(srcdir)/lib/$$file Fetchdir/$$file \
259 >>Fetchdir/update.patch 2>/dev/null; then :; \
262 echo "Updating $(srcdir)/lib/$$file..."; \
263 cp Fetchdir/$$file $(srcdir)/lib/$$file; \
267 echo "See Fetchdir/update.patch for a log of the changes."; \