2002-02-23 Per Bothner <per@bothner.com>
[platform/upstream/automake.git] / Makefile.am
1 ## Process this file with automake to create Makefile.in
2
3 ## Makefile for Automake.
4
5 ## Copyright 1995, 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
6
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.
11
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.
16
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.
21
22 ## We need `.' in SUBDIRS because we want `check' to build `.' before
23 ## tests.
24 SUBDIRS = . m4 lib tests
25
26 bin_SCRIPTS = automake aclocal
27 info_TEXINFOS = automake.texi
28
29
30 TAGS_FILES = automake.in aclocal.in
31
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
36
37 EXTRA_DIST = ChangeLog.1996 ChangeLog.1998 ChangeLog.2000
38
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
51
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
58
59 ################################################################
60 ##
61 ## Everything past here is useful to the maintainer, but probably not
62 ## to anybody else
63 ##
64
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 ## Make sure all invocations of mkinstalldirs are correct.
95         @if fgrep -n 'mkinstalldirs' $(srcdir)/lib/am/[a-z]*.am | \
96               fgrep -v '$$(mkinstalldirs)'; then \
97           echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
98           exit 1; \
99         else :; fi
100 ## We never want to use "undef", only "delete", but for $/.
101         @if grep -n -w 'undef ' $(srcdir)/automake.in | \
102               fgrep -v 'undef $$/'; then \
103           echo "Found undef in automake.in; use delete instead" 1>&2; \
104           exit 1; \
105         fi
106 ## We never want split (/ /,...), only split (' ', ...).
107         @if fgrep -n 'split (/ /' $(srcdir)/automake.in; then \
108           echo "Found bad split in the lines above." 1>&2; \
109           exit 1; \
110         fi
111 ## Look for cd within backquotes
112         @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in \
113               $(srcdir)/lib/am/*.am; then \
114           echo "Consider using $$$$(am__cd) in the line above." 1>&2; \
115           exit 1; \
116         fi
117 ## Using @_ in a scalar context is most probably a programming error.
118         @if grep -Hn '[^) ] *= *@_' $(srcdir)/automake.in; then \
119           echo "Using @_ in a scalar context in the lines above." 1>&2; \
120           exit 1; \
121         fi
122 ## Forbid using parens with `local' to ease counting.
123         @if grep '^[ \t]*local *(' $(srcdir)/automake.in; then \
124           echo "Don't use \`local' with parens: use several \`local' above." >&2; \
125           exit 1; \
126         fi
127 ## Up to now we manage to limit to 1 use of local, but for `local $_;'.
128         @locals=`grep -v '^[ \t]*local \$$_;' $(srcdir)/automake.in | \
129                 grep -c '^[ \t]*local [^*]'`; \
130         case $$locals in \
131           [0] ) \
132             echo "Wow, congrats!  There are no \`local' now!." >&2; \
133             echo "Please update Makefile.am (maintainer-check)." >&2; \
134             exit 1; \
135           ;; \
136           1 ) ;; \
137           * ) \
138             echo "Too many \`local'!  Are you sure you need $$locals of them?" >&2; \
139             echo "Up to now 1 was enough." >&2; \
140             exit 1; \
141           ;; \
142         esac
143 ## Don't let AMDEP_TRUE substitution appear in automake.in.
144         @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
145           echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
146           exit 1; \
147         fi
148
149 # Tag before making distribution.  Also, don't make a distribution if
150 # checks fail.  Also, make sure the NEWS file is up-to-date.
151 cvs-dist: maintainer-check distcheck
152         @if sed 1q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \
153           echo "NEWS not updated; not releasing" 1>&2; \
154           exit 1;                               \
155         fi
156         cd $(srcdir) && cvs -q tag `echo "Release-$(VERSION)" | sed 's/\./-/g'`
157         $(MAKE) dist
158
159 cvs-diff:
160         thisver=`echo "Release-$(VERSION)" | sed 's/\./-/g'`; \
161         if test -z "$$OLDVERSION"; then \
162           prevno=`echo "$(VERSION)" - 0.01 | bc | sed 's/^\./0./'`; \
163         else prevno="$$OLDVERSION"; fi; \
164         prevver=Release-`echo $$prevno | sed 's/\./-/g'`; \
165         cvs -f rdiff -c -r $$prevver -r $$thisver $(PACKAGE) \
166             > $(PACKAGE)-$$prevno-$(VERSION).diff
167
168 ## Check our path lengths.
169 path-check: distdir
170         (cd $(distdir) && \
171 ## FIXME there's got to be a better way!  pathchk should take the list
172 ## of files on stdin, at least.
173           find . -print | xargs pathchk -p); \
174           status=$$?; \
175           chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir); \
176           exit $$status
177
178 ## Program to use to fetch files.
179 WGET = wget
180
181 ## Files that we fetch and which we compare against.
182 ## FIXME should be a lot more here
183 FETCHFILES = config.guess config.sub texinfo.tex Automake/XFile.pm
184
185 ## Fetch the latest versions of files we care about.
186 fetch:
187         rm -rf Fetchdir > /dev/null 2>&1
188         mkdir Fetchdir; mkdir Fetchdir/Automake
189 ## If a get fails then that is a problem.
190         (cd Fetchdir && \
191         $(WGET) ftp://ftp.gnu.org/gnu/config/config.guess; \
192         $(WGET) ftp://ftp.gnu.org/gnu/config/config.sub; \
193         $(WGET) ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex; \
194         $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/autoconf/autoconf/lib/Autom4te/XFile.pm?content-type=text/plain -O Automake/XFile.pm)
195         perl -pi -e 's/Autom4te::/Automake::/g' Fetchdir/Automake/XFile.pm
196 ## Don't exit after test because we want to give as many errors as
197 ## possible.
198         @stat=0; for file in $(FETCHFILES); do \
199           if diff -u $(srcdir)/lib/$$file Fetchdir/$$file \
200                   >>Fetchdir/update.patch 2>/dev/null; then :; \
201           else \
202             stat=1; \
203             echo "Updating $(srcdir)/lib/$$file..."; \
204             cp Fetchdir/$$file $(srcdir)/lib/$$file; \
205           fi; \
206         done; \
207         test $$stat = 1 && \
208           echo "See Fetchdir/update.patch for a log of the changes."; \
209         exit $$stat