bsd.info.mk revision 95327
1# $FreeBSD: head/share/mk/bsd.info.mk 95327 2002-04-23 22:16:41Z obrien $ 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# 7# 8# +++ variables +++ 9# 10# CLEANFILES Additional files to remove for the clean and cleandir targets. 11# 12# DESTDIR Change the tree where the info files gets installed. [not set] 13# 14# DISTRIBUTION Name of distribution. [info] 15# 16# DVIPS A program which convert a TeX DVI file to PostScript [dvips] 17# 18# DVIPS2ASCII A program to convert a PostScript file which was prior 19# converted from a TeX DVI file to ascii/latin1 [dvips2ascii] 20# 21# FORMATS Indicates which output formats will be generated 22# (info, dvi, latin1, ps, html). [info] 23# 24# ICOMPRESS_CMD Program to compress info files. Output is to 25# stdout. [${COMPRESS_CMD}] 26# 27# INFO texinfo files, without suffix. [set in Makefile] 28# 29# INFO2HTML A program for converting GNU info files into HTML files 30# [info2html] 31# 32# INFODIR Base path for GNU's hypertext system 33# called Info (see info(1)). [${SHAREDIR}/info] 34# 35# INFODIRFILE Top level node/index for info files. [dir] 36# 37# INFOGRP Info group. [${SHAREGRP}] 38# 39# INFOMODE Info mode. [${NOBINMODE}] 40# 41# INFOOWN Info owner. [${SHAREOWN}] 42# 43# INFOSECTION Default section (if one could not be found in 44# the Info file). [Miscellaneous] 45# 46# INSTALLINFO A program for installing directory entries from Info 47# file in the ${INFODIR}/${INFODIRFILE}. [install-info] 48# 49# INSTALLINFOFLAGS Options for ${INSTALLINFO} command. [--quiet] 50# 51# INSTALLINFODIRS ??? 52# 53# MAKEINFO A program for converting GNU Texinfo files into Info 54# file. [makeinfo] 55# 56# MAKEINFOFLAGS Options for ${MAKEINFO} command. [--no-split] 57# 58# NOINFO Do not make or install info files. [not set] 59# 60# NOINFOCOMPRESS If you do not want info files be 61# compressed when they are installed. [not set] 62# 63# TEX A program for converting tex files into dvi files [tex] 64# 65# 66# +++ targets +++ 67# 68# distribute: 69# This is a variant of install, which will 70# put the stuff into the right "distribution". 71# 72# install: 73# Install the info files. 74# 75# 76# bsd.obj.mk: cleandir and obj 77 78.include <bsd.init.mk> 79 80MAKEINFO?= makeinfo 81MAKEINFOFLAGS+= --no-split # simplify some things, e.g., compression 82SRCDIR?= ${.CURDIR} 83INFODIRFILE?= dir 84INSTALLINFO?= install-info 85INSTALLINFOFLAGS+=--quiet 86INFOSECTION?= Miscellaneous 87ICOMPRESS_CMD?= ${COMPRESS_CMD} 88ICOMPRESS_EXT?= ${COMPRESS_EXT} 89FORMATS?= info 90INFO2HTML?= info2html 91TEX?= tex 92DVIPS?= dvips 93DVIPS2ASCII?= dvips2ascii 94 95.SUFFIXES: ${ICOMPRESS_EXT} .info .texi .texinfo .dvi .ps .latin1 .html 96 97.texi.info .texinfo.info: 98 ${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} -I ${SRCDIR} ${.IMPSRC} \ 99 -o ${.TARGET} 100 101.texi.dvi .texinfo.dvi: 102 TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \ 103 ${TEX} ${.IMPSRC} </dev/null 104# Run again to reolve cross references. 105 TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \ 106 ${TEX} ${.IMPSRC} </dev/null 107 108.texinfo.latin1 .texi.latin1: 109 perl -npe 's/(^\s*\\input\s+texinfo\s+)/$$1\n@tex\n\\global\\hsize=120mm\n@end tex\n\n/' ${.IMPSRC} >> ${.IMPSRC:T:R}-la.texi 110 TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \ 111 ${TEX} ${.IMPSRC:T:R}-la.texi </dev/null 112# Run again to reolve cross references. 113 TEXINPUTS=${.CURDIR}:${SRCDIR}:$$TEXINPUTS \ 114 ${TEX} ${.IMPSRC:T:R}-la.texi </dev/null 115 ${DVIPS} -o /dev/stdout ${.IMPSRC:T:R}-la.dvi | \ 116 ${DVIPS2ASCII} > ${.TARGET}.new 117 mv -f ${.TARGET}.new ${.TARGET} 118 119.dvi.ps: 120 ${DVIPS} -o ${.TARGET} ${.IMPSRC} 121 122.info.html: 123 ${INFO2HTML} ${.IMPSRC} 124 ln -f ${.TARGET:R}.info.Top.html ${.TARGET} 125 126.PATH: ${.CURDIR} ${SRCDIR} 127 128.for _f in ${FORMATS} 129IFILENS+= ${INFO:S/$/.${_f}/} 130.endfor 131 132.if !defined(NOINFO) 133CLEANFILES+= ${IFILENS} 134.if !defined(NOINFOCOMPRESS) 135CLEANFILES+= ${IFILENS:S/$/${ICOMPRESS_EXT}/} 136IFILES= ${IFILENS:S/$/${ICOMPRESS_EXT}/:S/.html${ICOMPRESS_EXT}/.html/} 137all: ${IFILES} 138.else 139IFILES= ${IFILENS} 140all: ${IFILES} 141.endif 142.else 143all: 144.endif 145 146.for x in ${IFILENS} 147${x:S/$/${ICOMPRESS_EXT}/}: ${x} 148 ${ICOMPRESS_CMD} ${.ALLSRC} > ${.TARGET} 149.endfor 150 151.for x in ${INFO} 152INSTALLINFODIRS+= ${x:S/$/-install/} 153${x:S/$/-install/}: ${DESTDIR}${INFODIR}/${INFODIRFILE} 154 ${INSTALLINFO} ${INSTALLINFOFLAGS} \ 155 --defsection=${INFOSECTION} \ 156 --defentry=${INFOENTRY_${x}} \ 157 ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE} 158.endfor 159 160.PHONY: ${INSTALLINFODIRS} 161 162DISTRIBUTION?= base 163 164.if !target(distribute) 165distribute: 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 cat ${.ALLSRC} > ${.TARGET} 175.endif 176 177# tex garbage 178.if ${FORMATS:Mps} || ${FORMATS:Mdvi} || ${FORMATS:Mlatin1} 179.for _f in aux cp fn ky log out pg toc tp vr dvi 180CLEANFILES+= ${INFO:S/$/.${_f}/} ${INFO:S/$/-la.${_f}/} 181.endfor 182CLEANFILES+= ${INFO:S/$/-la.texi/} 183.endif 184 185.if ${FORMATS:Mhtml} 186CLEANFILES+= ${INFO:S/$/.info.*.html/} ${INFO:S/$/.info/} 187.endif 188 189.if !defined(NOINFO) && defined(INFO) 190install: ${INSTALLINFODIRS} 191.if ${IFILES:N*.html} 192 ${INSTALL} ${COPY} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \ 193 ${IFILES:N*.html} ${DESTDIR}${INFODIR} 194.endif 195.if ${FORMATS:Mhtml} 196 ${INSTALL} ${COPY} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \ 197 ${INFO:S/$/.info.*.html/} ${DESTDIR}${INFODIR} 198.endif 199.else 200# The indirection in the following is to avoid the null install rule 201# "install:" from being overridden by the implicit .sh rule if there 202# happens to be a source file named install.sh. This assumes that there 203# is no source file named __null_install.sh. 204install: __null_install 205__null_install: 206.endif 207 208.include <bsd.obj.mk> 209