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)
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 = . 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 \
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.
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; \
51 @for p in $(bin_SCRIPTS); do \
52 f="`echo $$p|sed '$(transform)'`"; \
53 fv="$$f-$(APIVERSION)"; \
54 rm -f $(DESTDIR)$(bindir)/$$fv; \
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 -e 's,[@]datadir[@],$(datadir),g' -e 's,[@]PERL[@],$(PERL),g' \
62 -e 's,[@]configure_input[@],@configure_input@,g' \
63 -e 's,[@]PACKAGE[@],$(PACKAGE),g' \
64 -e 's,[@]VERSION[@],$(VERSION),g' \
65 -e 's,[@]APIVERSION[@],$(APIVERSION),g' \
66 -e 's,[@]SHELL[@],$(SHELL),g'
68 automake: automake.in Makefile
69 $(do_subst) < $(srcdir)/automake.in > automake
72 aclocal: aclocal.in Makefile
73 $(do_subst) < $(srcdir)/aclocal.in > aclocal
76 ## The master location for INSTALL is lib/INSTALL.
77 ## This is where `make fetch' will install new versions.
78 ## Make sure we also update this copy.
82 ################################################################
84 ## Everything past here is useful to the maintainer, but probably not
88 # Some simple checks, and then ordinary check. These are only really
89 # guaranteed to work on my machine.
90 maintainer-check: automake aclocal
91 ## This check avoids accidental configure substitutions in the source.
92 ## There are exactly 5 lines that should be modified. This works out
93 ## to 20 lines of diffs.
94 @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 20; then \
95 echo "found too many diffs between automake.in and automake"; 1>&2; \
96 diff -c $(srcdir)/automake.in automake; \
99 ## Syntax check with default Perl (on my machine, Perl 5).
100 perllibdir=./lib:$(srcdir)/lib $(PERL) -c -w automake
101 perllibdir=./lib:$(srcdir)/lib $(PERL) -c -w aclocal
102 ## expect no instances of '${...}'. However, $${...} is ok, since that
103 ## is a shell construct, not a Makefile construct.
104 @if grep -F '$${' $(srcdir)/lib/am/[a-z]*.am | \
105 grep -F -v '$$$$'; then \
106 echo "Found too many uses of '\$${' in the lines above." 1>&2; \
109 ## Make sure `rm' is called with `-f'.
110 @if grep -v '^#' $(srcdir)/lib/am/[a-z]*.am $(srcdir)/tests/*.test | \
111 grep -E '\<rm ([^-]|\-[^f ]*\>)'; then \
112 echo "Suspicious 'rm' invocation." 1>&2; \
115 ## Never use something like `for file in $(FILES)', this doesn't work
116 ## if FILES is empty or if it contains shell meta characters (e.g. $ is
117 ## commonly used in Java filenames).
118 @if grep 'for .* in \$$(' $(srcdir)/lib/am/[a-z]*.am; then \
119 echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
122 ## Make sure all invocations of mkinstalldirs are correct.
123 @if grep -n 'mkinstalldirs' $(srcdir)/lib/am/[a-z]*.am | \
124 grep -F -v '$$(mkinstalldirs)'; then \
125 echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
128 ## We never want to use "undef", only "delete", but for $/.
129 @if grep -n -w 'undef ' $(srcdir)/automake.in | \
130 grep -F -v 'undef $$/'; then \
131 echo "Found undef in automake.in; use delete instead" 1>&2; \
134 ## We never want split (/ /,...), only split (' ', ...).
135 @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
136 echo "Found bad split in the lines above." 1>&2; \
139 ## Look for cd within backquotes
140 @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in \
141 $(srcdir)/lib/am/*.am; then \
142 echo "Consider using $$$$(am__cd) in the line above." 1>&2; \
145 ## Using @_ in a scalar context is most probably a programming error.
146 @if grep -Hn '[^) ] *= *@_' $(srcdir)/automake.in; then \
147 echo "Using @_ in a scalar context in the lines above." 1>&2; \
150 ## Forbid using parens with `local' to ease counting.
151 @if grep '^[ \t]*local *(' $(srcdir)/automake.in; then \
152 echo "Don't use \`local' with parens: use several \`local' above." >&2; \
155 ## Allow only `local $_' in Automake.
156 @if grep -v '^[ \t]*local \$$_;' $(srcdir)/automake.in | \
157 grep '^[ \t]*local [^*]'; then \
158 echo "Please avoid \`local'." 1>&2; \
161 ## Don't let AMDEP_TRUE substitution appear in automake.in.
162 @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
163 echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
166 ## Tests should never call make directly.
167 @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[ ]*make'; then \
168 echo 'Do not run "make" in the above tests. Use "$$MAKE" instead.' 1>&2; \
171 ## Tests should never call autoconf directly.
172 @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[ ]*autoconf'; then \
173 echo 'Do not run "autoconf" in the above tests. Use "$$AUTOCONF" instead.' 1>&2; \
176 ## Tests should never call autoupdate directly.
177 @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[ ]*autoupdate'; then \
178 echo 'Do not run "autoupdate" in the above tests. Use "$$AUTOUPDATE" instead.' 1>&2; \
181 ## Tests should never call automake directly.
182 @if grep -v '^#' $(srcdir)/tests/*.test | grep -E ':[ ]*automake([^:]|$$)'; then \
183 echo 'Do not run "automake" in the above tests. Use "$$AUTOMAKE" instead.' 1>&2; \
186 ## Use AUTOMAKE_fails when appropriate
187 @if grep -v '^#' $(srcdir)/tests/*.test | grep '\$$AUTOMAKE.*&&.*exit'; then \
188 echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2; \
191 ## Tests should never call aclocal directly.
192 @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[ ]*aclocal'; then \
193 echo 'Do not run "aclocal" in the above tests. Use "$$ACLOCAL" instead.' 1>&2; \
196 ## Tests should never call perl directly.
197 @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[ ]*perl'; then \
198 echo 'Do not run "perl" in the above tests. Use "$$PERL" instead.' 1>&2; \
201 ## Overriding a Makefile macro on the command line is not portable when
202 ## recursive targets are used. Better use an envvar. SHELL is an exception,
203 ## POSIX says it can't come from the environment.
204 @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(srcdir)/tests/*.test; then \
205 echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
206 echo ' in the above lines, it is more portable.' 1>&2; \
209 @if grep -v SHELL $(srcdir)/tests/*.test | grep '\$$MAKE .*=' ; then \
210 echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
211 echo 'it is more portable.' 1>&2; \
214 @if grep 'SHELL=.*\$$MAKE' $(srcdir)/tests/*.test; then \
215 echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 1>&2; \
216 echo 'the above lines.' 1>&2; \
219 ## Never use `sleep 1' to create files with different timestamps.
220 ## Use `$sleep' instead. Some filesystems (e.g., Windows') have only
221 ## a 2sec resolution.
222 @if grep -E '\bsleep +[12345]\b' $(srcdir)/tests/*.test; then \
223 echo 'Do not use "sleep x" in the above tests. Use "$$sleep" instead.' 1>&2; \
226 ## fgrep and egrep are not required by POSIX.
227 @if grep -E '\b[ef]grep\b' $(srcdir)/tests/*.test ; then \
228 echo 'Do not use egrep or fgrep in test cases. Use $$FGREP or $$EGREP.' 1>&2; \
231 @if grep -E '\b[ef]grep\b' $(srcdir)/lib/am/*.am $(srcdir)/m4/*.m4; then \
232 echo 'Do not use egrep or fgrep in the above files, they are not portable.' 1>&2; \
235 ## Try to make sure all @...@ substitutions are covered by our
236 ## substitution rule.
237 @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
238 echo "Unresolved @...@ substitution in aclocal" 1>&2; \
241 @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' automake | wc -l` -ne 0; then \
242 echo "Unresolved @...@ substitution in automake" 1>&2; \
247 cvs-dist: maintainer-check
248 ## Make sure clcommit exists (we use it at the end of cvs-dist).
249 @if (clcommit --version)>/dev/null 2>/dev/null; then :; else \
250 echo "Get clcommit from module cvs-utils on Savannah."; \
253 ## Make sure the NEWS file is up-to-date.
254 @if sed 1q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \
255 echo "NEWS not updated; not releasing" 1>&2; \
258 ## Build the distribution
260 ## Finally, if anything was successful, commit the last changes and tag
261 ## the release in the repository. We don't use RCS keywords so it's OK
262 ## to distribute the files before they were committed.
263 cd $(srcdir) && clcommit && \
264 cvs -q tag -c `echo "Release-$(VERSION)" | sed 's/\./-/g'`
267 thisver=`echo "Release-$(VERSION)" | sed 's/\./-/g'`; \
268 if test -z "$$OLDVERSION"; then \
269 prevno=`echo "$(VERSION)" - 0.01 | bc | sed 's/^\./0./'`; \
270 else prevno="$$OLDVERSION"; fi; \
271 prevver=Release-`echo $$prevno | sed 's/\./-/g'`; \
272 cvs -f rdiff -c -r $$prevver -r $$thisver $(PACKAGE) \
273 > $(PACKAGE)-$$prevno-$(VERSION).diff
275 ## Check our path lengths.
278 ## FIXME there's got to be a better way! pathchk should take the list
279 ## of files on stdin, at least.
280 find . -print | xargs pathchk -p); \
282 chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir); \
285 ## Program to use to fetch files.
287 WGETSGO = $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~
289 ## Files that we fetch and which we compare against.
290 ## FIXME should be a lot more here
299 ## Fetch the latest versions of files we care about.
301 rm -rf Fetchdir > /dev/null 2>&1
303 ## If a get fails then that is a problem.
305 $(WGETSGO)/config/config/config.guess; \
306 $(WGETSGO)/config/config/config.sub; \
307 $(WGETSGO)/texinfo/texinfo/doc/texinfo.tex; \
308 $(WGETSGO)/autoconf/autoconf/INSTALL; \
309 $(WGETSGO)/gcc/gcc/config-ml.in; \
310 $(WGETSGO)/gcc/gcc/symlink-tree)
311 ## Don't exit after test because we want to give as many errors as
313 @stat=0; for file in $(FETCHFILES); do \
314 if diff -u $(srcdir)/lib/$$file Fetchdir/$$file \
315 >>Fetchdir/update.patch 2>/dev/null; then :; \
318 echo "Updating $(srcdir)/lib/$$file..."; \
319 cp Fetchdir/$$file $(srcdir)/lib/$$file; \
323 echo "See Fetchdir/update.patch for a log of the changes."; \