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