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