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