Don't invoke mkdir if the directories all already exist.
[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 AUTOMAKE_OPTIONS = 1.4 dist-bzip2
23
24 ## We need `.' in SUBDIRS because we want `check' to build `.' before
25 ## tests.
26 SUBDIRS = . m4 lib tests
27
28 bin_SCRIPTS = automake aclocal
29 info_TEXINFOS = automake.texi
30
31
32 TAGS_FILES = automake.in aclocal.in
33
34 # The following requires a fixed version of the Emacs 19.30 etags.
35 ETAGS_ARGS = --lang=none \
36  --regex='/^@node[ \t]+\([^,]+\)/\1/' $(srcdir)/automake.texi
37 TAGS_DEPENDENCIES = automake.texi
38
39 EXTRA_DIST = ChangeLog.1996 ChangeLog.1998 ChangeLog.2000
40
41 ################################################################
42 ##
43 ## Everything past here is useful to the maintainer, but probably not
44 ## to anybody else
45 ##
46
47 # Some simple checks, and then ordinary check.  These are only really
48 # guaranteed to work on my machine.
49 maintainer-check: automake aclocal
50 ## This check avoids accidental configure substitutions in the source.
51 ## There are exactly 7 lines that should be modified.  This works out
52 ## to 22 lines of diffs.
53         @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 28; then \
54           echo "found too many diffs between automake.in and automake"; 1>&2; \
55           diff -c $(srcdir)/automake.in automake; \
56           exit 1; \
57         fi
58 ## Syntax check with default Perl (on my machine, Perl 5).
59         perllibdir=$(srcdir)/lib $(PERL) -c -w automake
60         perllibdir=$(srcdir)/lib $(PERL) -c -w aclocal
61 ## expect no instances of '${...}'.  However, $${...} is ok, since that
62 ## is a shell construct, not a Makefile construct.
63 ## The backslash in `$${' is needed for some versions of bash.
64         @if fgrep '\$${' $(srcdir)/lib/am/[a-z]*.am | \
65                fgrep -v '$$$$'; then \
66           echo "Found too many uses of '\$${' in the lines above." 1>&2; \
67           exit 1;                               \
68         else :; fi
69 ## Make sure `rm' is called with `-f'.
70         @if egrep '\<rm ([^-]|\-[^f ]*\>)' \
71                   $(srcdir)/lib/am/[a-z]*.am $(srcdir)/tests/*.test | \
72               fgrep -v '##'; then \
73           echo "Suspicious 'rm' invocation." 1>&2; \
74           exit 1;                               \
75         else :; fi
76 ## Make sure all invocations of mkinstalldirs are correct.
77         @if fgrep -n 'mkinstalldirs' $(srcdir)/lib/am/[a-z]*.am | \
78               fgrep -v '$$(mkinstalldirs)'; then \
79           echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
80           exit 1; \
81         else :; fi
82 ## We never want to use "undef", only "delete", but for $/.
83         @if grep -n -w 'undef ' $(srcdir)/automake.in | \
84               fgrep -v 'undef $$/'; then \
85           echo "Found undef in automake.in; use delete instead" 1>&2; \
86           exit 1; \
87         fi
88 ## We never want split (/ /,...), only split (' ', ...).
89         @if fgrep -n 'split (/ /' $(srcdir)/automake.in; then \
90           echo "Found bad split in the lines above." 1>&2; \
91           exit 1; \
92         fi
93 ## Look for cd within backquotes without CDPATH=:
94         @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in \
95               $(srcdir)/lib/am/*.am $(srcdir)/m4/*.m4; then \
96           echo "Consider setting CDPATH in the lines above" 1>&2; \
97           exit 1; \
98         fi
99 ## Using @_ in a scalar context is most probably a programming error.
100         @if grep -Hn '[^) ] *= *@_' $(srcdir)/automake.in; then \
101           echo "Using @_ in a scalar context in the lines above." 1>&2; \
102           exit 1; \
103         fi
104 ## Forbid using parens with `local' to ease counting.
105         @if grep '^[ \t]*local *(' $(srcdir)/automake.in; then \
106           echo "Don't use \`local' with parens: use several \`local' above." >&2; \
107           exit 1; \
108         fi
109 ## Up to now we manage to limit to 1 use of local.
110         @locals=`grep -c '^[ \t]*local [^*]' $(srcdir)/automake.in`; \
111         case $$locals in \
112           [0] ) \
113             echo "Wow, congrats!  There are no \`local' now!." >&2; \
114             echo "Please update Makefile.am (maintainer-check)." >&2; \
115             exit 1; \
116           ;; \
117           1 ) ;; \
118           * ) \
119             echo "Too many \`local'!  Are you sure you need $$locals of them?" >&2; \
120             echo "Up to now 1 was enough." >&2; \
121             exit 1; \
122           ;; \
123         esac
124 ## Don't let AMDEP_TRUE substitution appear in automake.in.
125         @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
126           echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
127           exit 1; \
128         fi
129
130 # Tag before making distribution.  Also, don't make a distribution if
131 # checks fail.  Also, make sure the NEWS file is up-to-date.
132 cvs-dist: maintainer-check distcheck
133         @if sed 1q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \
134           echo "NEWS not updated; not releasing" 1>&2; \
135           exit 1;                               \
136         fi
137         cd $(srcdir) && cvs -q tag `echo "Release-$(VERSION)" | sed 's/\./-/g'`
138         $(MAKE) dist
139
140 cvs-diff:
141         thisver=`echo "Release-$(VERSION)" | sed 's/\./-/g'`; \
142         if test -z "$$OLDVERSION"; then \
143           prevno=`echo "$(VERSION)" - 0.01 | bc | sed 's/^\./0./'`; \
144         else prevno="$$OLDVERSION"; fi; \
145         prevver=Release-`echo $$prevno | sed 's/\./-/g'`; \
146         cvs -f rdiff -c -r $$prevver -r $$thisver $(PACKAGE) \
147             > $(PACKAGE)-$$prevno-$(VERSION).diff
148
149 ## Check our path lengths.
150 path-check: distdir
151         (cd $(distdir) && \
152 ## FIXME there's got to be a better way!  pathchk should take the list
153 ## of files on stdin, at least.
154           find . -print | xargs pathchk -p); \
155           status=$$?; \
156           chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir); \
157           exit $$status
158
159 ## Program to use to fetch files.
160 WGET = wget
161
162 ## Files that we fetch and which we compare against.
163 ## FIXME should be a lot more here
164 ## Sadly we can't fetch ansi2knr.1 from the same location :-(
165 FETCHFILES = config.guess config.sub ansi2knr.c
166
167 ## Fetch the latest versions of files we care about.
168 fetch:
169         rm -rf Fetchdir > /dev/null 2>&1
170         mkdir Fetchdir
171 ## If a get fails then that is a problem.
172         (cd Fetchdir && \
173         $(WGET) ftp://ftp.gnu.org/gnu/config/config.guess; \
174         $(WGET) ftp://ftp.gnu.org/gnu/config/config.sub; \
175         $(WGET) ftp://ftp.cs.wisc.edu/ghost/ansi2knr.c)
176 ## Don't exit after test because we want to give as many errors as
177 ## possible.
178         @stat=0; for file in $(FETCHFILES); do \
179           if diff $(srcdir)/lib/$$file Fetchdir/$$file > /dev/null 2>&1; then :; \
180           else \
181             stat=1; \
182             echo "install Fetchdir/$$file into srcdir and commit"; \
183           fi; \
184         done; exit $$stat