bsd.info.mk revision 26760
1249746Sdteske#	$Id: bsd.info.mk,v 1.39 1997/05/01 01:15:55 jkh Exp $
2252980Sdteske#
3238438Sdteske# The include file <bsd.info.mk> handles installing GNU (tech)info files.
4238438Sdteske# Texinfo is a documentation system that uses a single source
5238438Sdteske# file to produce both on-line information and printed output.
6238438Sdteske# <bsd.info.mk> includes the files <bsd.dep.mk> and <bsd.obj.mk>.
7238438Sdteske#
8238438Sdteske#
9238438Sdteske# +++ variables +++
10238438Sdteske#
11238438Sdteske# CLEANFILES	Additional files to remove for the clean and cleandir targets.
12238438Sdteske#
13238438Sdteske# DESTDIR	Change the tree where the info files gets installed. [not set]
14252987Sdteske#
15238438Sdteske# DISTRIBUTION	Name of distribution. [info]
16238438Sdteske#
17238438Sdteske# ICOMPRESS_CMD	Program to compress info files. Output is to
18252987Sdteske#		stdout. [${COMPRESS_CMD}]
19238438Sdteske#
20238438Sdteske# INFO		???
21238438Sdteske#
22238438Sdteske# INFODIR	Base path for GNU's hypertext system
23238438Sdteske#		called Info (see info(1)). [${SHAREDIR}/info]
24238438Sdteske#
25238438Sdteske# INFODIRFILE	Top level node/index for info files. [dir]
26238438Sdteske#
27238438Sdteske# INFOGRP	Info group. [${SHAREGRP}]
28238438Sdteske#
29238438Sdteske# INFOMODE	Info mode. [${NOBINMODE}]
30249746Sdteske#
31249746Sdteske# INFOOWN	Info owner. [${SHAREOWN}]
32249746Sdteske#
33249746Sdteske# INFOSECTION	??? [Miscellaneous]
34249746Sdteske#
35238438Sdteske# INFOTMPL	??? [${INFODIR}/dir-tmpl]
36238438Sdteske#
37238438Sdteske# 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# What to do if there's no dir file there.  This is really gross!!!
92${DESTDIR}${INFODIR}/${INFODIRFILE}:
93	@(cd /usr/src/share/info; make install)
94
95.texi.info:
96	${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${.IMPSRC} \
97		-o ${.TARGET}.new
98	mv -f ${.TARGET}.new ${.TARGET}
99
100.texinfo.info:
101	${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${.IMPSRC} \
102		-o ${.TARGET}.new
103	mv -f ${.TARGET}.new ${.TARGET}
104
105.PATH: ${.CURDIR} ${SRCDIR}
106
107IFILENS= ${INFO:S/$/.info/g}
108
109.if !defined(NOINFO)
110.if !defined(NOINFOCOMPRESS)
111IFILES=	${INFO:S/$/.info${ICOMPRESS_EXT}/g}
112all: ${IFILES} _SUBDIR
113.else
114IFILES=	${IFILENS}
115all: ${IFILES} _SUBDIR
116.endif
117.else
118all:
119.endif
120
121.for x in ${INFO:S/$/.info/g}
122${x:S/$/${ICOMPRESS_EXT}/}:	${x}
123	${ICOMPRESS_CMD} ${.ALLSRC} > ${.TARGET}
124.endfor
125
126.for x in ${INFO}
127INSTALLINFODIRS+= ${x:S/$/-install/}
128${x:S/$/-install/}: ${DESTDIR}${INFODIR}/${INFODIRFILE}
129	${INSTALLINFO} --defsection=${INFOSECTION} \
130		       --defentry=${INFOENTRY_${x}} \
131		       ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
132.endfor
133
134.PHONY: ${INSTALLINFODIRS}
135
136# The default is "info" and it can never be "bin"
137DISTRIBUTION?=	info
138.if ${DISTRIBUTION} == "bin"
139DISTRIBUTION=	info
140.endif
141
142.if !target(distribute)
143distribute: _SUBDIR
144.for dist in ${DISTRIBUTION}
145	cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
146.endfor
147.endif
148
149.if defined(SRCS)
150${INFO}.info: ${SRCS}
151	${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} \
152		${SRCS:S/^/${SRCDIR}\//g} -o ${INFO}.info.new
153	mv -f ${INFO}.info.new ${INFO}.info
154.endif
155
156depend: _SUBDIR
157	@echo -n
158
159clean: _SUBDIR
160	rm -f ${INFO:S/$/.info*/g} Errs errs mklog ${CLEANFILES}
161
162.if !defined(NOINFO) && defined(INFO)
163install: ${INSTALLINFODIRS} _SUBDIR
164	${INSTALL} ${COPY} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
165		${IFILES} ${DESTDIR}${INFODIR}
166.else
167install:
168.endif
169
170.if !target(maninstall)
171maninstall: _SUBDIR
172.endif
173
174.include <bsd.dep.mk>
175.include <bsd.obj.mk>
176