bin: Rely only on the shebang line
[automake.git] / lib / am / texinfos.am
blob70b2f779f8a5e50f68564caa0022ece3e006f233
1 ## automake - create Makefile.in from Makefile.am
3 ## Copyright (C) 1994-2018 Free Software Foundation, Inc.
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.
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.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program.  If not, see <https://www.gnu.org/licenses/>.
18 ## ----------- ##
19 ## Variables.  ##
20 ## ----------- ##
22 if %?LOCAL-TEXIS%
23 TEXI2DVI = texi2dvi
24 TEXI2PDF = $(TEXI2DVI) --pdf --batch
25 MAKEINFOHTML = $(MAKEINFO) --html
26 AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
27 endif %?LOCAL-TEXIS%
30 ## ---------- ##
31 ## Building.  ##
32 ## ---------- ##
34 ## The way to make PostScript, for those who want it.
35 if %?LOCAL-TEXIS%
36 DVIPS = dvips
37 .dvi.ps:
38         %AM_V_DVIPS%TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
39         $(DVIPS) %TEXIQUIET% -o $@ $<
40 endif %?LOCAL-TEXIS%
42 .PHONY: dvi dvi-am html html-am info info-am pdf pdf-am ps ps-am
43 if %?SUBDIRS%
44 RECURSIVE_TARGETS += dvi-recursive html-recursive info-recursive
45 RECURSIVE_TARGETS += pdf-recursive ps-recursive
46 dvi: dvi-recursive
47 html: html-recursive
48 info: info-recursive
49 pdf: pdf-recursive
50 ps: ps-recursive
51 else !%?SUBDIRS%
52 dvi: dvi-am
53 html: html-am
54 info: info-am
55 pdf: pdf-am
56 ps: ps-am
57 endif !%?SUBDIRS%
59 if %?LOCAL-TEXIS%
60 dvi-am: $(DVIS)
61 html-am: $(HTMLS)
62 info-am: $(INFO_DEPS)
63 pdf-am: $(PDFS)
64 ps-am: $(PSS)
65 else ! %?LOCAL-TEXIS%
66 dvi-am:
67 html-am:
68 info-am:
69 pdf-am:
70 ps-am:
71 endif ! %?LOCAL-TEXIS%
74 ## ------------ ##
75 ## Installing.  ##
76 ## ------------ ##
78 ## Some code should be run only if install-info actually exists, and
79 ## if the user doesn't request it not to be run (through the
80 ## 'AM_UPDATE_INFO_DIR' environment variable).  See automake bug#9773
81 ## and Debian Bug#543992.
82 am__can_run_installinfo = \
83   case $$AM_UPDATE_INFO_DIR in \
84     n|no|NO) false;; \
85     *) (install-info --version) >/dev/null 2>&1;; \
86   esac
88 ## Look in both . and srcdir because the info pages might have been
89 ## rebuilt in the build directory.  Can't cd to srcdir; that might
90 ## break a possible install-sh reference.
92 ## Funny name due to --cygnus influence; we want to reserve
93 ## 'install-info' for the user.
95 ## TEXINFOS primary are always installed in infodir, hence install-data
96 ## is hard coded.
97 if %?INSTALL-INFO%
98 if %?LOCAL-TEXIS%
99 am__installdirs += "$(DESTDIR)$(infodir)"
100 install-data-am: install-info-am
101 endif %?LOCAL-TEXIS%
102 endif %?INSTALL-INFO%
103 .PHONY: \
104   install-dvi  install-dvi-am \
105   install-html install-html-am \
106   install-info install-info-am \
107   install-pdf  install-pdf-am \
108   install-ps   install-ps-am
110 if %?SUBDIRS%
111 RECURSIVE_TARGETS += \
112   install-dvi-recursive \
113   install-html-recursive \
114   install-info-recursive \
115   install-pdf-recursive \
116   install-ps-recursive
117 install-dvi: install-dvi-recursive
118 install-html: install-html-recursive
119 install-info: install-info-recursive
120 install-pdf: install-pdf-recursive
121 install-ps: install-ps-recursive
122 else !%?SUBDIRS%
123 install-dvi: install-dvi-am
124 install-html: install-html-am
125 install-info: install-info-am
126 install-pdf: install-pdf-am
127 install-ps: install-ps-am
128 endif !%?SUBDIRS%
130 if %?LOCAL-TEXIS%
132 include inst-vars.am
134 install-dvi-am: $(DVIS)
135         @$(NORMAL_INSTALL)
136         @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
137         if test -n "$$list"; then \
138           echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \
139           $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \
140         fi; \
141         for p in $$list; do \
142           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
143           echo "$$d$$p"; \
144         done | $(am__base_list) | \
145         while read files; do \
146           echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \
147           $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \
148         done
150 install-html-am: $(HTMLS)
151         @$(NORMAL_INSTALL)
152         @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
153         if test -n "$$list"; then \
154           echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \
155           $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \
156         fi; \
157         for p in $$list; do \
158           if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
159           $(am__strip_dir) \
160 ## This indirection is required to work around a bug of the Solaris 10
161 ## shell /usr/xpg4/bin/sh.  The description of the bug can be found at
162 ## <https://lists.gnu.org/archive/html/bug-autoconf/2011-11/msg00005.html>
163 ## and the report of the original failure can be found at automake
164 ## bug#10026 <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=10026#23>
165           d2=$$d$$p; \
166           if test -d "$$d2"; then \
167             echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \
168             $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
169             echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \
170             $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
171           else \
172             list2="$$list2 $$d2"; \
173           fi; \
174         done; \
175         test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
176         while read files; do \
177           echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \
178           $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \
179         done; }
181 install-info-am: $(INFO_DEPS)
182         @$(NORMAL_INSTALL)
183         @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
184         list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
185         if test -n "$$list"; then \
186           echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \
187           $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \
188         fi; \
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.
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         @if $(am__can_run_installinfo); then \
217           list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
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
233 install-pdf-am: $(PDFS)
234         @$(NORMAL_INSTALL)
235         @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
236         if test -n "$$list"; then \
237           echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \
238           $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \
239         fi; \
240         for p in $$list; do \
241           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
242           echo "$$d$$p"; \
243         done | $(am__base_list) | \
244         while read files; do \
245           echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \
246           $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done
248 install-ps-am: $(PSS)
249         @$(NORMAL_INSTALL)
250         @list='$(PSS)'; test -n "$(psdir)" || list=; \
251         if test -n "$$list"; then \
252           echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \
253           $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \
254         fi; \
255         for p in $$list; do \
256           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
257           echo "$$d$$p"; \
258         done | $(am__base_list) | \
259         while read files; do \
260           echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \
261           $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done
263 else ! %?LOCAL-TEXIS%
264 install-dvi-am:
265 install-html-am:
266 install-info-am:
267 install-pdf-am:
268 install-ps-am:
269 endif ! %?LOCAL-TEXIS%
272 ## -------------- ##
273 ## Uninstalling.  ##
274 ## -------------- ##
276 if %?LOCAL-TEXIS%
277 .PHONY uninstall-am: \
278   uninstall-dvi-am \
279   uninstall-html-am \
280   uninstall-info-am \
281   uninstall-ps-am \
282   uninstall-pdf-am
284 uninstall-dvi-am:
285         @$(NORMAL_UNINSTALL)
286         @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
287         for p in $$list; do \
288           $(am__strip_dir) \
289           echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \
290           rm -f "$(DESTDIR)$(dvidir)/$$f"; \
291         done
293 uninstall-html-am:
294         @$(NORMAL_UNINSTALL)
295         @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \
296         for p in $$list; do \
297           $(am__strip_dir) \
298 ## $f can be a directory, hence the -r.
299           echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \
300           rm -rf "$(DESTDIR)$(htmldir)/$$f"; \
301         done
303 uninstall-info-am:
304         @$(PRE_UNINSTALL)
305 ## Run two loops here so that we can handle PRE_UNINSTALL and
306 ## NORMAL_UNINSTALL correctly.
307         @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); 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
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
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%
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%
375 ## ---------- ##
376 ## Cleaning.  ##
377 ## ---------- ##
379 ## The funny name is due to --cygnus influence; in Cygnus mode,
380 ## 'clean-info' is a target that users can use.
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", as well as the
388 ## '*.t2d' and '*.t2p' directories used by texi2dvi and texi2pdf.
389         -rm -rf %MOSTLYCLEAN%
391 .PHONY clean-am: clean-aminfo
392 clean-aminfo:
393 ## Use '-rf', not just '-f'; see comments in 'mostlyclean-aminfo'
394 ## above for details.
395 ?TEXICLEAN?     -test -z "%TEXICLEAN%" \
396 ?TEXICLEAN?     || rm -rf %TEXICLEAN%
398 .PHONY maintainer-clean-am: maintainer-clean-aminfo
399 maintainer-clean-aminfo:
400         @list='$(INFO_DEPS)'; for i in $$list; do \
401 ## .iNN files are DJGPP-style info files.
402           i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
403           echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
404           rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
405         done
406 ## Use '-rf', not just '-f'; see comments in 'mostlyclean-aminfo'
407 ## above for details.
408 ?MAINTCLEAN?    -test -z "%MAINTCLEAN%" \
409 ?MAINTCLEAN?    || rm -rf %MAINTCLEAN%
411 endif %?LOCAL-TEXIS%