Allow optional building of preformatted manual pages.

Reviewed by:	wosch
This commit is contained in:
Paul Traina 1997-07-24 18:39:46 +00:00
parent 9edce0605a
commit 5191ded867

View File

@ -1,4 +1,4 @@
# $Id: bsd.man.mk,v 1.21 1997/03/08 23:46:55 wosch Exp $
# $Id: bsd.man.mk,v 1.2 1997/07/24 18:23:57 pst Exp $
#
# The include file <bsd.man.mk> handles installing manual pages and
# their links. <bsd.man.mk> includes the file named "../Makefile.inc"
@ -42,6 +42,11 @@
# MANFILTER command to pipe the raw man page though before compressing
# or installing. Can be used to do sed substitution.
#
# MANBUILDCAT create preformatted manual pages in addition to normal
# pages. [not set]
#
# MROFF_CMD command and flags to create preformatted pages
#
# +++ targets +++
#
# maninstall:
@ -56,6 +61,11 @@
MANSRC?= ${.CURDIR}
MINSTALL= ${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
CATDIR= ${MANDIR:H:S/$/\/cat/}
CATEXT= .cat
MROFF_CMD?= groff -Tascii -man
.if defined(COMPRESS_CMD)
MCOMPRESS_CMD?= ${COMPRESS_CMD}
MCOMPRESS_EXT?= ${COMPRESS_EXT}
@ -92,16 +102,39 @@ ZEXT=
.for sect in ${SECTIONS}
.if defined(MAN${sect}) && !empty(MAN${sect})
CLEANFILES+= ${MAN${sect}:T:S/$/${FILTEXTENSION}/g}
CLEANFILES+= ${MAN${sect}:T:S/$/${CATEXT}${FILTEXTENSION}/g}
.for page in ${MAN${sect}}
.for target in ${page:T:S/$/${FILTEXTENSION}/g}
all-man: ${target}
${target}: ${page}
${MANFILTER} < ${.ALLSRC} > ${.TARGET}
.endfor
.if !empty(MANBUILDCAT)
.for target in ${page:T:S/$/${CATEXT}${FILTEXTENSION}/g}
all-man: ${target}
${target}: ${page}
${MANFILTER} < ${.ALLSRC} | ${MROFF_CMD} > ${.TARGET}
.endfor
.endif
.endfor
.endif
.endfor
.else
.for sect in ${SECTIONS}
.if defined(MAN${sect}) && !empty(MAN${sect})
CLEANFILES+= ${MAN${sect}:T:S/$/${CATEXT}/g}
.if !empty(MANBUILDCAT)
.for page in ${MAN${sect}}
.for target in ${page:T:S/$/${CATEXT}/g}
all-man: ${target}
${target}: ${page}
${MROFF_CMD} ${.ALLSRC} > ${.TARGET}
.endfor
.endfor
.endif
.endif
.endfor
.endif
.else
@ -110,6 +143,7 @@ ZEXT= ${MCOMPRESS_EXT}
.for sect in ${SECTIONS}
.if defined(MAN${sect}) && !empty(MAN${sect})
CLEANFILES+= ${MAN${sect}:T:S/$/${MCOMPRESS_EXT}/g}
CLEANFILES+= ${MAN${sect}:T:S/$/${CATEXT}${MCOMPRESS_EXT}/g}
.for page in ${MAN${sect}}
.for target in ${page:T:S/$/${MCOMPRESS_EXT}/}
all-man: ${target}
@ -120,6 +154,17 @@ ${target}: ${page}
${MCOMPRESS_CMD} ${.ALLSRC} > ${.TARGET}
.endif
.endfor
.if !empty(MANBUILDCAT)
.for target in ${page:T:S/$/${CATEXT}${MCOMPRESS_EXT}/}
all-man: ${target}
${target}: ${page}
.if defined(MANFILTER)
${MANFILTER} < ${.ALLSRC} | ${MROFF_CMD} | ${MCOMPRESS_CMD} > ${.TARGET}
.else
${MROFF_CMD} ${.ALLSRC} | ${MCOMPRESS_CMD} > ${.TARGET}
.endif
.endfor
.endif
.endfor
.endif
.endfor
@ -133,14 +178,31 @@ maninstall:: ${MAN${sect}}
.if defined(NOMANCOMPRESS)
.if defined(MANFILTER)
.for page in ${MAN${sect}}
${MINSTALL} ${page:T:S/$/${FILTEXTENSION}/g} ${DESTDIR}${MANDIR}${sect}${MANSUBDIR}/${page}
${MINSTALL} ${page:T:S/$/${FILTEXTENSION}/g} \
${DESTDIR}${MANDIR}${sect}${MANSUBDIR}/${page}
.if !empty(MANBUILDCAT)
${MINSTALL} ${page:T:S/$/${CATEXT}${FILTEXTENSION}/g} \
${DESTDIR}${CATDIR}${sect}${MANSUBDIR}/${page}
.endif
.endfor
.else
${MINSTALL} ${.ALLSRC} ${DESTDIR}${MANDIR}${sect}${MANSUBDIR}
.if !empty(MANBUILDCAT)
.for page in ${MAN${sect}}
${MINSTALL} ${page:T:S/$/${CATEXT}/} \
${DESTDIR}${CATDIR}${sect}${MANSUBDIR}/${page:T}
.endfor
.endif
.endif
.else
${MINSTALL} ${.ALLSRC:T:S/$/${MCOMPRESS_EXT}/g} \
${DESTDIR}${MANDIR}${sect}${MANSUBDIR}
.if !empty(MANBUILDCAT)
.for page in ${MAN${sect}}
${MINSTALL} ${page:T:S/$/${CATEXT}${MCOMPRESS_EXT}/g} \
${DESTDIR}${CATDIR}${sect}${MANSUBDIR}/${page:T:S/$/${MCOMPRESS_EXT}/}
.endfor
.endif
.endif
.endif
.endfor
@ -160,4 +222,20 @@ maninstall:: ${MAN${sect}}
rm -f $${t} $${t}${MCOMPRESS_EXT}; \
ln $${l}${ZEXT} $${t}${ZEXT}; \
done
.if !empty(MANBUILDCAT)
@set `echo ${MLINKS} " " | sed 's/\.\([^.]*\) /.\1 \1 /g'`; \
while : ; do \
case $$# in \
0) break;; \
[123]) echo "warn: empty MLINK: $$1 $$2 $$3"; break;; \
esac; \
name=$$1; shift; sect=$$1; shift; \
l=${DESTDIR}${CATDIR}$${sect}${MANSUBDIR}/$$name; \
name=$$1; shift; sect=$$1; shift; \
t=${DESTDIR}${CATDIR}$${sect}${MANSUBDIR}/$$name; \
${ECHO} $${t}${ZEXT} -\> $${l}${ZEXT}; \
rm -f $${t} $${t}${MCOMPRESS_EXT}; \
ln $${l}${ZEXT} $${t}${ZEXT}; \
done
.endif
.endif