- Fix a comment typo.
[dragonfly.git] / share / mk / bsd.info.mk
CommitLineData
984263bc 1# $FreeBSD: src/share/mk/bsd.info.mk,v 1.57.2.7 2003/05/21 13:00:46 ru Exp $
79913c34 2# $DragonFly: src/share/mk/bsd.info.mk,v 1.5 2005/01/06 14:54:57 swildner Exp $
984263bc 3#
79913c34 4# The include file <bsd.info.mk> handles installing GNU (tex)info files.
984263bc
MD
5# Texinfo is a documentation system that uses a single source
6# file to produce both on-line information and printed output.
7#
8#
9# +++ variables +++
10#
11# CLEANFILES Additional files to remove for the clean and cleandir targets.
12#
13# DESTDIR Change the tree where the info files gets installed. [not set]
14#
15# DVIPS A program which convert a TeX DVI file to PostScript [dvips]
16#
17# DVIPS2ASCII A program to convert a PostScript file which was prior
18# converted from a TeX DVI file to ascii/latin1 [dvips2ascii]
19#
20# FORMATS Indicates which output formats will be generated
21# (info, dvi, latin1, ps, html). [info]
22#
23# ICOMPRESS_CMD Program to compress info files. Output is to
24# stdout. [${COMPRESS_CMD}]
25#
26# INFO texinfo files, without suffix. [set in Makefile]
27#
28# INFO2HTML A program for converting GNU info files into HTML files
29# [info2html]
30#
31# INFODIR Base path for GNU's hypertext system
32# called Info (see info(1)). [${SHAREDIR}/info]
33#
34# INFODIRFILE Top level node/index for info files. [dir]
35#
36# INFOGRP Info group. [${SHAREGRP}]
37#
38# INFOMODE Info mode. [${NOBINMODE}]
39#
40# INFOOWN Info owner. [${SHAREOWN}]
41#
42# INFOSECTION Default section (if one could not be found in
43# the Info file). [Miscellaneous]
44#
45# INSTALLINFO A program for installing directory entries from Info
46# file in the ${INFODIR}/${INFODIRFILE}. [install-info]
47#
48# INSTALLINFOFLAGS Options for ${INSTALLINFO} command. [--quiet]
49#
50# INSTALLINFODIRS ???
51#
52# MAKEINFO A program for converting GNU Texinfo files into Info
53# file. [makeinfo]
54#
55# MAKEINFOFLAGS Options for ${MAKEINFO} command. [--no-split]
56#
57# NOINFO Do not make or install info files. [not set]
58#
59# NOINFOCOMPRESS If you do not want info files be
60# compressed when they are installed. [not set]
61#
62# TEX A program for converting tex files into dvi files [tex]
63#
64#
65# +++ targets +++
66#
67# install:
68# Install the info files.
69#
70#
71# bsd.obj.mk: cleandir and obj
72
73.include <bsd.init.mk>
74
75MAKEINFO?= makeinfo
76MAKEINFOFLAGS+= --no-split # simplify some things, e.g., compression
77SRCDIR?= ${.CURDIR}
78INFODIRFILE?= dir
79INSTALLINFO?= install-info
80INSTALLINFOFLAGS+=--quiet
81INFOSECTION?= Miscellaneous
82ICOMPRESS_CMD?= ${COMPRESS_CMD}
83ICOMPRESS_EXT?= ${COMPRESS_EXT}
84FORMATS?= info
85INFO2HTML?= info2html
86TEX?= tex
87DVIPS?= dvips
88DVIPS2ASCII?= dvips2ascii
89
90.SUFFIXES: ${ICOMPRESS_EXT} .info .texi .texinfo .dvi .ps .latin1 .html
91
92.texi.info .texinfo.info:
93 ${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${.IMPSRC} \
94 -o ${.TARGET}
95
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
102
103.texinfo.latin1 .texi.latin1:
041dde0a
SW
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
984263bc
MD
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}
119
120.dvi.ps:
121 ${DVIPS} -o ${.TARGET} ${.IMPSRC}
122
123.info.html:
124 ${INFO2HTML} ${.IMPSRC}
125 ln -f ${.TARGET:R}.info.Top.html ${.TARGET}
126
127.PATH: ${.CURDIR} ${SRCDIR}
128
129.for _f in ${FORMATS}
130IFILENS+= ${INFO:S/$/.${_f}/}
131.endfor
132
133.if !defined(NOINFO)
134CLEANFILES+= ${IFILENS}
135.if !defined(NOINFOCOMPRESS)
136CLEANFILES+= ${IFILENS:S/$/${ICOMPRESS_EXT}/}
137IFILES= ${IFILENS:S/$/${ICOMPRESS_EXT}/:S/.html${ICOMPRESS_EXT}/.html/}
138all: ${IFILES}
139.else
140IFILES= ${IFILENS}
141all: ${IFILES}
142.endif
143.else
144all:
145.endif
146
147.for x in ${IFILENS}
148${x:S/$/${ICOMPRESS_EXT}/}: ${x}
149 ${ICOMPRESS_CMD} ${.ALLSRC} > ${.TARGET}
150.endfor
151
152.for x in ${INFO}
153INSTALLINFODIRS+= ${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
160
1397f94a 161.ORDER: ${INFO:S/$/-install/}
984263bc
MD
162.PHONY: ${INSTALLINFODIRS}
163
164.if defined(SRCS)
165CLEANFILES+= ${INFO}.texi
166${INFO}.texi: ${SRCS}
167 cat ${.ALLSRC} > ${.TARGET}
168.endif
169
170# tex garbage
79913c34 171.if !empty(FORMATS:Mps) || !empty(FORMATS:Mdvi) || !empty(FORMATS:Mlatin1)
984263bc
MD
172.for _f in aux cp fn ky log out pg toc tp vr dvi
173CLEANFILES+= ${INFO:S/$/.${_f}/} ${INFO:S/$/-la.${_f}/}
174.endfor
041dde0a 175CLEANFILES+= ${INFO:S/$/-la.texi/} ${INFO:S/$/-la.sed/}
984263bc
MD
176.endif
177
79913c34 178.if !empty(FORMATS:Mhtml)
984263bc
MD
179CLEANFILES+= ${INFO:S/$/.info.*.html/} ${INFO:S/$/.info/}
180.endif
181
182.if !defined(NOINFO) && defined(INFO)
183install: ${INSTALLINFODIRS}
79913c34 184.if !empty(IFILES:N*.html)
984263bc
MD
185 ${INSTALL} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
186 ${IFILES:N*.html} ${DESTDIR}${INFODIR}
187.endif
79913c34 188.if !empty(FORMATS:Mhtml)
984263bc
MD
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.
197install: __null_install
198__null_install:
199.endif
200
201.include <bsd.obj.mk>