170e244f8SWolfram Schneider# $Id: bsd.man.mk,v 1.25 1997/07/25 11:17:12 bde Exp $ 253996fadSWolfram Schneider# 353996fadSWolfram Schneider# The include file <bsd.man.mk> handles installing manual pages and 470e244f8SWolfram Schneider# their links. 553996fadSWolfram Schneider# 653996fadSWolfram Schneider# 753996fadSWolfram Schneider# +++ variables +++ 853996fadSWolfram Schneider# 953996fadSWolfram Schneider# DESTDIR Change the tree where the man pages gets installed. [not set] 1053996fadSWolfram Schneider# 1153996fadSWolfram Schneider# MANDIR Base path for manual installation. [${SHAREDIR}/man/man] 1253996fadSWolfram Schneider# 1353996fadSWolfram Schneider# MANOWN Manual owner. [${SHAREOWN}] 1453996fadSWolfram Schneider# 1553996fadSWolfram Schneider# MANGRP Manual group. [${SHAREGRP}] 1653996fadSWolfram Schneider# 1753996fadSWolfram Schneider# MANMODE Manual mode. [${NOBINMODE}] 1853996fadSWolfram Schneider# 1953996fadSWolfram Schneider# MANSUBDIR Subdirectory under the manual page section, i.e. "/i386" 2053996fadSWolfram Schneider# or "/tahoe" for machine specific manual pages. 2153996fadSWolfram Schneider# 2253996fadSWolfram Schneider# MAN${sect} The manual pages to be installed. For sections see 2353996fadSWolfram Schneider# variable ${SECTIONS} 2453996fadSWolfram Schneider# 2553996fadSWolfram Schneider# _MANPAGES List of all man pages to be installed. 2653996fadSWolfram Schneider# (``_MANPAGES=$MAN1 $MAN2 ... $MANn'') 2753996fadSWolfram Schneider# 28f7ea12a0SWolfram Schneider# MCOMPRESS_CMD Program to compress man pages. Output is to 29f7ea12a0SWolfram Schneider# stdout. [${COMPRESS_CMD}] 3053996fadSWolfram Schneider# 3153996fadSWolfram Schneider# MLINKS List of manual page links (using a suffix). The 3253996fadSWolfram Schneider# linked-to file must come first, the linked file 3353996fadSWolfram Schneider# second, and there may be multiple pairs. The files 3453996fadSWolfram Schneider# are hard-linked. 3553996fadSWolfram Schneider# 3653996fadSWolfram Schneider# NOMANCOMPRESS If you do not want unformatted manual pages to be 3753996fadSWolfram Schneider# compressed when they are installed. [not set] 3853996fadSWolfram Schneider# 39236fc12aSWolfram Schneider# NOMLINKS If you do not want install manual page links. [not set] 40236fc12aSWolfram Schneider# 41d5dcd8e6SPeter Wemm# MANFILTER command to pipe the raw man page though before compressing 42d5dcd8e6SPeter Wemm# or installing. Can be used to do sed substitution. 4353996fadSWolfram Schneider# 445191ded8SPaul Traina# MANBUILDCAT create preformatted manual pages in addition to normal 455191ded8SPaul Traina# pages. [not set] 465191ded8SPaul Traina# 475191ded8SPaul Traina# MROFF_CMD command and flags to create preformatted pages 485191ded8SPaul Traina# 4953996fadSWolfram Schneider# +++ targets +++ 5053996fadSWolfram Schneider# 5153996fadSWolfram Schneider# maninstall: 5253996fadSWolfram Schneider# Install the manual pages and their links. 5353996fadSWolfram Schneider# 5453996fadSWolfram Schneider 55e8f9a073SBruce Evans 56e8f9a073SBruce Evans.if exists(${.CURDIR}/../Makefile.inc) 57e8f9a073SBruce Evans.include "${.CURDIR}/../Makefile.inc" 58e8f9a073SBruce Evans.endif 59afe61c15SRodney W. Grimes 603585b293SGarrett WollmanMANSRC?= ${.CURDIR} 613585b293SGarrett WollmanMINSTALL= ${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} 62afe61c15SRodney W. Grimes 635191ded8SPaul TrainaCATDIR= ${MANDIR:H:S/$/\/cat/} 645191ded8SPaul TrainaCATEXT= .cat 655191ded8SPaul TrainaMROFF_CMD?= groff -Tascii -man 665191ded8SPaul Traina 67f7ea12a0SWolfram SchneiderMCOMPRESS_CMD?= ${COMPRESS_CMD} 68f7ea12a0SWolfram SchneiderMCOMPRESS_EXT?= ${COMPRESS_EXT} 69afe61c15SRodney W. Grimes 70d4be2259SWolfram SchneiderSECTIONS= 1 2 3 4 5 6 7 8 9 n 713585b293SGarrett Wollman 72bd063a9dSWolfram Schneider.undef _MANPAGES 73eb896871SBruce Evans.for sect in ${SECTIONS} 74eb896871SBruce Evans.if defined(MAN${sect}) && !empty(MAN${sect}) 75eb896871SBruce Evans.SUFFIXES: .${sect} 76eb896871SBruce Evans.PATH.${sect}: ${MANSRC} 77bd063a9dSWolfram Schneider_MANPAGES+= ${MAN${sect}} 78eb896871SBruce Evans.endif 79eb896871SBruce Evans.endfor 80eb896871SBruce Evans 817c0c241dSBruce Evans# XXX MANDEPEND is only used for groff, man/man, man/manpath, at and atrun. 827c0c241dSBruce Evans# It should be named more generally. 83973f098aSGarrett Wollmanall-man: ${MANDEPEND} 84e8f9a073SBruce Evans 85e8f9a073SBruce Evans.if defined(NOMANCOMPRESS) 86e8f9a073SBruce Evans 87eb896871SBruce EvansCOPY= -c 88eb0085f4SPeter Wemm 89eb0085f4SPeter Wemm# Make special arrangements to filter to a temporary file at build time 90eb0085f4SPeter Wemm# for NOMANCOMPRESS. 91eb0085f4SPeter Wemm.if defined(MANFILTER) 92eb0085f4SPeter WemmFILTEXTENSION= .filt 93eb0085f4SPeter Wemm.else 94eb0085f4SPeter WemmFILTEXTENSION= 95eb0085f4SPeter Wemm.endif 96eb0085f4SPeter Wemm 97e8f9a073SBruce EvansZEXT= 98e8f9a073SBruce Evans 99d5dcd8e6SPeter Wemm.if defined(MANFILTER) 100d5dcd8e6SPeter Wemm.for sect in ${SECTIONS} 101d5dcd8e6SPeter Wemm.if defined(MAN${sect}) && !empty(MAN${sect}) 102eb0085f4SPeter WemmCLEANFILES+= ${MAN${sect}:T:S/$/${FILTEXTENSION}/g} 1035191ded8SPaul TrainaCLEANFILES+= ${MAN${sect}:T:S/$/${CATEXT}${FILTEXTENSION}/g} 104d5dcd8e6SPeter Wemm.for page in ${MAN${sect}} 105eb0085f4SPeter Wemm.for target in ${page:T:S/$/${FILTEXTENSION}/g} 106d5dcd8e6SPeter Wemmall-man: ${target} 107d5dcd8e6SPeter Wemm${target}: ${page} 1085e7d3affSPeter Wemm ${MANFILTER} < ${.ALLSRC} > ${.TARGET} 109d5dcd8e6SPeter Wemm.endfor 1105d08f311SBruce Evans.if defined(MANBUILDCAT) && !empty(MANBUILDCAT) 1115191ded8SPaul Traina.for target in ${page:T:S/$/${CATEXT}${FILTEXTENSION}/g} 1125191ded8SPaul Trainaall-man: ${target} 1135191ded8SPaul Traina${target}: ${page} 1145191ded8SPaul Traina ${MANFILTER} < ${.ALLSRC} | ${MROFF_CMD} > ${.TARGET} 115d5dcd8e6SPeter Wemm.endfor 116d5dcd8e6SPeter Wemm.endif 117d5dcd8e6SPeter Wemm.endfor 118d5dcd8e6SPeter Wemm.endif 1195191ded8SPaul Traina.endfor 1205191ded8SPaul Traina.else 1215191ded8SPaul Traina.for sect in ${SECTIONS} 1225191ded8SPaul Traina.if defined(MAN${sect}) && !empty(MAN${sect}) 1235191ded8SPaul TrainaCLEANFILES+= ${MAN${sect}:T:S/$/${CATEXT}/g} 1245d08f311SBruce Evans.if defined(MANBUILDCAT) && !empty(MANBUILDCAT) 1255191ded8SPaul Traina.for page in ${MAN${sect}} 1265191ded8SPaul Traina.for target in ${page:T:S/$/${CATEXT}/g} 1275191ded8SPaul Trainaall-man: ${target} 1285191ded8SPaul Traina${target}: ${page} 1295191ded8SPaul Traina ${MROFF_CMD} ${.ALLSRC} > ${.TARGET} 1305191ded8SPaul Traina.endfor 1315191ded8SPaul Traina.endfor 1325191ded8SPaul Traina.endif 1335191ded8SPaul Traina.endif 1345191ded8SPaul Traina.endfor 1355191ded8SPaul Traina.endif 136d5dcd8e6SPeter Wemm 137e8f9a073SBruce Evans.else 138e8f9a073SBruce Evans 139f7ea12a0SWolfram SchneiderZEXT= ${MCOMPRESS_EXT} 140e8f9a073SBruce Evans 141e8f9a073SBruce Evans.for sect in ${SECTIONS} 142e8f9a073SBruce Evans.if defined(MAN${sect}) && !empty(MAN${sect}) 143f7ea12a0SWolfram SchneiderCLEANFILES+= ${MAN${sect}:T:S/$/${MCOMPRESS_EXT}/g} 1445191ded8SPaul TrainaCLEANFILES+= ${MAN${sect}:T:S/$/${CATEXT}${MCOMPRESS_EXT}/g} 145e8f9a073SBruce Evans.for page in ${MAN${sect}} 146f7ea12a0SWolfram Schneider.for target in ${page:T:S/$/${MCOMPRESS_EXT}/} 147e8f9a073SBruce Evansall-man: ${target} 148e8f9a073SBruce Evans${target}: ${page} 1495e7d3affSPeter Wemm.if defined(MANFILTER) 150f7ea12a0SWolfram Schneider ${MANFILTER} < ${.ALLSRC} | ${MCOMPRESS_CMD} > ${.TARGET} 151d5dcd8e6SPeter Wemm.else 152f7ea12a0SWolfram Schneider ${MCOMPRESS_CMD} ${.ALLSRC} > ${.TARGET} 153d5dcd8e6SPeter Wemm.endif 154e8f9a073SBruce Evans.endfor 1555d08f311SBruce Evans.if defined(MANBUILDCAT) && !empty(MANBUILDCAT) 1565191ded8SPaul Traina.for target in ${page:T:S/$/${CATEXT}${MCOMPRESS_EXT}/} 1575191ded8SPaul Trainaall-man: ${target} 1585191ded8SPaul Traina${target}: ${page} 1595191ded8SPaul Traina.if defined(MANFILTER) 1605191ded8SPaul Traina ${MANFILTER} < ${.ALLSRC} | ${MROFF_CMD} | ${MCOMPRESS_CMD} > ${.TARGET} 1615191ded8SPaul Traina.else 1625191ded8SPaul Traina ${MROFF_CMD} ${.ALLSRC} | ${MCOMPRESS_CMD} > ${.TARGET} 1635191ded8SPaul Traina.endif 1645191ded8SPaul Traina.endfor 1655191ded8SPaul Traina.endif 166e8f9a073SBruce Evans.endfor 167e8f9a073SBruce Evans.endif 168e8f9a073SBruce Evans.endfor 169e8f9a073SBruce Evans 1703585b293SGarrett Wollman.endif 1713585b293SGarrett Wollman 172eb896871SBruce Evansmaninstall:: 173e8f9a073SBruce Evans.for sect in ${SECTIONS} 174973f098aSGarrett Wollman.if defined(MAN${sect}) && !empty(MAN${sect}) 175eb896871SBruce Evansmaninstall:: ${MAN${sect}} 176973f098aSGarrett Wollman.if defined(NOMANCOMPRESS) 177eb0085f4SPeter Wemm.if defined(MANFILTER) 178eb0085f4SPeter Wemm.for page in ${MAN${sect}} 1795191ded8SPaul Traina ${MINSTALL} ${page:T:S/$/${FILTEXTENSION}/g} \ 1805191ded8SPaul Traina ${DESTDIR}${MANDIR}${sect}${MANSUBDIR}/${page} 1815d08f311SBruce Evans.if defined(MANBUILDCAT) && !empty(MANBUILDCAT) 1825191ded8SPaul Traina ${MINSTALL} ${page:T:S/$/${CATEXT}${FILTEXTENSION}/g} \ 1835191ded8SPaul Traina ${DESTDIR}${CATDIR}${sect}${MANSUBDIR}/${page} 1845191ded8SPaul Traina.endif 185eb0085f4SPeter Wemm.endfor 186eb0085f4SPeter Wemm.else 187eb896871SBruce Evans ${MINSTALL} ${.ALLSRC} ${DESTDIR}${MANDIR}${sect}${MANSUBDIR} 1885d08f311SBruce Evans.if defined(MANBUILDCAT) && !empty(MANBUILDCAT) 1895191ded8SPaul Traina.for page in ${MAN${sect}} 1905191ded8SPaul Traina ${MINSTALL} ${page:T:S/$/${CATEXT}/} \ 1915191ded8SPaul Traina ${DESTDIR}${CATDIR}${sect}${MANSUBDIR}/${page:T} 1925191ded8SPaul Traina.endfor 1935191ded8SPaul Traina.endif 194eb0085f4SPeter Wemm.endif 195973f098aSGarrett Wollman.else 196f7ea12a0SWolfram Schneider ${MINSTALL} ${.ALLSRC:T:S/$/${MCOMPRESS_EXT}/g} \ 197e8f9a073SBruce Evans ${DESTDIR}${MANDIR}${sect}${MANSUBDIR} 1985d08f311SBruce Evans.if defined(MANBUILDCAT) && !empty(MANBUILDCAT) 1995191ded8SPaul Traina.for page in ${MAN${sect}} 2005191ded8SPaul Traina ${MINSTALL} ${page:T:S/$/${CATEXT}${MCOMPRESS_EXT}/g} \ 2015191ded8SPaul Traina ${DESTDIR}${CATDIR}${sect}${MANSUBDIR}/${page:T:S/$/${MCOMPRESS_EXT}/} 2025191ded8SPaul Traina.endfor 2035191ded8SPaul Traina.endif 204973f098aSGarrett Wollman.endif 205973f098aSGarrett Wollman.endif 206973f098aSGarrett Wollman.endfor 207e8f9a073SBruce Evans 208236fc12aSWolfram Schneider.if !defined(NOMLINKS) && defined(MLINKS) && !empty(MLINKS) 209d8982a6aSWolfram Schneider @set `echo ${MLINKS} " " | sed 's/\.\([^.]*\) /.\1 \1 /g'`; \ 210d8982a6aSWolfram Schneider while : ; do \ 211d8982a6aSWolfram Schneider case $$# in \ 212d8982a6aSWolfram Schneider 0) break;; \ 213d8982a6aSWolfram Schneider [123]) echo "warn: empty MLINK: $$1 $$2 $$3"; break;; \ 214d8982a6aSWolfram Schneider esac; \ 215d8982a6aSWolfram Schneider name=$$1; shift; sect=$$1; shift; \ 216d8982a6aSWolfram Schneider l=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \ 217d8982a6aSWolfram Schneider name=$$1; shift; sect=$$1; shift; \ 218d8982a6aSWolfram Schneider t=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \ 21980c02d59SBruce Evans ${ECHO} $${t}${ZEXT} -\> $${l}${ZEXT}; \ 220f7ea12a0SWolfram Schneider rm -f $${t} $${t}${MCOMPRESS_EXT}; \ 2213585b293SGarrett Wollman ln $${l}${ZEXT} $${t}${ZEXT}; \ 222d8982a6aSWolfram Schneider done 2235d08f311SBruce Evans.if defined(MANBUILDCAT) && !empty(MANBUILDCAT) 2245191ded8SPaul Traina @set `echo ${MLINKS} " " | sed 's/\.\([^.]*\) /.\1 \1 /g'`; \ 2255191ded8SPaul Traina while : ; do \ 2265191ded8SPaul Traina case $$# in \ 2275191ded8SPaul Traina 0) break;; \ 2285191ded8SPaul Traina [123]) echo "warn: empty MLINK: $$1 $$2 $$3"; break;; \ 2295191ded8SPaul Traina esac; \ 2305191ded8SPaul Traina name=$$1; shift; sect=$$1; shift; \ 2315191ded8SPaul Traina l=${DESTDIR}${CATDIR}$${sect}${MANSUBDIR}/$$name; \ 2325191ded8SPaul Traina name=$$1; shift; sect=$$1; shift; \ 2335191ded8SPaul Traina t=${DESTDIR}${CATDIR}$${sect}${MANSUBDIR}/$$name; \ 2345191ded8SPaul Traina ${ECHO} $${t}${ZEXT} -\> $${l}${ZEXT}; \ 2355191ded8SPaul Traina rm -f $${t} $${t}${MCOMPRESS_EXT}; \ 2365191ded8SPaul Traina ln $${l}${ZEXT} $${t}${ZEXT}; \ 2375191ded8SPaul Traina done 2385191ded8SPaul Traina.endif 239afe61c15SRodney W. Grimes.endif 240