bsd.info.mk revision 35789
1#	$Id: bsd.info.mk,v 1.49 1998/03/12 20:02:09 eivind Exp $
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# DISTRIBUTION	Name of distribution. [info]
15#
16# DVIPS		A program which convert a TeX DVI file to PostScript [dvips]
17#
18# DVIPS2ASCII	A program to convert a PostScript file which was prior
19#		converted from a TeX DVI file to ascii/latin1 [dvips2ascii]
20#
21# FORMATS 	Indicates which output formats will be generated
22#               (info, dvi, latin1, ps, html).  [info]
23#
24# ICOMPRESS_CMD	Program to compress info files. Output is to
25#		stdout. [${COMPRESS_CMD}]
26#
27# INFO		texinfo files, without suffix.  [set in Makefile] 
28#
29# INFO2HTML	A program for converting GNU info files into HTML files
30#		[info2html]
31#
32# INFODIR	Base path for GNU's hypertext system
33#		called Info (see info(1)). [${SHAREDIR}/info]
34#
35# INFODIRFILE	Top level node/index for info files. [dir]
36#
37# INFOGRP	Info group. [${SHAREGRP}]
38#
39# INFOMODE	Info mode. [${NOBINMODE}]
40#
41# INFOOWN	Info owner. [${SHAREOWN}]
42#
43# INFOSECTION	??? [Miscellaneous]
44#
45# INFOTMPL	??? [${INFODIR}/dir-tmpl]
46#
47# INSTALLINFO	??? [install-info]
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# NOINFO	Do not make or install info files. [not set]
57#
58# NOINFOCOMPRESS	If you do not want info files be
59#			compressed when they are installed. [not set]
60#
61# TEX		A program for converting tex files into dvi files [tex]
62#
63#
64# +++ targets +++
65#
66#	distribute:
67#		This is a variant of install, which will
68#		put the stuff into the right "distribution".
69#
70#	install:
71#		Install the info files.
72#
73#	maninstall:
74#		Dummy target, do nothing.
75#
76#
77# bsd.obj.mk: cleandir and obj
78
79.if exists(${.CURDIR}/../Makefile.inc)
80.include "${.CURDIR}/../Makefile.inc"
81.endif
82
83MAKEINFO?=	makeinfo
84MAKEINFOFLAGS+=	--no-split # simplify some things, e.g., compression
85SRCDIR?=	${.CURDIR}
86INFODIRFILE?=   dir
87INFOTMPL?=      ${INFODIR}/dir-tmpl
88INSTALLINFO?=   install-info
89INFOSECTION?=   Miscellaneous
90ICOMPRESS_CMD?=	${COMPRESS_CMD}
91ICOMPRESS_EXT?=	${COMPRESS_EXT}
92FORMATS?=	info
93INFO2HTML?=	info2html
94TEX?=		tex
95DVIPS?=		dvips
96DVIPS2ASCII?=	dvips2ascii
97
98.MAIN: all
99
100.SUFFIXES: ${ICOMPRESS_EXT} .info .texi .texinfo .dvi .ps .latin1 .html
101
102.texi.info .texinfo.info:
103	${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${.IMPSRC} \
104		-o ${.TARGET}
105
106.texi.dvi .texinfo.dvi:
107	env TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \
108		${TEX} ${.IMPSRC} </dev/null
109# Run again to reolve cross references.
110	env TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \
111		${TEX} ${.IMPSRC} </dev/null
112
113.texinfo.latin1 .texi.latin1:
114	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
115	env TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \
116		${TEX} ${.IMPSRC:T:R}-la.texi </dev/null
117# Run again to reolve cross references.
118	env TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \
119		${TEX} ${.IMPSRC:T:R}-la.texi </dev/null
120	${DVIPS} -o /dev/stdout ${.IMPSRC:T:R}-la.dvi | \
121		${DVIPS2ASCII} > ${.TARGET}.new
122	mv -f ${.TARGET}.new ${.TARGET}
123
124.dvi.ps:
125	${DVIPS} -o ${.TARGET} ${.IMPSRC} 	
126
127.info.html:
128	${INFO2HTML} ${.IMPSRC}
129	ln -f ${.TARGET:R}.info.Top.html ${.TARGET} 
130
131.PATH: ${.CURDIR} ${SRCDIR}
132
133.for _f in ${FORMATS}
134IFILENS+=	${INFO:S/$/.${_f}/}
135.endfor
136
137.if !defined(NOINFO)
138CLEANFILES+=	${IFILENS}
139.if !defined(NOINFOCOMPRESS)
140CLEANFILES+=	${IFILENS:S/$/${ICOMPRESS_EXT}/}
141IFILES=	${IFILENS:S/$/${ICOMPRESS_EXT}/:S/.html${ICOMPRESS_EXT}/.html/}
142all: ${IFILES} _SUBDIR
143.else
144IFILES=	${IFILENS}
145all: ${IFILES} _SUBDIR
146.endif
147.else
148all:
149.endif
150
151.for x in ${IFILENS}
152${x:S/$/${ICOMPRESS_EXT}/}:	${x}
153	${ICOMPRESS_CMD} ${.ALLSRC} > ${.TARGET}
154.endfor
155
156.for x in ${INFO}
157INSTALLINFODIRS+= ${x:S/$/-install/}
158${x:S/$/-install/}: ${DESTDIR}${INFODIR}/${INFODIRFILE}
159	${INSTALLINFO} --defsection=${INFOSECTION} \
160		       --defentry=${INFOENTRY_${x}} \
161		       ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
162.endfor
163
164.PHONY: ${INSTALLINFODIRS}
165
166DISTRIBUTION?=	bin
167
168.if !target(distribute)
169distribute: _SUBDIR
170.for dist in ${DISTRIBUTION}
171	cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
172.endfor
173.endif
174
175.if defined(SRCS)
176CLEANFILES+=	${INFO}.texi
177${INFO}.texi: ${SRCS}
178	cat ${.ALLSRC} > ${.TARGET}
179.endif
180
181# tex garbage
182.if ${FORMATS:Mps} || ${FORMATS:Mdvi} || ${FORMATS:Mlatin1}
183.for _f in aux cp fn ky log out pg toc tp vr dvi
184CLEANFILES+=	${INFO:S/$/.${_f}/} ${INFO:S/$/-la.${_f}/}
185.endfor
186CLEANFILES+=	${INFO:S/$/-la.texi/}
187.endif
188
189.if ${FORMATS:Mhtml}
190CLEANFILES+=	${INFO:S/$/.info.*.html/} ${INFO:S/$/.info/}
191.endif
192
193.if !defined(NOINFO) && defined(INFO)
194install: ${INSTALLINFODIRS} _SUBDIR
195.if ${IFILES:N*.html}
196	${INSTALL} ${COPY} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
197		${IFILES:N*.html} ${DESTDIR}${INFODIR}
198.endif
199.if ${FORMATS:Mhtml}
200	${INSTALL} ${COPY} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
201		${INFO:S/$/.info.*.html/} ${DESTDIR}${INFODIR}
202.endif
203.else
204install:
205.endif
206
207.if !target(maninstall)
208maninstall: _SUBDIR
209.endif
210
211.if !target(regress)
212regress:
213.endif
214
215.include <bsd.obj.mk>
216