]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/bsd.info.mk
Import sqlite3 3.8.9
[FreeBSD/FreeBSD.git] / share / mk / bsd.info.mk
1 # $FreeBSD$
2 #
3 # The include file <bsd.info.mk> handles installing GNU (tech)info files.
4 # Texinfo is a documentation system that uses a single source
5 # file to produce both on-line information and printed output.
6 #
7 #
8 # +++ variables +++
9 #
10 # CLEANFILES    Additional files to remove for the clean and cleandir targets.
11 #
12 # DESTDIR       Change the tree where the info files gets installed. [not set]
13 #
14 # DVIPS         A program which convert a TeX DVI file to PostScript [dvips]
15 #
16 # DVIPS2ASCII   A program to convert a PostScript file which was prior
17 #               converted from a TeX DVI file to ascii/latin1 [dvips2ascii]
18 #
19 # FORMATS       Indicates which output formats will be generated
20 #               (info, dvi, latin1, ps, html).  [info]
21 #
22 # ICOMPRESS_CMD Program to compress info files. Output is to
23 #               stdout. [${COMPRESS_CMD}]
24 #
25 # INFO          texinfo files, without suffix.  [set in Makefile]
26 #
27 # INFO2HTML     A program for converting GNU info files into HTML files
28 #               [info2html]
29 #
30 # INFODIR       Base path for GNU's hypertext system
31 #               called Info (see info(1)). [${SHAREDIR}/info]
32 #
33 # INFODIRFILE   Top level node/index for info files. [dir]
34 #
35 # INFOGRP       Info group. [${SHAREGRP}]
36 #
37 # INFOMODE      Info mode. [${NOBINMODE}]
38 #
39 # INFOOWN       Info owner. [${SHAREOWN}]
40 #
41 # INFOSECTION   Default section (if one could not be found in
42 #               the Info file). [Miscellaneous]
43 #
44 # INSTALLINFO   A program for installing directory entries from Info
45 #               file in the ${INFODIR}/${INFODIRFILE}. [install-info]
46 #
47 # INSTALLINFOFLAGS      Options for ${INSTALLINFO} command. [--quiet]
48 #
49 # INSTALLINFODIRS       ???
50 #
51 # MAKEINFO      A program for converting GNU Texinfo files into Info
52 #               file. [makeinfo]
53 #
54 # MAKEINFOFLAGS         Options for ${MAKEINFO} command. [--no-split]
55 #
56 # NO_INFOCOMPRESS       If you do not want info files be
57 #                       compressed when they are installed. [not set]
58 #
59 # TEX           A program for converting tex files into dvi files [tex]
60 #
61 #
62 # +++ targets +++
63 #
64 #       install:
65 #               Install the info files.
66 #
67 #
68 # bsd.obj.mk: cleandir and obj
69
70 .include <bsd.init.mk>
71
72 MAKEINFO?=      makeinfo
73 MAKEINFOFLAGS+= --no-split # simplify some things, e.g., compression
74 SRCDIR?=        ${.CURDIR}
75 INFODIRFILE?=   dir
76 INSTALLINFO?=   install-info
77 INSTALLINFOFLAGS+=--quiet
78 INFOSECTION?=   Miscellaneous
79 ICOMPRESS_CMD?= ${COMPRESS_CMD}
80 ICOMPRESS_EXT?= ${COMPRESS_EXT}
81 FORMATS?=       info
82 INFO2HTML?=     info2html
83 TEX?=           tex
84 DVIPS?=         dvips
85 DVIPS2ASCII?=   dvips2ascii
86
87 .SUFFIXES: ${ICOMPRESS_EXT} .info .texi .texinfo .dvi .ps .latin1 .html
88
89 .texi.info .texinfo.info:
90         ${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${.IMPSRC} \
91                 -o ${.TARGET}
92
93 .texi.dvi .texinfo.dvi:
94         TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \
95                 ${TEX} ${.IMPSRC} </dev/null
96 # Run again to resolve cross references.
97         TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \
98                 ${TEX} ${.IMPSRC} </dev/null
99
100 .texinfo.latin1 .texi.latin1:
101         perl -npe 's/(^\s*\\input\s+texinfo\s+)/$$1\n@tex\n\\global\\hsize=120mm\n@end tex\n\n/' ${.IMPSRC} >> ${.IMPSRC:T:R}-la.texi
102         TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \
103                 ${TEX} ${.IMPSRC:T:R}-la.texi </dev/null
104 # Run again to resolve cross references.
105         TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \
106                 ${TEX} ${.IMPSRC:T:R}-la.texi </dev/null
107         ${DVIPS} -o /dev/stdout ${.IMPSRC:T:R}-la.dvi | \
108                 ${DVIPS2ASCII} > ${.TARGET}.new
109         mv -f ${.TARGET}.new ${.TARGET}
110
111 .dvi.ps:
112         ${DVIPS} -o ${.TARGET} ${.IMPSRC}
113
114 .info.html:
115         ${INFO2HTML} ${.IMPSRC}
116         ${INSTALL_LINK} ${.TARGET:R}.info.Top.html ${.TARGET}
117
118 .PATH: ${.CURDIR} ${SRCDIR}
119
120 .for _f in ${FORMATS}
121 IFILENS+=       ${INFO:S/$/.${_f}/}
122 .endfor
123
124 CLEANFILES+=    ${IFILENS}
125 .if !defined(NO_INFOCOMPRESS)
126 CLEANFILES+=    ${IFILENS:S/$/${ICOMPRESS_EXT}/}
127 IFILES= ${IFILENS:S/$/${ICOMPRESS_EXT}/:S/.html${ICOMPRESS_EXT}/.html/}
128 all: ${IFILES}
129 .else
130 IFILES= ${IFILENS}
131 all: ${IFILES}
132 .endif
133
134 .for x in ${IFILENS}
135 ${x:S/$/${ICOMPRESS_EXT}/}:     ${x}
136         ${ICOMPRESS_CMD} ${.ALLSRC} > ${.TARGET}
137 .endfor
138
139 .for x in ${INFO}
140 INSTALLINFODIRS+= ${x:S/$/-install/}
141 ${x:S/$/-install/}:
142 .if !empty(.MAKEFLAGS:M-j)
143         lockf -k ${DESTDIR}${INFODIR}/${INFODIRFILE} \
144         ${INSTALLINFO} ${INSTALLINFOFLAGS} \
145             --defsection=${INFOSECTION} \
146             --defentry=${INFOENTRY_${x}} \
147             ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
148 .else
149         ${INSTALLINFO} ${INSTALLINFOFLAGS} \
150             --defsection=${INFOSECTION} \
151             --defentry=${INFOENTRY_${x}} \
152             ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
153 .endif
154 .endfor
155
156 .PHONY: ${INSTALLINFODIRS}
157
158 .if defined(SRCS)
159 CLEANFILES+=    ${INFO}.texi
160 ${INFO}.texi: ${SRCS}
161         cat ${.ALLSRC} > ${.TARGET}
162 .endif
163
164 # tex garbage
165 .if !empty(FORMATS:Mps) || !empty(FORMATS:Mdvi) || !empty(FORMATS:Mlatin1)
166 .for _f in aux cp fn ky log out pg toc tp vr dvi
167 CLEANFILES+=    ${INFO:S/$/.${_f}/} ${INFO:S/$/-la.${_f}/}
168 .endfor
169 CLEANFILES+=    ${INFO:S/$/-la.texi/}
170 .endif
171
172 .if !empty(FORMATS:Mhtml)
173 CLEANFILES+=    ${INFO:S/$/.info.*.html/} ${INFO:S/$/.info/}
174 .endif
175
176 .if defined(INFO)
177 install: ${INSTALLINFODIRS}
178 .if !empty(IFILES:N*.html)
179         ${INSTALL} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
180                 ${IFILES:N*.html} ${DESTDIR}${INFODIR}
181 .endif
182 .if !empty(FORMATS:Mhtml)
183         ${INSTALL} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
184                 ${INFO:S/$/.info.*.html/} ${DESTDIR}${INFODIR}
185 .endif
186 .else
187 # The indirection in the following is to avoid the null install rule
188 # "install:" from being overridden by the implicit .sh rule if there
189 # happens to be a source file named install.sh.  This assumes that there
190 # is no source file named __null_install.sh.
191 install: __null_install
192 __null_install:
193 .endif
194
195 .include <bsd.obj.mk>