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