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