freebsd-dev/share/mk/bsd.man.mk

124 lines
2.9 KiB
Makefile
Raw Normal View History

# $Id: bsd.man.mk,v 1.11 1996/05/25 21:50:54 wosch Exp $
#
# The include file <bsd.man.mk> handles installing manual pages and
# their links. <bsd.man.mk> includes the file named "../Makefile.inc"
# if it exists.
#
#
# +++ variables +++
#
# DESTDIR Change the tree where the man pages gets installed. [not set]
#
# MANDIR Base path for manual installation. [${SHAREDIR}/man/man]
#
# MANOWN Manual owner. [${SHAREOWN}]
#
# MANGRP Manual group. [${SHAREGRP}]
#
# MANMODE Manual mode. [${NOBINMODE}]
#
# MANSUBDIR Subdirectory under the manual page section, i.e. "/i386"
# or "/tahoe" for machine specific manual pages.
#
# MAN${sect} The manual pages to be installed. For sections see
# variable ${SECTIONS}
#
# _MANPAGES List of all man pages to be installed.
# (``_MANPAGES=$MAN1 $MAN2 ... $MANn'')
#
# MCOMPRESS Program to compress man pages. Output is to
# stdout. [gzip -c]
#
# MLINKS List of manual page links (using a suffix). The
# linked-to file must come first, the linked file
# second, and there may be multiple pairs. The files
# are hard-linked.
#
# NOMANCOMPRESS If you do not want unformatted manual pages to be
# compressed when they are installed. [not set]
#
#
# +++ targets +++
#
# maninstall:
# Install the manual pages and their links.
#
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
1994-05-30 19:09:18 +00:00
MANSRC?= ${.CURDIR}
MINSTALL= ${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
1994-05-30 19:09:18 +00:00
MCOMPRESS= gzip -c
ZEXTENSION= .gz
1995-12-14 18:13:14 +00:00
SECTIONS= 1 2 3 3f 4 5 6 7 8 9
1994-05-30 19:09:18 +00:00
.undef _MANPAGES
.for sect in ${SECTIONS}
.if defined(MAN${sect}) && !empty(MAN${sect})
.SUFFIXES: .${sect}
.PATH.${sect}: ${MANSRC}
_MANPAGES+= ${MAN${sect}}
.endif
.endfor
all-man: ${MANDEPEND}
.if defined(NOMANCOMPRESS)
COPY= -c
ZEXT=
.else
ZEXT= ${ZEXTENSION}
.for sect in ${SECTIONS}
.if defined(MAN${sect}) && !empty(MAN${sect})
CLEANFILES+= ${MAN${sect}:T:S/$/${ZEXTENSION}/g}
.for page in ${MAN${sect}}
.for target in ${page:T:S/$/${ZEXTENSION}/}
all-man: ${target}
${target}: ${page}
${MCOMPRESS} ${.ALLSRC} > ${.TARGET}
.endfor
.endfor
.endif
.endfor
.endif
maninstall::
.for sect in ${SECTIONS}
.if defined(MAN${sect}) && !empty(MAN${sect})
maninstall:: ${MAN${sect}}
.if defined(NOMANCOMPRESS)
${MINSTALL} ${.ALLSRC} ${DESTDIR}${MANDIR}${sect}${MANSUBDIR}
.else
${MINSTALL} ${.ALLSRC:T:S/$/${ZEXTENSION}/g} \
${DESTDIR}${MANDIR}${sect}${MANSUBDIR}
.endif
1994-05-30 19:09:18 +00:00
.endif
.endfor
1994-05-30 19:09:18 +00:00
.if defined(MLINKS) && !empty(MLINKS)
1996-05-25 21:50:54 +00:00
@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}${MANDIR}$${sect}${MANSUBDIR}/$$name; \
name=$$1; shift; sect=$$1; shift; \
t=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \
${ECHO} $${t}${ZEXT} -\> $${l}${ZEXT}; \
rm -f $${t} $${t}${ZEXTENSION}; \
ln $${l}${ZEXT} $${t}${ZEXT}; \
1996-05-25 21:50:54 +00:00
done
1994-05-30 19:09:18 +00:00
.endif