]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/mk/bsd.info.mk
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.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 .if ${MK_INFO} != "no"
125 CLEANFILES+=    ${IFILENS}
126 .if !defined(NO_INFOCOMPRESS)
127 CLEANFILES+=    ${IFILENS:S/$/${ICOMPRESS_EXT}/}
128 IFILES= ${IFILENS:S/$/${ICOMPRESS_EXT}/:S/.html${ICOMPRESS_EXT}/.html/}
129 all: ${IFILES}
130 .else
131 IFILES= ${IFILENS}
132 all: ${IFILES}
133 .endif
134 .else
135 all:
136 .endif
137
138 .for x in ${IFILENS}
139 ${x:S/$/${ICOMPRESS_EXT}/}:     ${x}
140         ${ICOMPRESS_CMD} ${.ALLSRC} > ${.TARGET}
141 .endfor
142
143 .for x in ${INFO}
144 INSTALLINFODIRS+= ${x:S/$/-install/}
145 ${x:S/$/-install/}:
146 .if !empty(.MAKEFLAGS:M-j)
147         lockf -k ${DESTDIR}${INFODIR}/${INFODIRFILE} \
148         ${INSTALLINFO} ${INSTALLINFOFLAGS} \
149             --defsection=${INFOSECTION} \
150             --defentry=${INFOENTRY_${x}} \
151             ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
152 .else
153         ${INSTALLINFO} ${INSTALLINFOFLAGS} \
154             --defsection=${INFOSECTION} \
155             --defentry=${INFOENTRY_${x}} \
156             ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
157 .endif
158 .endfor
159
160 .PHONY: ${INSTALLINFODIRS}
161
162 .if defined(SRCS)
163 CLEANFILES+=    ${INFO}.texi
164 ${INFO}.texi: ${SRCS}
165         cat ${.ALLSRC} > ${.TARGET}
166 .endif
167
168 # tex garbage
169 .if !empty(FORMATS:Mps) || !empty(FORMATS:Mdvi) || !empty(FORMATS:Mlatin1)
170 .for _f in aux cp fn ky log out pg toc tp vr dvi
171 CLEANFILES+=    ${INFO:S/$/.${_f}/} ${INFO:S/$/-la.${_f}/}
172 .endfor
173 CLEANFILES+=    ${INFO:S/$/-la.texi/}
174 .endif
175
176 .if !empty(FORMATS:Mhtml)
177 CLEANFILES+=    ${INFO:S/$/.info.*.html/} ${INFO:S/$/.info/}
178 .endif
179
180 .if ${MK_INFO} != "no" && defined(INFO)
181 install: ${INSTALLINFODIRS}
182 .if !empty(IFILES:N*.html)
183         ${INSTALL} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
184                 ${IFILES:N*.html} ${DESTDIR}${INFODIR}
185 .endif
186 .if !empty(FORMATS:Mhtml)
187         ${INSTALL} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
188                 ${INFO:S/$/.info.*.html/} ${DESTDIR}${INFODIR}
189 .endif
190 .else
191 # The indirection in the following is to avoid the null install rule
192 # "install:" from being overridden by the implicit .sh rule if there
193 # happens to be a source file named install.sh.  This assumes that there
194 # is no source file named __null_install.sh.
195 install: __null_install
196 __null_install:
197 .endif
198
199 .include <bsd.obj.mk>