* Makefile.am (maintainer-check): Refine check for @_ in scalar
[platform/upstream/automake.git] / lib / am / texinfos.am
1 ## automake - create Makefile.in from Makefile.am
2
3 ## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
4 ## Free Software Foundation, Inc.
5
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; either version 2, or (at your option)
9 ## any later version.
10
11 ## This program is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ## GNU General Public License for more details.
15
16 ## You should have received a copy of the GNU General Public License
17 ## along with this program; if not, write to the Free Software
18 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 ## 02111-1307, USA.
20
21 ## ----------- ##
22 ## Variables.  ##
23 ## ----------- ##
24
25 if %?LOCAL-TEXIS%
26 if ! %?CYGNUS%
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
46 TEXI2PDF = $(TEXI2DVI) --pdf --batch
47 MAKEINFOHTML = $(MAKEINFO) --html
48 AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
49 endif %?LOCAL-TEXIS%
50
51
52 ## ---------- ##
53 ## Building.  ##
54 ## ---------- ##
55
56 ## The way to make PostScript, for those who want it.
57 if %?LOCAL-TEXIS%
58 DVIPS = dvips
59 .dvi.ps:
60         $(DVIPS) -o $@ $<
61 endif %?LOCAL-TEXIS%
62
63 .PHONY: dvi dvi-am html html-am info info-am pdf pdf-am ps ps-am
64 if %?SUBDIRS%
65 RECURSIVE_TARGETS += dvi-recursive html-recursive info-recursive
66 RECURSIVE_TARGETS += pdf-recursive ps-recursive
67 dvi: dvi-recursive
68 html: html-recursive
69 info: info-recursive
70 pdf: pdf-recursive
71 ps: ps-recursive
72 else !%?SUBDIRS%
73 dvi: dvi-am
74 html: html-am
75 info: info-am
76 pdf: pdf-am
77 ps: ps-am
78 endif !%?SUBDIRS%
79
80 if %?LOCAL-TEXIS%
81 dvi-am: $(DVIS)
82 html-am: $(HTMLS)
83 info-am: $(INFO_DEPS)
84 pdf-am: $(PDFS)
85 ps-am: $(PSS)
86 else ! %?LOCAL-TEXIS%
87 dvi-am:
88 html-am:
89 info-am:
90 pdf-am:
91 ps-am:
92 endif ! %?LOCAL-TEXIS%
93
94
95 ## ------------ ##
96 ## Installing.  ##
97 ## ------------ ##
98
99 ## Look in both . and srcdir because the info pages might have been
100 ## rebuilt in the build directory.  Can't cd to srcdir; that might
101 ## break a possible install-sh reference.
102 ##
103 ## Funny name due to --cygnus influence; we want to reserve
104 ## `install-info' for the user.
105 ##
106 ## TEXINFOS primary are always installed in infodir, hence install-data
107 ## is hard coded.
108 if %?INSTALL-INFO%
109 if %?LOCAL-TEXIS%
110 am__installdirs += "$(DESTDIR)$(infodir)"
111 install-data-am: install-info-am
112 endif %?LOCAL-TEXIS%
113 endif %?INSTALL-INFO%
114 .PHONY: install-info
115 if %?SUBDIRS%
116 RECURSIVE_TARGETS += install-info-recursive
117 install-info: install-info-recursive
118 else !%?SUBDIRS%
119 install-info: install-info-am
120 endif !%?SUBDIRS%
121
122 .PHONY: install-info-am
123 if %?LOCAL-TEXIS%
124 install-info-am: $(INFO_DEPS)
125         @$(NORMAL_INSTALL)
126         test -z "$(infodir)" || $(mkdir_p) "$(DESTDIR)$(infodir)"
127         @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
128         list='$(INFO_DEPS)'; \
129         for file in $$list; do \
130 ## Strip possible $(srcdir) prefix.
131           case $$file in \
132             $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
133           esac; \
134           if test -f $$file; then d=.; else d=$(srcdir); fi; \
135 ## 8+3 filesystems cannot deal with foo.info-N filenames: they all
136 ## conflict.  DJGPP comes with a tool, DJTAR, that will rename these
137 ## files to foo.iNN while extracting the archive.  DJGPP's makeinfo
138 ## is patched to grok these filenames.  However we have to account
139 ## for the renaming when installing the info files.
140 ##
141 ## If $file == foo.info, then $file_i == foo.i.  The reason we use two
142 ## shell commands instead of one ('s|\.info$$|.i|') is so that a suffix-less
143 ## `foo' becomes `foo.i' too.
144           file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
145           for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
146                        $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
147             if test -f $$ifile; then \
148 ## Strip directory
149               relfile=`echo "$$ifile" | sed 's|^.*/||'`; \
150               echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \
151               $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \
152             else : ; fi; \
153           done; \
154         done
155         @$(POST_INSTALL)
156 ## Only run this code if install-info actually exists, and it is not
157 ## the Debian install-info.  FIXME: once Debian install-info goes
158 ## away, we can remove this hack.  Some versions of Debian install-info
159 ## print their version on stderr (e.g. 1.8.3), other do it in
160 ## on stdout (e.g. 1.10.15).
161 ##
162 ## Do not use
163 ##    install-info --version 2>&1 | sed 1q | grep -v -i debian
164 ## as if install-info does not exist, grep -v will be happy, and
165 ## therefore the code will be triggered although install-info is missing.
166         @if (install-info --version && \
167              install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
168           list='$(INFO_DEPS)'; \
169           for file in $$list; do \
170 ## Strip directory
171             relfile=`echo "$$file" | sed 's|^.*/||'`; \
172 ## Run `:' after install-info in case install-info fails.  We really
173 ## don't care about failures here, because they can be spurious.  For
174 ## instance if you don't have a dir file, install-info will fail.  I
175 ## think instead it should create a new dir file for you.  This bug
176 ## causes the `make distcheck' target to fail reliably.
177             echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
178 ## Use `|| :' here because Sun make passes -e to sh; if install-info
179 ## fails then we'd fail if we used `;'.
180             install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
181           done; \
182         else : ; fi
183 else ! %?LOCAL-TEXIS%
184 install-info-am:
185 endif ! %?LOCAL-TEXIS%
186
187
188 ## -------------- ##
189 ## Uninstalling.  ##
190 ## -------------- ##
191
192 ?SUBDIRS?RECURSIVE_TARGETS += uninstall-info-recursive
193 ?SUBDIRS?uninstall-info: uninstall-info-recursive
194 ?INSTALL-INFO?uninstall-am: uninstall-info-am
195
196 .PHONY: uninstall-info-am
197
198 if %?LOCAL-TEXIS%
199 uninstall-info-am:
200         @$(PRE_UNINSTALL)
201 ## Run two loops here so that we can handle PRE_UNINSTALL and
202 ## NORMAL_UNINSTALL correctly.
203         @if (install-info --version && \
204              install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
205           list='$(INFO_DEPS)'; \
206           for file in $$list; do \
207             relfile=`echo "$$file" | sed 's|^.*/||'`; \
208 ## install-info needs the actual info file.  We use the installed one,
209 ## rather than relying on one still being in srcdir or builddir.
210             echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
211             install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
212           done; \
213         else :; fi
214         @$(NORMAL_UNINSTALL)
215         @list='$(INFO_DEPS)'; \
216         for file in $$list; do \
217           relfile=`echo "$$file" | sed 's|^.*/||'`; \
218 ## DJGPP-style info files.  See comment in install-info-am.
219           relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
220           (if cd "$(DESTDIR)$(infodir)"; then \
221              echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \
222              rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
223            else :; fi); \
224         done
225 else ! %?LOCAL-TEXIS%
226 uninstall-info-am:
227 endif ! %?LOCAL-TEXIS%
228
229 if %?LOCAL-TEXIS%
230 .PHONY: dist-info
231 dist-info: $(INFO_DEPS)
232         @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
233         list='$(INFO_DEPS)'; \
234         for base in $$list; do \
235 ## Strip possible $(srcdir) prefix.
236           case $$base in \
237             $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
238           esac; \
239           if test -f $$base; then d=.; else d=$(srcdir); fi; \
240           for file in $$d/$$base*; do \
241 ## Strip leading '$$d/'.
242             relfile=`expr "$$file" : "$$d/\(.*\)"`; \
243             test -f $(distdir)/$$relfile || \
244               cp -p $$file $(distdir)/$$relfile; \
245           done; \
246         done
247 endif %?LOCAL-TEXIS%
248
249
250 ## ---------- ##
251 ## Cleaning.  ##
252 ## ---------- ##
253
254 ## The funny name is due to --cygnus influence; in Cygnus mode,
255 ## `clean-info' is a target that users can use.
256
257 if %?LOCAL-TEXIS%
258 .PHONY mostlyclean-am: mostlyclean-aminfo
259 .PHONY: mostlyclean-aminfo
260 mostlyclean-aminfo:
261 ## Use `-rf', not just `-f', because %TEXICLEAN% also contains
262 ## any directory created by `makeinfo --html'.
263         -rm -rf %TEXICLEAN%
264
265 .PHONY maintainer-clean-am: maintainer-clean-aminfo
266 maintainer-clean-aminfo:
267         @list='$(INFO_DEPS)'; for i in $$list; do \
268 ## .iNN files are DJGPP-style info files.
269           i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
270           echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
271           rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
272         done
273
274 ?CYGNUS?.PHONY: clean-info
275 ?CYGNUS?clean-info: mostlyclean-aminfo
276 endif %?LOCAL-TEXIS%