* configure.ac, NEWS: Bump version to 1.8.0b.
[automake.git] / Makefile.am
blobd2feb6965ebeeb63ecbdf6ab24d7d181c8e6c8d2
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, 2004
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 = . doc m4 lib tests
27 bin_SCRIPTS = automake aclocal
29 CLEANFILES = $(bin_SCRIPTS)
30 AUTOMAKESOURCES = automake.in aclocal.in
32 TAGS_FILES = $(AUTOMAKESOURCES)
34 EXTRA_DIST = ChangeLog.96 ChangeLog.98 ChangeLog.00 ChangeLog.01 ChangeLog.02 \
35   $(AUTOMAKESOURCES)
37 ## Make versioned links.  We only run the transform on the root name;
38 ## then we make a versioned link with the transformed base name.  This
39 ## seemed like the most reasonable approach.
40 install-exec-hook:
41         @$(POST_INSTALL)
42         @for p in $(bin_SCRIPTS); do \
43           f="`echo $$p|sed '$(transform)'`"; \
44           fv="$$f-$(APIVERSION)"; \
45           rm -f $(DESTDIR)$(bindir)/$$fv; \
46           echo " $(LN) $(DESTDIR)$(bindir)/$$f $(DESTDIR)$(bindir)/$$fv"; \
47           $(LN) $(DESTDIR)$(bindir)/$$f $(DESTDIR)$(bindir)/$$fv; \
48         done
50 uninstall-hook:
51         @for p in $(bin_SCRIPTS); do \
52           f="`echo $$p|sed '$(transform)'`"; \
53           fv="$$f-$(APIVERSION)"; \
54           rm -f $(DESTDIR)$(bindir)/$$fv; \
55         done
58 ## We can't use configure to do the substitution here; we must do it
59 ## by hand.  We use a funny notation here to avoid configure
60 ## substitutions in our text.
61 do_subst = sed \
62   -e 's,[@]APIVERSION[@],$(APIVERSION),g' \
63   -e 's,[@]PACKAGE[@],$(PACKAGE),g' \
64   -e 's,[@]PERL[@],$(PERL),g' \
65   -e 's,[@]SHELL[@],$(SHELL),g' \
66   -e 's,[@]VERSION[@],$(VERSION),g' \
67   -e 's,[@]configure_input[@],Generated from $@.in; do not edit by hand.,g' \
68   -e 's,[@]datadir[@],$(datadir),g'
70 ## These files depend on Makefile so they are rebuilt if $(VERSION),
71 ## $(datadir) or other do_subst'ituted variables change.
72 ## Use chmod a-w to prevent people from editing the wrong file by accident.
73 automake: automake.in Makefile
74         rm -f $@ $@.tmp
75         $(do_subst) $(srcdir)/automake.in >$@.tmp
76         chmod +x $@.tmp
77         chmod a-w $@.tmp
78         mv -f $@.tmp $@
80 aclocal: aclocal.in Makefile
81         rm -f $@ $@.tmp
82         $(do_subst) $(srcdir)/aclocal.in >$@.tmp
83         chmod +x $@.tmp
84         chmod a-w $@.tmp
85         mv -f $@.tmp $@
87 ## The master location for INSTALL is lib/INSTALL.
88 ## This is where `make fetch' will install new versions.
89 ## Make sure we also update this copy.
90 INSTALL: lib/INSTALL
91         cp $(srcdir)/lib/INSTALL $@
93 ################################################################
95 ## Everything past here is useful to the maintainer, but probably not
96 ## to anybody else
99 # Some simple checks, and then ordinary check.  These are only really
100 # guaranteed to work on my machine.
101 maintainer-check: automake aclocal
102 ## This check avoids accidental configure substitutions in the source.
103 ## There are exactly 5 lines that should be modified.  This works out
104 ## to 20 lines of diffs.
105         @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 20; then \
106           echo "found too many diffs between automake.in and automake"; 1>&2; \
107           diff -c $(srcdir)/automake.in automake; \
108           exit 1; \
109         fi
110 ## Syntax check with default Perl (on my machine, Perl 5).
111         perllibdir=./lib:$(srcdir)/lib $(PERL) -c -w automake
112         perllibdir=./lib:$(srcdir)/lib $(PERL) -c -w aclocal
113 ## expect no instances of '${...}'.  However, $${...} is ok, since that
114 ## is a shell construct, not a Makefile construct.
115         @if grep -F '$${' $(srcdir)/lib/am/[a-z]*.am | \
116                grep -F -v '$$$$'; then \
117           echo "Found too many uses of '\$${' in the lines above." 1>&2; \
118           exit 1;                               \
119         else :; fi
120 ## Make sure `rm' is called with `-f'.
121         @if grep -v '^#' $(srcdir)/lib/am/[a-z]*.am $(srcdir)/tests/*.test | \
122             grep -E '\<rm ([^-]|\-[^f ]*\>)'; then \
123           echo "Suspicious 'rm' invocation." 1>&2; \
124           exit 1;                               \
125         else :; fi
126 ## Never use something like `for file in $(FILES)', this doesn't work
127 ## if FILES is empty or if it contains shell meta characters (e.g. $ is
128 ## commonly used in Java filenames).
129         @if grep 'for .* in \$$(' $(srcdir)/lib/am/[a-z]*.am; then \
130           echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
131           exit 1; \
132         else :; fi
133 ## Make sure all invocations of mkinstalldirs are correct.
134         @if grep -n 'mkinstalldirs' $(srcdir)/lib/am/[a-z]*.am | \
135               grep -F -v '$$(mkinstalldirs)'; then \
136           echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
137           exit 1; \
138         else :; fi
139 ## We never want to use "undef", only "delete", but for $/.
140         @if grep -n -w 'undef ' $(srcdir)/automake.in | \
141               grep -F -v 'undef $$/'; then \
142           echo "Found undef in automake.in; use delete instead" 1>&2; \
143           exit 1; \
144         fi
145 ## We never want split (/ /,...), only split (' ', ...).
146         @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
147           echo "Found bad split in the lines above." 1>&2; \
148           exit 1; \
149         fi
150 ## Look for cd within backquotes
151         @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in \
152               $(srcdir)/lib/am/*.am; then \
153           echo "Consider using $$$$(am__cd) in the line above." 1>&2; \
154           exit 1; \
155         fi
156 ## Using @_ in a scalar context is most probably a programming error.
157         @if grep -Hn '[^) ] *= *@_' $(srcdir)/automake.in; then \
158           echo "Using @_ in a scalar context in the lines above." 1>&2; \
159           exit 1; \
160         fi
161 ## Forbid using parens with `local' to ease counting.
162         @if grep '^[ \t]*local *(' $(srcdir)/automake.in; then \
163           echo "Don't use \`local' with parens: use several \`local' above." >&2; \
164           exit 1; \
165         fi
166 ## Allow only `local $_' in Automake.
167         @if grep -v '^[ \t]*local \$$_;' $(srcdir)/automake.in | \
168                 grep '^[ \t]*local [^*]'; then \
169           echo "Please avoid \`local'." 1>&2; \
170           exit 1; \
171         fi
172 ## Don't let AMDEP_TRUE substitution appear in automake.in.
173         @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
174           echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
175           exit 1; \
176         fi
177 ## Tests should never call make directly.
178         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*make'; then \
179           echo 'Do not run "make" in the above tests.  Use "$$MAKE" instead.' 1>&2; \
180           exit 1; \
181         fi
182 ## Tests should never call autoconf directly.
183         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoconf'; then \
184           echo 'Do not run "autoconf" in the above tests.  Use "$$AUTOCONF" instead.' 1>&2; \
185           exit 1; \
186         fi
187 ## Tests should never call autoupdate directly.
188         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoupdate'; then \
189           echo 'Do not run "autoupdate" in the above tests.  Use "$$AUTOUPDATE" instead.' 1>&2; \
190           exit 1; \
191         fi
192 ## Tests should never call automake directly.
193         @if grep -v '^#' $(srcdir)/tests/*.test | grep -E ':[   ]*automake([^:]|$$)'; then \
194           echo 'Do not run "automake" in the above tests.  Use "$$AUTOMAKE" instead.' 1>&2;  \
195           exit 1; \
196         fi
197 ## Use AUTOMAKE_fails when appropriate
198         @if grep -v '^#' $(srcdir)/tests/*.test | grep '\$$AUTOMAKE.*&&.*exit'; then \
199           echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2;  \
200           exit 1; \
201         fi
202 ## Tests should never call aclocal directly.
203         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*aclocal'; then \
204           echo 'Do not run "aclocal" in the above tests.  Use "$$ACLOCAL" instead.' 1>&2;  \
205           exit 1; \
206         fi
207 ## Tests should never call perl directly.
208         @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*perl'; then \
209           echo 'Do not run "perl" in the above tests.  Use "$$PERL" instead.' 1>&2; \
210           exit 1; \
211         fi
212 ## Overriding a Makefile macro on the command line is not portable when
213 ## recursive targets are used.  Better use an envvar.  SHELL is an exception,
214 ## POSIX says it can't come from the environment.
215         @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(srcdir)/tests/*.test; then \
216           echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
217           echo ' in the above lines, it is more portable.' 1>&2; \
218           exit 1; \
219         fi
220         @if grep -v SHELL $(srcdir)/tests/*.test | grep '\$$MAKE .*=' ; then \
221           echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
222           echo 'it is more portable.' 1>&2; \
223           exit 1; \
224         fi
225         @if grep 'SHELL=.*\$$MAKE' $(srcdir)/tests/*.test; then \
226           echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 1>&2; \
227           echo 'the above lines.' 1>&2; \
228           exit 1; \
229         fi
230 ## Never use `sleep 1' to create files with different timestamps.
231 ## Use `$sleep' instead.  Some filesystems (e.g., Windows') have only
232 ## a 2sec resolution.
233         @if grep -E '\bsleep +[12345]\b' $(srcdir)/tests/*.test; then \
234           echo 'Do not use "sleep x" in the above tests.  Use "$$sleep" instead.' 1>&2; \
235           exit 1; \
236         fi
237 ## fgrep and egrep are not required by POSIX.
238         @if grep -E '\b[ef]grep\b' $(srcdir)/tests/*.test ; then \
239           echo 'Do not use egrep or fgrep in test cases.  Use $$FGREP or $$EGREP.' 1>&2; \
240           exit 1; \
241         fi
242         @if grep -E '\b[ef]grep\b' $(srcdir)/lib/am/*.am $(srcdir)/m4/*.m4; then \
243           echo 'Do not use egrep or fgrep in the above files, they are not portable.' 1>&2; \
244           exit 1; \
245         fi
246 ## Try to make sure all @...@ substitutions are covered by our
247 ## substitution rule.
248         @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
249           echo "Unresolved @...@ substitution in aclocal" 1>&2; \
250           exit 1; \
251         fi
252         @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' automake | wc -l` -ne 0; then \
253           echo "Unresolved @...@ substitution in automake" 1>&2; \
254           exit 1; \
255         fi
258 cvs-dist: maintainer-check
259 ## Make sure clcommit exists (we use it at the end of cvs-dist).
260         @if (clcommit --version)>/dev/null 2>/dev/null; then :; else \
261           echo "Get clcommit from module cvs-utils on Savannah."; \
262           exit 1; \
263         fi
264 ## Make sure the NEWS file is up-to-date.
265         @if sed 1q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \
266           echo "NEWS not updated; not releasing" 1>&2; \
267           exit 1;                               \
268         fi
269 ## Build the distribution
270         $(MAKE) distcheck
271 ## Finally, if anything was successful, commit the last changes and tag
272 ## the release in the repository.  We don't use RCS keywords so it's OK
273 ## to distribute the files before they were committed.
274         cd $(srcdir) && clcommit && \
275           cvs -q tag -c `echo "Release-$(VERSION)" | sed 's/\./-/g'`
277 cvs-diff:
278         thisver=`echo "Release-$(VERSION)" | sed 's/\./-/g'`; \
279         if test -z "$$OLDVERSION"; then \
280           prevno=`echo "$(VERSION)" - 0.01 | bc | sed 's/^\./0./'`; \
281         else prevno="$$OLDVERSION"; fi; \
282         prevver=Release-`echo $$prevno | sed 's/\./-/g'`; \
283         cvs -f rdiff -c -r $$prevver -r $$thisver $(PACKAGE) \
284             > $(PACKAGE)-$$prevno-$(VERSION).diff
286 ## Check our path lengths.
287 path-check: distdir
288         (cd $(distdir) && \
289 ## FIXME there's got to be a better way!  pathchk should take the list
290 ## of files on stdin, at least.
291           find . -print | xargs pathchk -p); \
292           status=$$?; \
293           chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir); \
294           exit $$status
296 ## Program to use to fetch files.
297 WGET = wget
298 WGETSGO = $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~
300 ## Files that we fetch and which we compare against.
301 ## FIXME should be a lot more here
302 FETCHFILES = \
303 INSTALL \
304 config-ml.in \
305 config.guess \
306 config.sub \
307 symlink-tree \
308 texinfo.tex
310 ## Fetch the latest versions of files we care about.
311 fetch:
312         rm -rf Fetchdir > /dev/null 2>&1
313         mkdir Fetchdir
314 ## If a get fails then that is a problem.
315         (cd Fetchdir && \
316         $(WGETSGO)/config/config/config.guess; \
317         $(WGETSGO)/config/config/config.sub; \
318         $(WGETSGO)/texinfo/texinfo/doc/texinfo.tex; \
319         $(WGETSGO)/autoconf/autoconf/INSTALL; \
320         $(WGETSGO)/gcc/gcc/config-ml.in; \
321         $(WGETSGO)/gcc/gcc/symlink-tree)
322 ## Don't exit after test because we want to give as many errors as
323 ## possible.
324         @stat=0; for file in $(FETCHFILES); do \
325           if diff -u $(srcdir)/lib/$$file Fetchdir/$$file \
326                   >>Fetchdir/update.patch 2>/dev/null; then :; \
327           else \
328             stat=1; \
329             echo "Updating $(srcdir)/lib/$$file..."; \
330             cp Fetchdir/$$file $(srcdir)/lib/$$file; \
331           fi; \
332         done; \
333         test $$stat = 1 && \
334           echo "See Fetchdir/update.patch for a log of the changes."; \
335         exit $$stat