Merge branch 'fix-pr11232' into maint
[platform/upstream/automake.git] / lib / am / texinfos.am
1 ## automake - create Makefile.in from Makefile.am
2
3 ## Copyright (C) 1994-2012 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, see <http://www.gnu.org/licenses/>.
17
18 ## ----------- ##
19 ## Variables.  ##
20 ## ----------- ##
21
22 if %?LOCAL-TEXIS%
23 if ! %?CYGNUS%
24 TEXI2DVI = texi2dvi
25
26 else %?CYGNUS%
27
28 ## Find these programs wherever they may lie.  Yes, this has
29 ## intimate knowledge of the structure of the texinfo distribution.
30 MAKEINFO = `if test -f $(top_builddir)/../texinfo/makeinfo/makeinfo; then \
31             echo $(top_builddir)/../texinfo/makeinfo/makeinfo; \
32           else \
33             echo makeinfo; \
34           fi`
35
36 TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then \
37              echo $(top_srcdir)/../texinfo/util/texi2dvi; \
38            else \
39              echo texi2dvi; \
40            fi`
41 endif %?CYGNUS%
42
43 TEXI2PDF = $(TEXI2DVI) --pdf --batch
44 MAKEINFOHTML = $(MAKEINFO) --html
45 AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
46 endif %?LOCAL-TEXIS%
47
48
49 ## ---------- ##
50 ## Building.  ##
51 ## ---------- ##
52
53 ## The way to make PostScript, for those who want it.
54 if %?LOCAL-TEXIS%
55 DVIPS = dvips
56 .dvi.ps:
57         TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
58         $(DVIPS) -o $@ $<
59 endif %?LOCAL-TEXIS%
60
61 .PHONY: dvi dvi-am html html-am info info-am pdf pdf-am ps ps-am
62 if %?SUBDIRS%
63 RECURSIVE_TARGETS += dvi-recursive html-recursive info-recursive
64 RECURSIVE_TARGETS += pdf-recursive ps-recursive
65 dvi: dvi-recursive
66 html: html-recursive
67 info: info-recursive
68 pdf: pdf-recursive
69 ps: ps-recursive
70 else !%?SUBDIRS%
71 dvi: dvi-am
72 html: html-am
73 info: info-am
74 pdf: pdf-am
75 ps: ps-am
76 endif !%?SUBDIRS%
77
78 if %?LOCAL-TEXIS%
79 dvi-am: $(DVIS)
80 html-am: $(HTMLS)
81 info-am: $(INFO_DEPS)
82 pdf-am: $(PDFS)
83 ps-am: $(PSS)
84 else ! %?LOCAL-TEXIS%
85 dvi-am:
86 html-am:
87 info-am:
88 pdf-am:
89 ps-am:
90 endif ! %?LOCAL-TEXIS%
91
92
93 ## ------------ ##
94 ## Installing.  ##
95 ## ------------ ##
96
97 ## Some code should be run only if install-info actually exists, and
98 ## if the user doesn't request it not to be run (through the
99 ## 'AM_UPDATE_INFO_DIR' environment variable).  See automake bug#9773
100 ## and Debian Bug#543992.
101 if %?FIRST%
102 am__can_run_installinfo = \
103   case $$AM_UPDATE_INFO_DIR in \
104     n|no|NO) false;; \
105     *) (install-info --version) >/dev/null 2>&1;; \
106   esac
107 endif
108
109 ## Look in both . and srcdir because the info pages might have been
110 ## rebuilt in the build directory.  Can't cd to srcdir; that might
111 ## break a possible install-sh reference.
112 ##
113 ## Funny name due to --cygnus influence; we want to reserve
114 ## `install-info' for the user.
115 ##
116 ## TEXINFOS primary are always installed in infodir, hence install-data
117 ## is hard coded.
118 if %?INSTALL-INFO%
119 if %?LOCAL-TEXIS%
120 am__installdirs += "$(DESTDIR)$(infodir)"
121 install-data-am: install-info-am
122 endif %?LOCAL-TEXIS%
123 endif %?INSTALL-INFO%
124 .PHONY: \
125   install-dvi  install-dvi-am \
126   install-html install-html-am \
127   install-info install-info-am \
128   install-pdf  install-pdf-am \
129   install-ps   install-ps-am
130
131 if %?SUBDIRS%
132 RECURSIVE_TARGETS += \
133   install-dvi-recursive \
134   install-html-recursive \
135   install-info-recursive \
136   install-pdf-recursive \
137   install-ps-recursive
138 install-dvi: install-dvi-recursive
139 install-html: install-html-recursive
140 install-info: install-info-recursive
141 install-pdf: install-pdf-recursive
142 install-ps: install-ps-recursive
143 else !%?SUBDIRS%
144 install-dvi: install-dvi-am
145 install-html: install-html-am
146 install-info: install-info-am
147 install-pdf: install-pdf-am
148 install-ps: install-ps-am
149 endif !%?SUBDIRS%
150
151 if %?LOCAL-TEXIS%
152
153 include inst-vars.am
154
155 install-dvi-am: $(DVIS)
156         @$(NORMAL_INSTALL)
157         @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
158         if test -n "$$list"; then \
159           echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \
160           $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \
161         fi; \
162         for p in $$list; do \
163           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
164           echo "$$d$$p"; \
165         done | $(am__base_list) | \
166         while read files; do \
167           echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \
168           $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \
169         done
170
171 install-html-am: $(HTMLS)
172         @$(NORMAL_INSTALL)
173         @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
174         if test -n "$$list"; then \
175           echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \
176           $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \
177         fi; \
178         for p in $$list; do \
179           if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
180           $(am__strip_dir) \
181 ## This indirection is required to work around a bug of the Solaris 10
182 ## shell /usr/xpg4/bin/sh.  The description of the bug can be found at
183 ## <http://lists.gnu.org/archive/html/bug-autoconf/2011-11/msg00005.html>
184 ## and the report of the original failure can be found at automake
185 ## bug#10026 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10026#23>
186           d2=$$d$$p; \
187           if test -d "$$d2"; then \
188             echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \
189             $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
190             echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \
191             $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
192           else \
193             list2="$$list2 $$d2"; \
194           fi; \
195         done; \
196         test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
197         while read files; do \
198           echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \
199           $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \
200         done; }
201
202 install-info-am: $(INFO_DEPS)
203         @$(NORMAL_INSTALL)
204         @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
205         list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
206         if test -n "$$list"; then \
207           echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \
208           $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \
209         fi; \
210         for file in $$list; do \
211 ## Strip possible $(srcdir) prefix.
212           case $$file in \
213             $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
214           esac; \
215           if test -f $$file; then d=.; else d=$(srcdir); fi; \
216 ## 8+3 filesystems cannot deal with foo.info-N filenames: they all
217 ## conflict.  DJGPP comes with a tool, DJTAR, that will rename these
218 ## files to foo.iNN while extracting the archive.  DJGPP's makeinfo
219 ## is patched to grok these filenames.  However we have to account
220 ## for the renaming when installing the info files.
221 ##
222 ## If $file == foo.info, then $file_i == foo.i.  The reason we use two
223 ## shell commands instead of one ('s|\.info$$|.i|') is so that a suffix-less
224 ## `foo' becomes `foo.i' too.
225           file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
226           for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
227                        $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
228             if test -f $$ifile; then \
229               echo "$$ifile"; \
230             else : ; fi; \
231           done; \
232         done | $(am__base_list) | \
233         while read files; do \
234           echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \
235           $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done
236         @$(POST_INSTALL)
237         @if $(am__can_run_installinfo); then \
238           list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
239           for file in $$list; do \
240 ## Strip directory
241             relfile=`echo "$$file" | sed 's|^.*/||'`; \
242 ## Run `:' after install-info in case install-info fails.  We really
243 ## don't care about failures here, because they can be spurious.  For
244 ## instance if you don't have a dir file, install-info will fail.  I
245 ## think instead it should create a new dir file for you.  This bug
246 ## causes the `make distcheck' target to fail reliably.
247             echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
248 ## Use `|| :' here because Sun make passes -e to sh; if install-info
249 ## fails then we'd fail if we used `;'.
250             install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
251           done; \
252         else : ; fi
253
254 install-pdf-am: $(PDFS)
255         @$(NORMAL_INSTALL)
256         @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
257         if test -n "$$list"; then \
258           echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \
259           $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \
260         fi; \
261         for p in $$list; do \
262           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
263           echo "$$d$$p"; \
264         done | $(am__base_list) | \
265         while read files; do \
266           echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \
267           $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done
268
269 install-ps-am: $(PSS)
270         @$(NORMAL_INSTALL)
271         @list='$(PSS)'; test -n "$(psdir)" || list=; \
272         if test -n "$$list"; then \
273           echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \
274           $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \
275         fi; \
276         for p in $$list; do \
277           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
278           echo "$$d$$p"; \
279         done | $(am__base_list) | \
280         while read files; do \
281           echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \
282           $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done
283
284 else ! %?LOCAL-TEXIS%
285 install-dvi-am:
286 install-html-am:
287 install-info-am:
288 install-pdf-am:
289 install-ps-am:
290 endif ! %?LOCAL-TEXIS%
291
292
293 ## -------------- ##
294 ## Uninstalling.  ##
295 ## -------------- ##
296
297 if %?LOCAL-TEXIS%
298 .PHONY uninstall-am: \
299   uninstall-dvi-am \
300   uninstall-html-am \
301   uninstall-info-am \
302   uninstall-ps-am \
303   uninstall-pdf-am
304
305 uninstall-dvi-am:
306         @$(NORMAL_UNINSTALL)
307         @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
308         for p in $$list; do \
309           $(am__strip_dir) \
310           echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \
311           rm -f "$(DESTDIR)$(dvidir)/$$f"; \
312         done
313
314 uninstall-html-am:
315         @$(NORMAL_UNINSTALL)
316         @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \
317         for p in $$list; do \
318           $(am__strip_dir) \
319 ## $f can be a directory, hence the -r.
320           echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \
321           rm -rf "$(DESTDIR)$(htmldir)/$$f"; \
322         done
323
324 uninstall-info-am:
325         @$(PRE_UNINSTALL)
326 ## Run two loops here so that we can handle PRE_UNINSTALL and
327 ## NORMAL_UNINSTALL correctly.
328         @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \
329           list='$(INFO_DEPS)'; \
330           for file in $$list; do \
331             relfile=`echo "$$file" | sed 's|^.*/||'`; \
332 ## install-info needs the actual info file.  We use the installed one,
333 ## rather than relying on one still being in srcdir or builddir.
334 ## However, `make uninstall && make uninstall' should not fail,
335 ## so we ignore failure if the file did not exist.
336             echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
337             if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
338             then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \
339           done; \
340         else :; fi
341         @$(NORMAL_UNINSTALL)
342         @list='$(INFO_DEPS)'; \
343         for file in $$list; do \
344           relfile=`echo "$$file" | sed 's|^.*/||'`; \
345 ## DJGPP-style info files.  See comment in install-info-am.
346           relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
347           (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \
348              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]"; \
349              rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
350            else :; fi); \
351         done
352
353 uninstall-pdf-am:
354         @$(NORMAL_UNINSTALL)
355         @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
356         for p in $$list; do \
357           $(am__strip_dir) \
358           echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \
359           rm -f "$(DESTDIR)$(pdfdir)/$$f"; \
360         done
361
362 uninstall-ps-am:
363         @$(NORMAL_UNINSTALL)
364         @list='$(PSS)'; test -n "$(psdir)" || list=; \
365         for p in $$list; do \
366           $(am__strip_dir) \
367           echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \
368           rm -f "$(DESTDIR)$(psdir)/$$f"; \
369         done
370 endif %?LOCAL-TEXIS%
371
372 if %?LOCAL-TEXIS%
373 .PHONY: dist-info
374 dist-info: $(INFO_DEPS)
375         @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
376         list='$(INFO_DEPS)'; \
377         for base in $$list; do \
378 ## Strip possible $(srcdir) prefix.
379           case $$base in \
380             $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
381           esac; \
382           if test -f $$base; then d=.; else d=$(srcdir); fi; \
383           base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \
384           for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \
385             if test -f $$file; then \
386 ## Strip leading '$$d/'.
387               relfile=`expr "$$file" : "$$d/\(.*\)"`; \
388               test -f "$(distdir)/$$relfile" || \
389                 cp -p $$file "$(distdir)/$$relfile"; \
390             else :; fi; \
391           done; \
392         done
393 endif %?LOCAL-TEXIS%
394
395
396 ## ---------- ##
397 ## Cleaning.  ##
398 ## ---------- ##
399
400 ## The funny name is due to --cygnus influence; in Cygnus mode,
401 ## `clean-info' is a target that users can use.
402
403 if %?LOCAL-TEXIS%
404 .PHONY mostlyclean-am: mostlyclean-aminfo
405 .PHONY: mostlyclean-aminfo
406 mostlyclean-aminfo:
407 ## Use `-rf', not just `-f', because the %*CLEAN% substitutions can also
408 ## contain any directory created by `makeinfo --html'.
409         -rm -rf %MOSTLYCLEAN%
410
411 .PHONY clean-am: clean-aminfo
412 clean-aminfo:
413 ## Use `-rf', not just `-f', because the %*CLEAN% substitutions can also
414 ## contain any directory created by `makeinfo --html'.
415 ?TEXICLEAN?     -test -z "%TEXICLEAN%" \
416 ?TEXICLEAN?     || rm -rf %TEXICLEAN%
417
418 .PHONY maintainer-clean-am: maintainer-clean-aminfo
419 maintainer-clean-aminfo:
420         @list='$(INFO_DEPS)'; for i in $$list; do \
421 ## .iNN files are DJGPP-style info files.
422           i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
423           echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
424           rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
425         done
426 ## Use `-rf', not just `-f', because the %*CLEAN% substitutions can also
427 ## contain any directory created by `makeinfo --html'.
428 ?MAINTCLEAN?    -test -z "%MAINTCLEAN%" \
429 ?MAINTCLEAN?    || rm -rf %MAINTCLEAN%
430
431 ?CYGNUS?.PHONY: clean-info
432 ?CYGNUS?clean-info: mostlyclean-aminfo clean-aminfo
433 endif %?LOCAL-TEXIS%