bsd.info.mk revision 30308
14Srgrimes#	$Id: bsd.info.mk,v 1.43 1997/10/09 18:14:18 wosch Exp $
274531Sru#
34Srgrimes# The include file <bsd.info.mk> handles installing GNU (tech)info files.
44Srgrimes# Texinfo is a documentation system that uses a single source
574815Sru# file to produce both on-line information and printed output.
64Srgrimes# <bsd.info.mk> includes the files <bsd.dep.mk> and <bsd.obj.mk>.
74Srgrimes#
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# DISTRIBUTION	Name of distribution. [info]
16#
17# FORMATS 	Indicates which output formats will be generated
18#               (info, dvi, latin1, ps).  [info]
19#
20# ICOMPRESS_CMD	Program to compress info files. Output is to
21#		stdout. [${COMPRESS_CMD}]
22#
23# INFO		???
24#
25# INFODIR	Base path for GNU's hypertext system
26#		called Info (see info(1)). [${SHAREDIR}/info]
27#
28# INFODIRFILE	Top level node/index for info files. [dir]
29#
30# INFOGRP	Info group. [${SHAREGRP}]
31#
32# INFOMODE	Info mode. [${NOBINMODE}]
33#
34# INFOOWN	Info owner. [${SHAREOWN}]
35#
36# INFOSECTION	??? [Miscellaneous]
37#
38# INFOTMPL	??? [${INFODIR}/dir-tmpl]
39#
40# INSTALLINFO	??? [install-info]
41#
42# INSTALLINFODIRS	???
43#
44# MAKEINFO	A program for converting GNU Texinfo files into Info
45#		file. [makeinfo]
46#
47# MAKEINFOFLAGS		Options for ${MAKEINFO} command. [--no-split]
48#
49# NOINFO	Do not make or install info files. [not set]
50#
51# NOINFOCOMPRESS	If you do not want info files be
52#			compressed when they are installed. [not set]
53#
54#
55# +++ targets +++
56#
57#	depend:
58#		Dummy target, do nothing.
59#
60#	distribute:
61#		This is a variant of install, which will
62#		put the stuff into the right "distribution".
63#
64#	install:
65#		Install the info files.
66#
67#	maninstall:
68#		Dummy target, do nothing.
69#
70#
71# bsd.obj.mk: cleandir and obj
72
73.if exists(${.CURDIR}/../Makefile.inc)
74.include "${.CURDIR}/../Makefile.inc"
75.endif
76
77MAKEINFO?=	makeinfo
78MAKEINFOFLAGS+=	--no-split # simplify some things, e.g., compression
79SRCDIR?=	${.CURDIR}
80INFODIRFILE?=   dir
81INFOTMPL?=      ${INFODIR}/dir-tmpl
82INSTALLINFO?=   install-info
83INFOSECTION?=   Miscellaneous
84ICOMPRESS_CMD?=	${COMPRESS_CMD}
85ICOMPRESS_EXT?=	${COMPRESS_EXT}
86FORMATS?=	info
87
88.MAIN: all
89
90.SUFFIXES: ${ICOMPRESS_EXT} .info .texi .texinfo .dvi .ps .latin1
91
92# What to do if there's no dir file there.  This is really gross!!!
93${DESTDIR}${INFODIR}/${INFODIRFILE}:
94	@(cd /usr/src/share/info; make install)
95
96.texi.info .texinfo.info:
97	${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${.IMPSRC} \
98		-o ${.TARGET}
99
100.texi.dvi .texinfo.dvi:
101	env TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \
102		tex ${.IMPSRC} </dev/null
103	env TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \
104		tex ${.IMPSRC} </dev/null
105
106.texinfo.latin1 .texi.latin1:
107	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
108	env TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \
109		tex ${.IMPSRC:T:R}-la.texi </dev/null
110	env TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \
111		tex ${.IMPSRC:T:R}-la.texi </dev/null
112	dvips -o /dev/stdout ${.IMPSRC:T:R}-la.dvi | \
113		dvips2ascii > ${.TARGET}.new
114	mv -f ${.TARGET}.new ${.TARGET}
115
116.dvi.ps:
117	dvips -o ${.TARGET} ${.IMPSRC} 	
118
119.PATH: ${.CURDIR} ${SRCDIR}
120
121.for _f in ${FORMATS}
122IFILENS+= ${INFO:S/$/.${_f}/g}
123.endfor
124
125.if !defined(NOINFO)
126.if !defined(NOINFOCOMPRESS)
127.for _f in ${FORMATS}
128IFILES+=	${INFO:S/$/.${_f}${ICOMPRESS_EXT}/g}
129.endfor
130all: ${IFILES} _SUBDIR
131.else
132IFILES=	${IFILENS}
133all: ${IFILES} _SUBDIR
134.endif
135.else
136all:
137.endif
138
139.for _f in ${FORMATS}
140.for x in ${INFO:S/$/.${_f}/g}
141${x:S/$/${ICOMPRESS_EXT}/}:	${x}
142	${ICOMPRESS_CMD} ${.ALLSRC} > ${.TARGET}
143.endfor
144.endfor
145
146.for x in ${INFO}
147INSTALLINFODIRS+= ${x:S/$/-install/}
148${x:S/$/-install/}: ${DESTDIR}${INFODIR}/${INFODIRFILE}
149	${INSTALLINFO} --defsection=${INFOSECTION} \
150		       --defentry=${INFOENTRY_${x}} \
151		       ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
152.endfor
153
154.PHONY: ${INSTALLINFODIRS}
155
156# The default is "info" and it can never be "bin"
157DISTRIBUTION?=	info
158.if ${DISTRIBUTION} == "bin"
159DISTRIBUTION=	info
160.endif
161
162.if !target(distribute)
163distribute: _SUBDIR
164.for dist in ${DISTRIBUTION}
165	cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
166.endfor
167.endif
168
169.if defined(SRCS)
170CLEANFILES+=	${INFO}.texi
171${INFO}.texi: ${SRCS}
172	cat ${.ALLSRC} > ${.TARGET}
173.endif
174
175depend: _SUBDIR
176	@echo -n
177
178.for _f in ${FORMATS}
179CLEANFILES+=${INFO:S/$/.${_f}*/g} ${INFO:S/$/-la.${_f}*/g}
180.endfor
181CLEANFILES+= ${INFO:S/$/-la.texi/g}
182
183# tex garbage
184.for _f in aux cp fn ky log out pg toc tp vr dvi
185CLEANFILES+=	${INFO:S/$/.${_f}/g} ${INFO:S/$/-la.${_f}/g}
186.endfor
187
188
189.if !defined(NOINFO) && defined(INFO)
190install: ${INSTALLINFODIRS} _SUBDIR
191	${INSTALL} ${COPY} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
192		${IFILES} ${DESTDIR}${INFODIR}
193.else
194install:
195.endif
196
197.if !target(maninstall)
198maninstall: _SUBDIR
199.endif
200
201.include <bsd.dep.mk>
202.include <bsd.obj.mk>
203