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