xref: /freebsd/share/mk/bsd.info.mk (revision 0de89efe5c443f213c7ea28773ef2dc6cf3af2ed)
1#	$Id: bsd.info.mk,v 1.40 1997/06/21 15:40:31 jkh 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# <bsd.info.mk> includes the files <bsd.dep.mk> and <bsd.obj.mk>.
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# 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:
97	${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${.IMPSRC} \
98		-o ${.TARGET}.new
99	mv -f ${.TARGET}.new ${.TARGET}
100
101.texinfo.info:
102	${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${.IMPSRC} \
103		-o ${.TARGET}.new
104	mv -f ${.TARGET}.new ${.TARGET}
105
106.texi.dvi:
107	env TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \
108		tex ${.IMPSRC} </dev/null
109
110.texinfo.dvi:
111	env TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \
112		tex ${.IMPSRC} </dev/null
113
114.dvi.ps:
115	dvips -o ${.TARGET} ${.IMPSRC}
116
117.ps.latin1:
118	dvips2ascii ${.IMPSRC} > ${.TARGET}.new
119	mv -f ${.TARGET}.new ${.TARGET}
120
121.PATH: ${.CURDIR} ${SRCDIR}
122
123.for _f in ${FORMATS}
124IFILENS+= ${INFO:S/$/.${_f}/g}
125.endfor
126
127.if !defined(NOINFO)
128.if !defined(NOINFOCOMPRESS)
129.for _f in ${FORMATS}
130IFILES+=	${INFO:S/$/.${_f}${ICOMPRESS_EXT}/g}
131.endfor
132all: ${IFILES} _SUBDIR
133.else
134IFILES=	${IFILENS}
135all: ${IFILES} _SUBDIR
136.endif
137.else
138all:
139.endif
140
141.for _f in ${FORMATS}
142.for x in ${INFO:S/$/.${_f}/g}
143${x:S/$/${ICOMPRESS_EXT}/}:	${x}
144	${ICOMPRESS_CMD} ${.ALLSRC} > ${.TARGET}
145.endfor
146.endfor
147
148.for x in ${INFO}
149INSTALLINFODIRS+= ${x:S/$/-install/}
150${x:S/$/-install/}: ${DESTDIR}${INFODIR}/${INFODIRFILE}
151	${INSTALLINFO} --defsection=${INFOSECTION} \
152		       --defentry=${INFOENTRY_${x}} \
153		       ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
154.endfor
155
156.PHONY: ${INSTALLINFODIRS}
157
158# The default is "info" and it can never be "bin"
159DISTRIBUTION?=	info
160.if ${DISTRIBUTION} == "bin"
161DISTRIBUTION=	info
162.endif
163
164.if !target(distribute)
165distribute: _SUBDIR
166.for dist in ${DISTRIBUTION}
167	cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
168.endfor
169.endif
170
171.if defined(SRCS)
172CLEANFILES+=	${INFO}.texi
173${INFO}.texi: ${SRCS}
174	echo "\\input ${SRCS}" > ${.TARGET}
175.endif
176
177depend: _SUBDIR
178	@echo -n
179
180.for _f in ${FORMATS}
181CLEANFILES+=${INFO:S/$/.${_f}*/g}
182.endfor
183
184.if !defined(NOINFO) && defined(INFO)
185install: ${INSTALLINFODIRS} _SUBDIR
186	${INSTALL} ${COPY} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
187		${IFILES} ${DESTDIR}${INFODIR}
188.else
189install:
190.endif
191
192.if !target(maninstall)
193maninstall: _SUBDIR
194.endif
195
196.include <bsd.dep.mk>
197.include <bsd.obj.mk>
198