* Makefile.am (maintainer-check): Don't check for 'cd' calls in m4.
[platform/upstream/automake.git] / lib / am / texinfos.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
3 ## Free Software Foundation, Inc.
4
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2, or (at your option)
8 ## any later version.
9
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
14
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 ## 02111-1307, USA.
19
20 ## ----------- ##
21 ## Variables.  ##
22 ## ----------- ##
23
24 if %?LOCAL-TEXIS%
25 if ! %?CYGNUS%
26 MAKEINFO = @MAKEINFO@
27 TEXI2DVI = texi2dvi
28
29 else %?CYGNUS%
30
31 ## Find these programs wherever they may lie.  Yes, this has
32 ## intimate knowledge of the structure of the texinfo distribution.
33 MAKEINFO = `if test -f $(top_builddir)/../texinfo/makeinfo/makeinfo; then \
34             echo $(top_builddir)/../texinfo/makeinfo/makeinfo; \
35           else \
36             echo makeinfo; \
37           fi`
38
39 TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then \
40              echo $(top_srcdir)/../texinfo/util/texi2dvi; \
41            else \
42              echo texi2dvi; \
43            fi`
44 endif %?CYGNUS%
45 endif %?LOCAL-TEXIS%
46
47
48 ## ---------- ##
49 ## Building.  ##
50 ## ---------- ##
51
52 ## The way to make PostScript, for those who want it.
53 if %?LOCAL-TEXIS%
54 DVIPS = dvips
55 .dvi.ps:
56         $(DVIPS) $< -o $@
57 endif %?LOCAL-TEXIS%
58
59 .PHONY: info info-am dvi dvi-am
60 if %?SUBDIRS%
61 RECURSIVE_TARGETS += info-recursive dvi-recursive
62 .PHONY info: info-recursive
63 .PHONY dvi: dvi-recursive
64 else !%?SUBDIRS%
65 info: info-am
66 dvi: dvi-am
67 endif !%?SUBDIRS%
68
69 if %?LOCAL-TEXIS%
70 info-am: $(INFO_DEPS)
71 dvi-am: $(DVIS)
72 else ! %?LOCAL-TEXIS%
73 info-am:
74 dvi-am:
75 endif ! %?LOCAL-TEXIS%
76
77
78 ## ------------ ##
79 ## Installing.  ##
80 ## ------------ ##
81
82 ## Look in both . and srcdir because the info pages might have been
83 ## rebuilt in the build directory.  Can't cd to srcdir; that might
84 ## break a possible install-sh reference.
85 ##
86 ## Funny name due to --cygnus influence; we want to reserve
87 ## `install-info' for the user.
88 ##
89 ## TEXINFOS primary are always installed in infodir, hence install-data
90 ## is hard coded.
91 if %?INSTALL-INFO%
92 if %?LOCAL-TEXIS%
93 _am_installdirs += $(DESTDIR)$(infodir)
94 install-data-am: install-info-am
95 endif %?LOCAL-TEXIS%
96 if %?SUBDIRS%
97 RECURSIVE_TARGETS += install-info-recursive
98 .PHONY install-info: install-info-recursive
99 else !%?SUBDIRS%
100 install-info: install-info-am
101 endif !%?SUBDIRS%
102 endif %?INSTALL-INFO%
103
104 .PHONY: install-info-am
105
106 if %?LOCAL-TEXIS%
107 install-info-am: $(INFO_DEPS)
108         @$(NORMAL_INSTALL)
109         $(mkinstalldirs) $(DESTDIR)$(infodir)
110         @list='$(INFO_DEPS)'; \
111         for file in $$list; do \
112 ?CYGNUS?          if test -f $$file; then d=.; else d=$(srcdir); fi; \
113 ?!CYGNUS?         d=$(srcdir); \
114           for ifile in echo $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9]; do \
115             if test -f $$ifile; then \
116 ## Strip leading '$$d/'.
117               relfile=`expr "$$ifile" : "$$d/\(.*\)"`; \
118               echo " $(INSTALL_DATA) $$ifile $(DESTDIR)$(infodir)/$$relfile"; \
119               $(INSTALL_DATA) $$ifile $(DESTDIR)$(infodir)/$$relfile; \
120             else : ; fi; \
121           done; \
122         done
123         @$(POST_INSTALL)
124 ## Only run this code if install-info actually exists, and it is not
125 ## the Debian install-info.  FIXME: once Debian install-info goes
126 ## away, we can remove this hack.  Debian install-info v1.8.3
127 ## prints version info to stderr.
128 ##
129 ## Do not use
130 ##    install-info --version 2>&1 | sed 1q | fgrep -s -v -i debian
131 ## as if install-info does not exist, fgrep -v will be happy, and
132 ## therefore the code will be triggered although install-info is missing.
133         @if (install-info --version && \
134              install-info --version | fgrep -i -v debian) >/dev/null 2>&1; then \
135           list='$(INFO_DEPS)'; \
136           for file in $$list; do \
137 ## Run `:' after install-info in case install-info fails.  We really
138 ## don't care about failures here, because they can be spurious.  For
139 ## instance if you don't have a dir file, install-info will fail.  I
140 ## think instead it should create a new dir file for you.  This bug
141 ## causes the `make distcheck' target to fail reliably.
142             echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
143 ## Use `|| :' here because Sun make passes -e to sh; if install-info
144 ## fails then we'd fail if we used `;'.
145             install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
146           done; \
147         else : ; fi
148 else ! %?LOCAL-TEXIS%
149 install-info-am:
150 endif ! %?LOCAL-TEXIS%
151
152
153 ## -------------- ##
154 ## Uninstalling.  ##
155 ## -------------- ##
156
157 ?SUBDIRS?RECURSIVE_TARGETS += uninstall-info-recursive
158 ?SUBDIRS?.PHONY uninstall-info: uninstall-info-recursive
159 ?INSTALL-INFO?uninstall-am: uninstall-info-am
160
161 .PHONY: uninstall-info-am
162
163 if %?LOCAL-TEXIS%
164 uninstall-info-am:
165         $(PRE_UNINSTALL)
166 ## Run two loops here so that we can handle PRE_UNINSTALL and
167 ## NORMAL_UNINSTALL correctly.  Debian install-info v1.8.3 prints
168 ## version info to stderr.
169         @if (install-info --version && \
170              install-info --version | fgrep -i -v debian) >/dev/null 2>&1; then \
171           list='$(INFO_DEPS)'; \
172           for file in $$list; do \
173 ## install-info needs the actual info file.  We use the installed one,
174 ## rather than relying on one still being in srcdir or builddir.
175             echo " install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$file"; \
176             install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$file; \
177           done; \
178         else :; fi
179         @$(NORMAL_UNINSTALL)
180         @list='$(INFO_DEPS)'; \
181         for file in $$list; do \
182           (if cd $(DESTDIR)$(infodir); then \
183              echo " rm -f $$file $$file-[0-9] $$file-[0-9][0-9])"; \
184              rm -f $$file $$file-[0-9] $$file-[0-9][0-9]; \
185            else :; fi); \
186         done
187 else ! %?LOCAL-TEXIS%
188 uninstall-info-am:
189 endif ! %?LOCAL-TEXIS%
190
191 if %?LOCAL-TEXIS%
192 .PHONY: dist-info
193 dist-info: $(INFO_DEPS)
194         list='$(INFO_DEPS)'; \
195         for base in $$list; do \
196 ## In Cygnus mode, allow info file to be in source or build dir.  In
197 ## other modes, allow only source dir.
198 ?!CYGNUS?         d=$(srcdir); \
199 ?CYGNUS?          if test -f $$base; then d=.; else d=$(srcdir); fi; \
200           for file in $$d/$$base*; do \
201 ## Strip leading '$$d/'.
202             relfile=`expr "$$file" : "$$d/\(.*\)"`; \
203             test -f $(distdir)/$$relfile || \
204               cp -p $$file $(distdir)/$$relfile; \
205           done; \
206         done
207 endif %?LOCAL-TEXIS%
208
209
210 ## ---------- ##
211 ## Cleaning.  ##
212 ## ---------- ##
213
214 ## The funny name is due to --cygnus influence; in Cygnus mode,
215 ## `clean-info' is a target that users can use.
216
217 if %?LOCAL-TEXIS%
218 .PHONY: mostlyclean-aminfo
219 mostlyclean-am: mostlyclean-aminfo
220 mostlyclean-aminfo:
221         -rm -f %TEXICLEAN%
222
223 .PHONY: maintainer-clean-aminfo
224 maintainer-clean-am: maintainer-clean-aminfo
225 maintainer-clean-aminfo:
226 ## Eww.  But how else can we find all the output files from makeinfo?
227 ?!CYGNUS?       cd $(srcdir) && \
228         for i in $(INFO_DEPS); do \
229           rm -f $$i; \
230           if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
231             rm -f $$i-[0-9]*; \
232           fi; \
233         done
234
235 ?CYGNUS?.PHONY: clean-info
236 ?CYGNUS?clean-info: mostlyclean-aminfo
237 endif %?LOCAL-TEXIS%