bsd.info.mk revision 21612
1#	$Id$
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# GZIPCMD	Program to compress info files. Output is to
18#		stdout. [gzip -c]
19#
20# INFO		???
21#
22# INFODIR	Base path for GNU's hypertext system
23#		called Info (see info(1)). [${SHAREDIR}/info]
24#
25# INFODIRFILE	Top level node/index for info files. [dir]
26#
27# INFOGRP	Info group. [${SHAREGRP}]
28#
29# INFOMODE	Info mode. [${NOBINMODE}]
30#
31# INFOOWN	Info owner. [${SHAREOWN}]
32#
33# INFOSECTION	??? [Miscellaneous]
34#
35# INFOTMPL	??? [/usr/share/info/dir-tmpl]
36#
37# INSTALLINFO	??? [install-info]
38#
39# INSTALLINFODIRS	???
40#
41# MAKEINFO	A program for converting GNU Texinfo files into Info
42#		file. [makeinfo]
43#
44# MAKEINFOFLAGS		Options for ${MAKEINFO} command. [--no-split]
45#
46# NOINFO	Do not make or install info files. [not set]
47#
48# NOINFOCOMPRESS	If you do not want info files be
49#			compressed when they are installed. [not set]
50#
51#
52# +++ targets +++
53#
54#	clean:
55#		remove *.info* Errs errs mklog ${CLEANFILES}
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
73MAKEINFO?=	makeinfo
74MAKEINFOFLAGS+=	--no-split # simplify some things, e.g., compression
75SRCDIR?=	${.CURDIR}
76INFODIRFILE?=   dir
77INFOTMPL?=      /usr/share/info/dir-tmpl
78INSTALLINFO?=   install-info
79INFOSECTION?=   Miscellaneous
80
81.MAIN: all
82
83.SUFFIXES: .gz .info .texi .texinfo
84.texi.info:
85	${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${.IMPSRC} -o ${.TARGET}
86.texinfo.info:
87	${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${.IMPSRC} -o ${.TARGET}
88
89.PATH: ${.CURDIR} ${SRCDIR}
90
91IFILENS= ${INFO:S/$/.info/g}
92
93.if !defined(NOINFO)
94.if !defined(NOINFOCOMPRESS)
95IFILES=	${INFO:S/$/.info.gz/g}
96all: ${IFILES} _SUBDIR
97.else
98IFILES=	${IFILENS}
99all: ${IFILES} _SUBDIR
100.endif
101.else
102all:
103.endif
104
105GZIPCMD?=	gzip
106
107.for x in ${INFO:S/$/.info/g}
108${x:S/$/.gz/}:	${x}
109	${GZIPCMD} -c ${.ALLSRC} > ${.TARGET}
110.endfor
111
112.for x in ${INFO}
113INSTALLINFODIRS+= ${x:S/$/-install/}
114${x:S/$/-install/}:
115	${INSTALLINFO} --defsection=${INFOSECTION} \
116		       --defentry=${INFOENTRY_${x}} \
117		       ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
118.endfor
119
120.PHONY: ${INSTALLINFODIRS}
121
122# The default is "info" and it can never be "bin"
123DISTRIBUTION?=	info
124.if ${DISTRIBUTION} == "bin"
125DISTRIBUTION=	info
126.endif
127
128.if !target(distribute)
129distribute: _SUBDIR
130	cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies
131.endif
132
133.if defined(SRCS)
134${INFO}.info: ${SRCS}
135	${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${SRCS:S/^/${SRCDIR}\//g} -o ${INFO}.info
136.endif
137
138depend: _SUBDIR
139	@echo -n
140
141clean: _SUBDIR
142	rm -f ${INFO:S/$/.info*/g} Errs errs mklog ${CLEANFILES}
143
144.if !defined(NOINFO) && defined(INFO)
145install: ${INSTALLINFODIRS} _SUBDIR
146	${INSTALL} ${COPY} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
147		${IFILES} ${DESTDIR}${INFODIR}
148.else
149install:
150.endif
151
152.if !target(maninstall)
153maninstall: _SUBDIR
154.endif
155
156.include <bsd.dep.mk>
157.include <bsd.obj.mk>
158