* COPYING, ChangeLog, ChangeLog.00, ChangeLog.01, ChangeLog.02,
[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., 51 Franklin Street, Fifth Floor, Boston, MA
19 ## 02110-1301, 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: \
115   install-dvi  install-dvi-am \
116   install-html install-html-am \
117   install-info install-info-am \
118   install-pdf  install-pdf-am \
119   install-ps   install-ps-am
120
121 if %?SUBDIRS%
122 RECURSIVE_TARGETS += \
123   install-dvi-recursive \
124   install-html-recursive \
125   install-info-recursive \
126   install-pdf-recursive \
127   install-ps-recursive
128 install-dvi: install-dvi-recursive
129 install-html: install-html-recursive
130 install-info: install-info-recursive
131 install-pdf: install-pdf-recursive
132 install-ps: install-ps-recursive
133 else !%?SUBDIRS%
134 install-dvi: install-dvi-am
135 install-html: install-html-am
136 install-info: install-info-am
137 install-pdf: install-pdf-am
138 install-ps: install-ps-am
139 endif !%?SUBDIRS%
140
141 if %?LOCAL-TEXIS%
142
143 include inst-vars.am
144
145 install-dvi-am: $(DVIS)
146         @$(NORMAL_INSTALL)
147         test -z "$(dvidir)" || $(mkdir_p) "$(DESTDIR)$(dvidir)"
148         @list='$(DVIS)'; for p in $$list; do \
149           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
150           f=$(am__strip_dir) \
151           echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(dvidir)/$$f'"; \
152           $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(dvidir)/$$f"; \
153         done
154
155 install-html-am: $(HTMLS)
156         @$(NORMAL_INSTALL)
157         test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)"
158         @list='$(HTMLS)'; for p in $$list; do \
159           if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
160           f=$(am__strip_dir) \
161           if test -d "$$d$$p"; then \
162             echo " $(mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \
163             $(mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
164             echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
165             $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
166           else \
167             echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
168             $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
169           fi; \
170         done
171
172 install-info-am: $(INFO_DEPS)
173         @$(NORMAL_INSTALL)
174         test -z "$(infodir)" || $(mkdir_p) "$(DESTDIR)$(infodir)"
175         @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
176         list='$(INFO_DEPS)'; \
177         for file in $$list; do \
178 ## Strip possible $(srcdir) prefix.
179           case $$file in \
180             $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
181           esac; \
182           if test -f $$file; then d=.; else d=$(srcdir); fi; \
183 ## 8+3 filesystems cannot deal with foo.info-N filenames: they all
184 ## conflict.  DJGPP comes with a tool, DJTAR, that will rename these
185 ## files to foo.iNN while extracting the archive.  DJGPP's makeinfo
186 ## is patched to grok these filenames.  However we have to account
187 ## for the renaming when installing the info files.
188 ##
189 ## If $file == foo.info, then $file_i == foo.i.  The reason we use two
190 ## shell commands instead of one ('s|\.info$$|.i|') is so that a suffix-less
191 ## `foo' becomes `foo.i' too.
192           file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
193           for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
194                        $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
195             if test -f $$ifile; then \
196 ## Strip directory
197               relfile=`echo "$$ifile" | sed 's|^.*/||'`; \
198               echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \
199               $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \
200             else : ; fi; \
201           done; \
202         done
203         @$(POST_INSTALL)
204 ## Only run this code if install-info actually exists, and it is not
205 ## the Debian install-info.  FIXME: once Debian install-info goes
206 ## away, we can remove this hack.  Some versions of Debian install-info
207 ## print their version on stderr (e.g. 1.8.3), other do it in
208 ## on stdout (e.g. 1.10.15).
209 ##
210 ## Do not use
211 ##    install-info --version 2>&1 | sed 1q | grep -v -i debian
212 ## as if install-info does not exist, grep -v will be happy, and
213 ## therefore the code will be triggered although install-info is missing.
214         @if (install-info --version && \
215              install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
216           list='$(INFO_DEPS)'; \
217           for file in $$list; do \
218 ## Strip directory
219             relfile=`echo "$$file" | sed 's|^.*/||'`; \
220 ## Run `:' after install-info in case install-info fails.  We really
221 ## don't care about failures here, because they can be spurious.  For
222 ## instance if you don't have a dir file, install-info will fail.  I
223 ## think instead it should create a new dir file for you.  This bug
224 ## causes the `make distcheck' target to fail reliably.
225             echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
226 ## Use `|| :' here because Sun make passes -e to sh; if install-info
227 ## fails then we'd fail if we used `;'.
228             install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
229           done; \
230         else : ; fi
231
232 install-pdf-am: $(PDFS)
233         @$(NORMAL_INSTALL)
234         test -z "$(pdfdir)" || $(mkdir_p) "$(DESTDIR)$(pdfdir)"
235         @list='$(PDFS)'; for p in $$list; do \
236           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
237           f=$(am__strip_dir) \
238           echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/$$f'"; \
239           $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \
240         done
241
242 install-ps-am: $(PSS)
243         @$(NORMAL_INSTALL)
244         test -z "$(psdir)" || $(mkdir_p) "$(DESTDIR)$(psdir)"
245         @list='$(PSS)'; for p in $$list; do \
246           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
247           f=$(am__strip_dir) \
248           echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(psdir)/$$f'"; \
249           $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(psdir)/$$f"; \
250         done
251
252 else ! %?LOCAL-TEXIS%
253 install-dvi-am:
254 install-html-am:
255 install-info-am:
256 install-pdf-am:
257 install-ps-am:
258 endif ! %?LOCAL-TEXIS%
259
260
261 ## -------------- ##
262 ## Uninstalling.  ##
263 ## -------------- ##
264
265 if %?LOCAL-TEXIS%
266 .PHONY uninstall-am: \
267   uninstall-dvi-am \
268   uninstall-html-am \
269   uninstall-info-am \
270   uninstall-ps-am \
271   uninstall-pdf-am
272
273 uninstall-dvi-am:
274         @$(NORMAL_UNINSTALL)
275         @list='$(DVIS)'; for p in $$list; do \
276           f=$(am__strip_dir) \
277           echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \
278           rm -f "$(DESTDIR)$(dvidir)/$$f"; \
279         done
280
281 uninstall-html-am:
282         @$(NORMAL_UNINSTALL)
283         @list='$(HTMLS)'; for p in $$list; do \
284           f=$(am__strip_dir) \
285 ## $f can be a directory, hence the -r.
286           echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \
287           rm -rf "$(DESTDIR)$(htmldir)/$$f"; \
288         done
289
290 uninstall-info-am:
291         @$(PRE_UNINSTALL)
292 ## Run two loops here so that we can handle PRE_UNINSTALL and
293 ## NORMAL_UNINSTALL correctly.
294         @if (install-info --version && \
295              install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
296           list='$(INFO_DEPS)'; \
297           for file in $$list; do \
298             relfile=`echo "$$file" | sed 's|^.*/||'`; \
299 ## install-info needs the actual info file.  We use the installed one,
300 ## rather than relying on one still being in srcdir or builddir.
301             echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
302             install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
303           done; \
304         else :; fi
305         @$(NORMAL_UNINSTALL)
306         @list='$(INFO_DEPS)'; \
307         for file in $$list; do \
308           relfile=`echo "$$file" | sed 's|^.*/||'`; \
309 ## DJGPP-style info files.  See comment in install-info-am.
310           relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
311           (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \
312              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]"; \
313              rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
314            else :; fi); \
315         done
316
317 uninstall-pdf-am:
318         @$(NORMAL_UNINSTALL)
319         @list='$(PDFS)'; for p in $$list; do \
320           f=$(am__strip_dir) \
321           echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \
322           rm -f "$(DESTDIR)$(pdfdir)/$$f"; \
323         done
324
325 uninstall-ps-am:
326         @$(NORMAL_UNINSTALL)
327         @list='$(PSS)'; for p in $$list; do \
328           f=$(am__strip_dir) \
329           echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \
330           rm -f "$(DESTDIR)$(psdir)/$$f"; \
331         done
332 endif %?LOCAL-TEXIS%
333
334 if %?LOCAL-TEXIS%
335 .PHONY: dist-info
336 dist-info: $(INFO_DEPS)
337         @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
338         list='$(INFO_DEPS)'; \
339         for base in $$list; do \
340 ## Strip possible $(srcdir) prefix.
341           case $$base in \
342             $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
343           esac; \
344           if test -f $$base; then d=.; else d=$(srcdir); fi; \
345           for file in $$d/$$base*; do \
346 ## Strip leading '$$d/'.
347             relfile=`expr "$$file" : "$$d/\(.*\)"`; \
348             test -f $(distdir)/$$relfile || \
349               cp -p $$file $(distdir)/$$relfile; \
350           done; \
351         done
352 endif %?LOCAL-TEXIS%
353
354
355 ## ---------- ##
356 ## Cleaning.  ##
357 ## ---------- ##
358
359 ## The funny name is due to --cygnus influence; in Cygnus mode,
360 ## `clean-info' is a target that users can use.
361
362 if %?LOCAL-TEXIS%
363 .PHONY mostlyclean-am: mostlyclean-aminfo
364 .PHONY: mostlyclean-aminfo
365 mostlyclean-aminfo:
366 ## Use `-rf', not just `-f', because %TEXICLEAN% also contains
367 ## any directory created by `makeinfo --html'.
368         -rm -rf %TEXICLEAN%
369
370 .PHONY maintainer-clean-am: maintainer-clean-aminfo
371 maintainer-clean-aminfo:
372         @list='$(INFO_DEPS)'; for i in $$list; do \
373 ## .iNN files are DJGPP-style info files.
374           i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
375           echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
376           rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
377         done
378
379 ?CYGNUS?.PHONY: clean-info
380 ?CYGNUS?clean-info: mostlyclean-aminfo
381 endif %?LOCAL-TEXIS%