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