* remake.am: Merge into...
[platform/upstream/automake.git] / lib / am / Makefile.am
1 ## Process this file with automake to create Makefile.in
2
3 AUTOMAKE_OPTIONS = gnits 1.4
4 MAINT_CHARSET = latin1
5
6 ## We need `.' in SUBDIRS because we want `check' to build `.' before
7 ## tests.
8 SUBDIRS = . m4 tests
9
10 bin_SCRIPTS = automake aclocal
11 info_TEXINFOS = automake.texi
12
13 amfiles = check.am clean-hdr.am clean-kr.am clean.am comp-vars.am \
14 compile.am configure.am data.am dejagnu.am depend.am depend2.am \
15 distdir.am footer.am header-vars.am header.am install.am java.am \
16 kr-extra.am lex.am library.am libs.am libtool.am lisp.am ltlib.am \
17 ltlibrary.am mans-vars.am mans.am multilib.am program.am progs.am \
18 python.am remake-hdr.am scripts.am subdirs.am tags.am texi-vers.am \
19 texibuild.am texinfos.am yacc.am
20
21 dist_pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \
22 $(amfiles)
23
24 ## These must all be executable when installed.  However, if we use
25 ## _SCRIPTS, then the program transform will be applied, which is not
26 ## what we want.  So we make them executable by hand.
27 scriptdir = $(pkgdatadir)
28 dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \
29 mkinstalldirs elisp-comp ylwrap acinstall depcomp compile py-compile
30
31 install-data-hook:
32         @$(POST_INSTALL)
33         @for prog in $(dist_script_DATA); do \
34           echo " chmod +x $(DESTDIR)$(scriptdir)/$$prog"; \
35           chmod +x $(DESTDIR)$(scriptdir)/$$prog; \
36         done
37
38 TAGS_FILES = automake.in aclocal.in $(amfiles)
39
40 # The following requires a fixed version of the Emacs 19.30 etags.
41 ETAGS_ARGS = --lang=none \
42  --regex='/^@node[ \t]+\([^,]+\)/\1/' $(srcdir)/automake.texi
43 TAGS_DEPENDENCIES = automake.texi
44
45 ## `test -x' is not portable.  So we use Perl instead.  If Perl
46 ## doesn't exist, then this test is meaningless anyway.
47 installcheck-local:
48         for file in $(dist_script_DATA); do \
49           $(PERL) -e "exit ! -x '$(pkgdatadir)/$$file';" || exit 1; \
50         done
51
52 EXTRA_DIST = ChangeLog.1996 ChangeLog.1998
53
54 ################################################################
55 ##
56 ## Everything past here is useful to the maintainer, but probably not
57 ## to anybody else
58 ##
59
60 # Some simple checks, and then ordinary check.  These are only really
61 # guaranteed to work on my machine.
62 maintainer-check: automake aclocal
63 ## This check avoids accidental configure substitutions in the source.
64 ## There are exactly 7 lines that should be modified.  This works out
65 ## to 22 lines of diffs.
66         @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 22; then \
67           echo "found too many diffs between automake.in and automake"; 1>&2; \
68           diff -c $(srcdir)/automake.in automake; \
69           exit 1; \
70         fi
71 ## Syntax check with default Perl (on my machine, Perl 5).
72         $(PERL) -c -w automake
73         $(PERL) -c -w aclocal
74 ## expect no instances of '${...}'.  However, $${...} is ok, since that
75 ## is a shell construct, not a Makefile construct.
76 ## The backslash in `$${' is needed for some versions of bash.
77         @if fgrep '\$${' $(srcdir)/[a-z]*.am | \
78                fgrep -v '$$$$'; then \
79           echo "Found too many uses of '\$${' in the lines above." 1>&2; \
80           exit 1;                               \
81         else :; fi
82 ## Make sure `rm' is called with `-f'.
83         @if egrep '\<rm ([^-]|\-[^f ]*\>)' \
84                   $(srcdir)/[a-z]*.am $(srcdir)/tests/*.test | \
85               fgrep -v '##'; then \
86           echo "Suspicious 'rm' invocation." 1>&2; \
87           exit 1;                               \
88         else :; fi
89 ## Make sure all invocations of mkinstalldirs are correct.
90         @if fgrep -n 'mkinstalldirs' $(srcdir)/[a-z]*.am | \
91               fgrep -v '$$(mkinstalldirs)'; then \
92           echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
93           exit 1; \
94         else :; fi
95 ## We never want to use "undef", only "delete", but for $/.
96         @if grep -n -w undef $(srcdir)/automake.in | \
97               fgrep -v 'undef $$/'; then \
98           echo "Found undef in automake.in; use delete instead" 1>&2; \
99           exit 1; \
100         fi
101 ## We never want split (/ /,...), only split (' ', ...).
102         @if fgrep -n 'split (/ /' $(srcdir)/automake.in; then \
103           echo "Found bad split in the lines above." 1>&2; \
104           exit 1; \
105         fi
106 ## Look for cd within backquotes without CDPATH=:
107         @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in $(srcdir)/*.am \
108               $(srcdir)/m4/*.m4; then \
109           echo "Consider setting CDPATH in the lines above" 1>&2; \
110           exit 1; \
111         fi
112 ## Using @_ in a scalar context is most probably a programming error.
113         @if grep -Hn '[^) ] *= *@_' $(srcdir)/automake.in; then \
114           echo "Using @_ in a scalar context in the lines above." 1>&2; \
115           exit 1; \
116         fi
117 ## Forbid using parens with `local' to ease counting.
118         @if grep '^[ \t]*local *(' $(srcdir)/automake.in; then \
119           echo "Don't use \`local' with parens: use several \`local' above." >&2; \
120           exit 1; \
121         fi
122 ## Up to now we manage to limit to 1 use of local.
123         @locals=`grep -c '^[ \t]*local [^*]' $(srcdir)/automake.in`; \
124         case $$locals in \
125           [0] ) \
126             echo "Wow, congrats!  There are no \`local' now!." >&2; \
127             echo "Please update Makefile.am (maintainer-check)." >&2; \
128             exit 1; \
129           ;; \
130           1 ) ;; \
131           * ) \
132             echo "Too many \`local'!  Are you sure you need $$locals of them?" >&2; \
133             echo "Up to now 1 was enough." >&2; \
134             exit 1; \
135           ;; \
136         esac
137
138 # Tag before making distribution.  Also, don't make a distribution if
139 # checks fail.  Also, make sure the NEWS file is up-to-date.
140 cvs-dist: maintainer-check distcheck
141         @if sed 1q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \
142           echo "NEWS not updated; not releasing" 1>&2; \
143           exit 1;                               \
144         fi
145         cd $(srcdir) && cvs -q tag `echo "Release-$(VERSION)" | sed 's/\./-/g'`
146         $(MAKE) dist
147
148 cvs-diff:
149         thisver=`echo "Release-$(VERSION)" | sed 's/\./-/g'`; \
150         if test -z "$$OLDVERSION"; then \
151           prevno=`echo "$(VERSION)" - 0.01 | bc | sed 's/^\./0./'`; \
152         else prevno="$$OLDVERSION"; fi; \
153         prevver=Release-`echo $$prevno | sed 's/\./-/g'`; \
154         cvs -f rdiff -c -r $$prevver -r $$thisver $(PACKAGE) \
155             > $(PACKAGE)-$$prevno-$(VERSION).diff
156
157 ## Check our path lengths.
158 path-check: distdir
159         (cd $(distdir) && \
160 ## FIXME there's got to be a better way!  pathchk should take the list
161 ## of files on stdin, at least.
162           find . -print | xargs pathchk -p); \
163           status=$$?; \
164           chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir); \
165           exit $$status
166
167 ## Program to use to fetch files.
168 WGET = wget
169
170 ## Files that we fetch and which we compare against.
171 ## FIXME should be a lot more here
172 FETCHFILES = config.guess config.sub
173
174 ## Fetch the latest versions of files we care about.
175 fetch:
176         rm -rf Fetchdir > /dev/null 2>&1
177         mkdir Fetchdir
178 ## If a get fails then that is a problem.
179         (cd Fetchdir && \
180         $(WGET) ftp://ftp.gnu.org/gnu/config/config.guess; \
181         $(WGET) ftp://ftp.gnu.org/gnu/config/config.sub)
182 ## Don't exit after test because we want to give as many errors as
183 ## possible.
184         @stat=0; for file in $(FETCHFILES); do \
185           if diff $(srcdir)/$$file Fetchdir/$$file > /dev/null 2>&1; then :; \
186           else \
187             stat=1; \
188             echo "install Fetchdir/$$file into srcdir and commit"; \
189           fi; \
190         done; exit $$stat