bsd.info.mk revision 23546
1#	$Id: bsd.info.mk,v 1.31 1997/02/22 13:56:09 peter 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# ICOMPRESS_CMD	Program to compress info files. Output is to
18#		stdout. [${COMPRESS_CMD}]
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	??? [${INFODIR}/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?=      ${INFODIR}/dir-tmpl
78INSTALLINFO?=   install-info
79INFOSECTION?=   Miscellaneous
80
81.MAIN: all
82
83.SUFFIXES: ${ICOMPRESS_EXT} .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${ICOMPRESS_EXT}/g}
96all: ${IFILES} _SUBDIR
97.else
98IFILES=	${IFILENS}
99all: ${IFILES} _SUBDIR
100.endif
101.else
102all:
103.endif
104
105ICOMPRESS_CMD?=	${COMPRESS_CMD}
106ICOMPRESS_EXT?=	${COMPRESS_EXT}
107
108.for x in ${INFO:S/$/.info/g}
109${x:S/$/${ICOMPRESS_EXT}/}:	${x}
110	${ICOMPRESS_CMD} ${.ALLSRC} > ${.TARGET}
111.endfor
112
113# What to do if there's no dir file there.  This is really gross!!!
114${DESTDIR}${INFODIR}/${INFODIRFILE}:
115	@(cd /usr/src/share/info; make install)
116
117.for x in ${INFO}
118INSTALLINFODIRS+= ${x:S/$/-install/}
119${x:S/$/-install/}: ${DESTDIR}${INFODIR}/${INFODIRFILE}
120	${INSTALLINFO} --defsection=${INFOSECTION} \
121		       --defentry=${INFOENTRY_${x}} \
122		       ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
123.endfor
124
125.PHONY: ${INSTALLINFODIRS}
126
127# The default is "info" and it can never be "bin"
128DISTRIBUTION?=	info
129.if ${DISTRIBUTION} == "bin"
130DISTRIBUTION=	info
131.endif
132
133.if !target(distribute)
134distribute: _SUBDIR
135	cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies
136.endif
137
138.if defined(SRCS)
139${INFO}.info: ${SRCS}
140	${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${SRCS:S/^/${SRCDIR}\//g} -o ${INFO}.info
141.endif
142
143depend: _SUBDIR
144	@echo -n
145
146clean: _SUBDIR
147	rm -f ${INFO:S/$/.info*/g} Errs errs mklog ${CLEANFILES}
148
149.if !defined(NOINFO) && defined(INFO)
150install: ${INSTALLINFODIRS} _SUBDIR
151	${INSTALL} ${COPY} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
152		${IFILES} ${DESTDIR}${INFODIR}
153.else
154install:
155.endif
156
157.if !target(maninstall)
158maninstall: _SUBDIR
159.endif
160
161.include <bsd.dep.mk>
162.include <bsd.obj.mk>
163