* lib/texinfo.tex: New upstream version.
[automake.git] / Makefile.am
blobec2e4edacef790bdbb30896e0ffa94b6a1e9b346
1 ## Process this file with automake to create Makefile.in
3 ## Makefile for Automake.
5 ## Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003
6 ## Free 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)
11 ## any later version.
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
21 ## 02111-1307, USA.
23 ## We need `.' in SUBDIRS because we want `check' to build `.' before
24 ## tests.
25 SUBDIRS = . m4 lib tests
27 bin_SCRIPTS = automake aclocal
28 info_TEXINFOS = automake.texi
30 CLEANFILES = $(bin_SCRIPTS)
31 AUTOMAKESOURCES = automake.in aclocal.in
33 TAGS_FILES = $(AUTOMAKESOURCES)
35 # The following requires a fixed version of the Emacs 19.30 etags.
36 ETAGS_ARGS = --lang=none \
37  --regex='/^@node[ \t]+\([^,]+\)/\1/' $(srcdir)/automake.texi
38 TAGS_DEPENDENCIES = automake.texi
40 EXTRA_DIST = ChangeLog.96 ChangeLog.98 ChangeLog.00 ChangeLog.01 \
41   $(AUTOMAKESOURCES)
43 ## Make versioned links.  We only run the transform on the root name;
44 ## then we make a versioned link with the transformed base name.  This
45 ## seemed like the most reasonable approach.
46 install-exec-hook:
47         @$(POST_INSTALL)
48         @for p in $(bin_SCRIPTS); do \
49           f="`echo $$p|sed '$(transform)'`"; \
50           fv="$$f-$(APIVERSION)"; \
51           rm -f $(DESTDIR)$(bindir)/$$fv; \
52           echo " $(LN) $(DESTDIR)$(bindir)/$$f $(DESTDIR)$(bindir)/$$fv"; \
53           $(LN) $(DESTDIR)$(bindir)/$$f $(DESTDIR)$(bindir)/$$fv; \
54         done
56 uninstall-hook:
57         @for p in $(bin_SCRIPTS); do \
58           f="`echo $$p|sed '$(transform)'`"; \
59           fv="$$f-$(APIVERSION)"; \
60           rm -f $(DESTDIR)$(bindir)/$$fv; \
61         done
64 ## We can't use configure to do the substitution here; we must do it
65 ## by hand.  We use a funny notation here to avoid configure
66 ## substitutions in our text.
67 do_subst = sed -e 's,[@]datadir[@],$(datadir),g' -e 's,[@]PERL[@],$(PERL),g' \
68             -e 's,[@]configure_input[@],@configure_input@,g' \
69             -e 's,[@]PACKAGE[@],$(PACKAGE),g' \
70             -e 's,[@]VERSION[@],$(VERSION),g' \
71             -e 's,[@]APIVERSION[@],$(APIVERSION),g' \
72             -e 's,[@]SHELL[@],$(SHELL),g'
74 automake: automake.in Makefile
75         $(do_subst) < $(srcdir)/automake.in > automake
76         chmod +x automake
78 aclocal: aclocal.in Makefile
79         $(do_subst) < $(srcdir)/aclocal.in > aclocal
80         chmod +x aclocal
82 ## The master location for INSTALL is lib/INSTALL.
83 ## This is where `make fetch' will install new versions.
84 ## Make sure we also update this copy.
85 INSTALL: lib/INSTALL
86         cp lib/INSTALL $@
88 ################################################################
90 ## Everything past here is useful to the maintainer, but probably not
91 ## to anybody else
94 # Some simple checks, and then ordinary check.  These are only really
95 # guaranteed to work on my machine.
96 maintainer-check: automake aclocal
97 ## This check avoids accidental configure substitutions in the source.
98 ## There are exactly 8 lines that should be modified.  This works out
99 ## to 28 lines of diffs.
100         @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 28; then \
101           echo "found too many diffs between automake.in and automake"; 1>&2; \
102           diff -c $(srcdir)/automake.in automake; \
103           exit 1; \
104         fi
105 ## Syntax check with default Perl (on my machine, Perl 5).
106         perllibdir=$(srcdir)/lib $(PERL) -c -w automake
107         perllibdir=$(srcdir)/lib $(PERL) -c -w aclocal
108 ## expect no instances of '${...}'.  However, $${...} is ok, since that
109 ## is a shell construct, not a Makefile construct.
110         @if grep -F '$${' $(srcdir)/lib/am/[a-z]*.am | \
111                grep -F -v '$$$$'; then \
112           echo "Found too many uses of '\$${' in the lines above." 1>&2; \
113           exit 1;                               \
114         else :; fi
115 ## Make sure `rm' is called with `-f'.
116         @if grep -E '\<rm ([^-]|\-[^f ]*\>)' \
117                   $(srcdir)/lib/am/[a-z]*.am $(srcdir)/tests/*.test | \
118               grep -v '##'; then \
119           echo "Suspicious 'rm' invocation." 1>&2; \
120           exit 1;                               \
121         else :; fi
122 ## Never use something like `for file in $(FILES)', this doesn't work
123 ## if FILES is empty or if it contains shell meta characters (e.g. $ is
124 ## commonly used in Java filenames).
125         @if grep 'for .* in \$$(' $(srcdir)/lib/am/[a-z]*.am; then \
126           echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
127           exit 1; \
128         else :; fi
129 ## Make sure all invocations of mkinstalldirs are correct.
130         @if grep -n 'mkinstalldirs' $(srcdir)/lib/am/[a-z]*.am | \
131               grep -F -v '$$(mkinstalldirs)'; then \
132           echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
133           exit 1; \
134         else :; fi
135 ## We never want to use "undef", only "delete", but for $/.
136         @if grep -n -w 'undef ' $(srcdir)/automake.in | \
137               grep -F -v 'undef $$/'; then \
138           echo "Found undef in automake.in; use delete instead" 1>&2; \
139           exit 1; \
140         fi
141 ## We never want split (/ /,...), only split (' ', ...).
142         @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
143           echo "Found bad split in the lines above." 1>&2; \
144           exit 1; \
145         fi
146 ## Look for cd within backquotes
147         @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in \
148               $(srcdir)/lib/am/*.am; then \
149           echo "Consider using $$$$(am__cd) in the line above." 1>&2; \
150           exit 1; \
151         fi
152 ## Using @_ in a scalar context is most probably a programming error.
153         @if grep -Hn '[^) ] *= *@_' $(srcdir)/automake.in; then \
154           echo "Using @_ in a scalar context in the lines above." 1>&2; \
155           exit 1; \
156         fi
157 ## Forbid using parens with `local' to ease counting.
158         @if grep '^[ \t]*local *(' $(srcdir)/automake.in; then \
159           echo "Don't use \`local' with parens: use several \`local' above." >&2; \
160           exit 1; \
161         fi
162 ## Up to now we manage to limit to 1 use of local, but for `local $_;'.
163         @locals=`grep -v '^[ \t]*local \$$_;' $(srcdir)/automake.in | \
164                 grep -c '^[ \t]*local [^*]'`; \
165         case $$locals in \
166           [0] ) \
167             echo "Wow, congrats!  There are no \`local' now!." >&2; \
168             echo "Please update Makefile.am (maintainer-check)." >&2; \
169             exit 1; \
170           ;; \
171           1 ) ;; \
172           * ) \
173             echo "Too many \`local'!  Are you sure you need $$locals of them?" >&2; \
174             echo "Up to now 1 was enough." >&2; \
175             exit 1; \
176           ;; \
177         esac
178 ## Don't let AMDEP_TRUE substitution appear in automake.in.
179         @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
180           echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
181           exit 1; \
182         fi
183 ## Tests should never call make directly.
184         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*make'; then \
185           echo 'Do not run "make" in the above tests.  Use "$$MAKE" instead.' 1>&2; \
186           exit 1; \
187         fi
188 ## Tests should never call autoconf directly.
189         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoconf'; then \
190           echo 'Do not run "autoconf" in the above tests.  Use "$$AUTOCONF" instead.' 1>&2; \
191           exit 1; \
192         fi
193 ## Tests should never call autoupdate directly.
194         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoupdate'; then \
195           echo 'Do not run "autoupdate" in the above tests.  Use "$$AUTOUPDATE" instead.' 1>&2; \
196           exit 1; \
197         fi
198 ## Tests should never call automake directly.
199         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*automake'; then \
200           echo 'Do not run "automake" in the above tests.  Use "$$AUTOMAKE" instead.' 1>&2;  \
201           exit 1; \
202         fi
203 ## Tests should never call aclocal directly.
204         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*aclocal'; then \
205           echo 'Do not run "aclocal" in the above tests.  Use "$$ACLOCAL" instead.' 1>&2;  \
206           exit 1; \
207         fi
208 ## Tests should never call perl directly.
209         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*perl'; then \
210           echo 'Do not run "perl" in the above tests.  Use "$$PERL" instead.' 1>&2; \
211           exit 1; \
212         fi
213 ## Overriding a Makefile macro on the command line is not portable when
214 ## recursive targets are used.  Better use an envvar.  SHELL is an exception,
215 ## POSIX says it can't come from the environment.
216         @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(srcdir)/tests/*.test; then \
217           echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
218           echo ' in the above lines, it is more portable.' 1>&2; \
219           exit 1; \
220         fi
221         @if grep -v SHELL $(srcdir)/tests/*.test | grep '\$$MAKE .*=' ; then \
222           echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
223           echo 'it is more portable.' 1>&2; \
224           exit 1; \
225         fi
226         @if grep 'SHELL=.*\$$MAKE' $(srcdir)/tests/*.test; then \
227           echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 1>&2; \
228           echo 'the above lines.' 1>&2; \
229           exit 1; \
230         fi
231 ## Never use `sleep 1' to create files with different timestamps.
232 ## Use `$sleep' instead.  Some filesystems (e.g., Windows') have only
233 ## a 2sec resolution.
234         @if grep -E '\bsleep +[12345]\b' $(srcdir)/tests/*.test; then \
235           echo 'Do not use "sleep x" in the above tests.  Use "$$sleep" instead.' 1>&2; \
236           exit 1; \
237         fi
238 ## fgrep and egrep are not required by POSIX.
239         @if grep -E '\b[ef]grep\b' $(srcdir)/tests/*.test ; then \
240           echo 'Do not use egrep or fgrep in test cases.  Use $$FGREP or $$EGREP.' 1>&2; \
241           exit 1; \
242         fi
243         @if grep -E '\b[ef]grep\b' $(srcdir)/lib/am/*.am $(srcdir)/m4/*.m4; then \
244           echo 'Do not use egrep or fgrep in the above files, they are not portable.' 1>&2; \
245           exit 1; \
246         fi
247 ## Try to make sure all @...@ substitutions are covered by our
248 ## substitution rule.
249         @if test `grep -E '@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
250           echo "Unresolved @...@ substitution in aclocal" 1>&2; \
251           exit 1; \
252         fi
253 ## In automake there are a few valid ones.
254         @if test `grep -E '@[A-Za-z_0-9]+@' automake | wc -l` -ne 4; then \
255           echo "Unresolved @...@ substitution in aclocal" 1>&2; \
256           exit 1; \
257         fi
260 # Tag before making distribution.  Also, don't make a distribution if
261 # checks fail.  Also, make sure the NEWS file is up-to-date.
262 cvs-dist: maintainer-check distcheck
263         @if sed 1q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \
264           echo "NEWS not updated; not releasing" 1>&2; \
265           exit 1;                               \
266         fi
267         cd $(srcdir) && cvs -q tag `echo "Release-$(VERSION)" | sed 's/\./-/g'`
268         $(MAKE) dist
270 cvs-diff:
271         thisver=`echo "Release-$(VERSION)" | sed 's/\./-/g'`; \
272         if test -z "$$OLDVERSION"; then \
273           prevno=`echo "$(VERSION)" - 0.01 | bc | sed 's/^\./0./'`; \
274         else prevno="$$OLDVERSION"; fi; \
275         prevver=Release-`echo $$prevno | sed 's/\./-/g'`; \
276         cvs -f rdiff -c -r $$prevver -r $$thisver $(PACKAGE) \
277             > $(PACKAGE)-$$prevno-$(VERSION).diff
279 ## Check our path lengths.
280 path-check: distdir
281         (cd $(distdir) && \
282 ## FIXME there's got to be a better way!  pathchk should take the list
283 ## of files on stdin, at least.
284           find . -print | xargs pathchk -p); \
285           status=$$?; \
286           chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir); \
287           exit $$status
289 ## Program to use to fetch files.
290 WGET = wget
292 ## Files that we fetch and which we compare against.
293 ## FIXME should be a lot more here
294 FETCHFILES = \
295 Automake/Struct.pm \
296 Automake/XFile.pm \
297 INSTALL \
298 config.guess \
299 config.sub \
300 texinfo.tex
302 ## Fetch the latest versions of files we care about.
303 fetch:
304         rm -rf Fetchdir > /dev/null 2>&1
305         mkdir Fetchdir; mkdir Fetchdir/Automake
306 ## If a get fails then that is a problem.
307         (cd Fetchdir && \
308         $(WGET) ftp://ftp.gnu.org/gnu/config/config.guess; \
309         $(WGET) ftp://ftp.gnu.org/gnu/config/config.sub; \
310         $(WGET) ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex; \
311         $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/autoconf/autoconf/lib/Autom4te/Struct.pm?content-type=text/plain -O Automake/Struct.pm; \
312         $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/autoconf/autoconf/lib/Autom4te/XFile.pm?content-type=text/plain -O Automake/XFile.pm; \
313         $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/autoconf/autoconf/INSTALL?content-type=text/plain -O INSTALL)
314         perl -pi -e 's/Autom4te::/Automake::/g' \
315           Fetchdir/Automake/Struct.pm Fetchdir/Automake/XFile.pm
316 ## Don't exit after test because we want to give as many errors as
317 ## possible.
318         @stat=0; for file in $(FETCHFILES); do \
319           if diff -u $(srcdir)/lib/$$file Fetchdir/$$file \
320                   >>Fetchdir/update.patch 2>/dev/null; then :; \
321           else \
322             stat=1; \
323             echo "Updating $(srcdir)/lib/$$file..."; \
324             cp Fetchdir/$$file $(srcdir)/lib/$$file; \
325           fi; \
326         done; \
327         test $$stat = 1 && \
328           echo "See Fetchdir/update.patch for a log of the changes."; \
329         exit $$stat