bsd.info.mk revision 25314
1#	$Id: bsd.info.mk,v 1.36 1997/04/07 16:46:40 bde 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
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}
86
87.MAIN: all
88
89.SUFFIXES: ${ICOMPRESS_EXT} .info .texi .texinfo
90
91.texi.info:
92	${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${.IMPSRC} \
93		-o ${.TARGET}.new
94	mv -f ${.TARGET}.new ${.TARGET}
95
96.texinfo.info:
97	${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${.IMPSRC} \
98		-o ${.TARGET}.new
99	mv -f ${.TARGET}.new ${.TARGET}
100
101.PATH: ${.CURDIR} ${SRCDIR}
102
103IFILENS= ${INFO:S/$/.info/g}
104
105.if !defined(NOINFO)
106.if !defined(NOINFOCOMPRESS)
107IFILES=	${INFO:S/$/.info${ICOMPRESS_EXT}/g}
108all: ${IFILES} _SUBDIR
109.else
110IFILES=	${IFILENS}
111all: ${IFILES} _SUBDIR
112.endif
113.else
114all:
115.endif
116
117.for x in ${INFO:S/$/.info/g}
118${x:S/$/${ICOMPRESS_EXT}/}:	${x}
119	${ICOMPRESS_CMD} ${.ALLSRC} > ${.TARGET}
120.endfor
121
122# What to do if there's no dir file there.  This is really gross!!!
123${DESTDIR}${INFODIR}/${INFODIRFILE}:
124	cd /usr/src/share/info; ${MAKE} install
125
126# What to do if there's no dir file there.  This is really gross!!!
127${DESTDIR}${INFODIR}/${INFODIRFILE}:
128	@(cd /usr/src/share/info; make install)
129
130.for x in ${INFO}
131INSTALLINFODIRS+= ${x:S/$/-install/}
132${x:S/$/-install/}: ${DESTDIR}${INFODIR}/${INFODIRFILE}
133	${INSTALLINFO} --defsection=${INFOSECTION} \
134		       --defentry=${INFOENTRY_${x}} \
135		       ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
136.endfor
137
138.PHONY: ${INSTALLINFODIRS}
139
140# The default is "info" and it can never be "bin"
141DISTRIBUTION?=	info
142.if ${DISTRIBUTION} == "bin"
143DISTRIBUTION=	info
144.endif
145
146.if !target(distribute)
147distribute: _SUBDIR
148	cd ${.CURDIR} ; \
149		$(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies
150.endif
151
152.if defined(SRCS)
153${INFO}.info: ${SRCS}
154	${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} \
155		${SRCS:S/^/${SRCDIR}\//g} -o ${INFO}.info.new
156	mv -f ${INFO}.info.new ${INFO}.info
157.endif
158
159depend: _SUBDIR
160	@echo -n
161
162clean: _SUBDIR
163	rm -f ${INFO:S/$/.info*/g} Errs errs mklog ${CLEANFILES}
164
165.if !defined(NOINFO) && defined(INFO)
166install: ${INSTALLINFODIRS} _SUBDIR
167	${INSTALL} ${COPY} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
168		${IFILES} ${DESTDIR}${INFODIR}
169.else
170install:
171.endif
172
173.if !target(maninstall)
174maninstall: _SUBDIR
175.endif
176
177.include <bsd.dep.mk>
178.include <bsd.obj.mk>
179