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