1996-05-25 23:09:49 +00:00
|
|
|
#
|
2005-01-06 11:12:43 +00:00
|
|
|
# The include file <bsd.man.mk> handles installing manual pages and
|
1997-11-09 15:03:15 +00:00
|
|
|
# their links.
|
1996-05-25 23:09:49 +00:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# +++ 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.
|
|
|
|
#
|
2001-03-26 08:04:11 +00:00
|
|
|
# MAN The manual pages to be installed. For sections see
|
1996-05-25 23:09:49 +00:00
|
|
|
# variable ${SECTIONS}
|
|
|
|
#
|
1997-03-08 23:46:56 +00:00
|
|
|
# MCOMPRESS_CMD Program to compress man pages. Output is to
|
|
|
|
# stdout. [${COMPRESS_CMD}]
|
1996-05-25 23:09:49 +00:00
|
|
|
#
|
|
|
|
# MLINKS List of manual page links (using a suffix). The
|
2005-01-06 11:12:43 +00:00
|
|
|
# linked-to file must come first, the linked file
|
|
|
|
# second, and there may be multiple pairs. The files
|
1996-05-25 23:09:49 +00:00
|
|
|
# are hard-linked.
|
|
|
|
#
|
2004-12-21 09:44:43 +00:00
|
|
|
# NO_MLINKS If you do not want install manual page links. [not set]
|
1996-12-26 22:37:30 +00:00
|
|
|
#
|
2000-05-21 03:14:38 +00:00
|
|
|
# MANFILTER command to pipe the raw man page through before compressing
|
1996-08-11 12:31:57 +00:00
|
|
|
# or installing. Can be used to do sed substitution.
|
1996-05-25 23:09:49 +00:00
|
|
|
#
|
1997-07-24 18:39:46 +00:00
|
|
|
# MANBUILDCAT create preformatted manual pages in addition to normal
|
|
|
|
# pages. [not set]
|
|
|
|
#
|
2015-01-02 14:05:30 +00:00
|
|
|
# MANDOC_CMD command and flags to create preformatted pages
|
1997-07-24 18:39:46 +00:00
|
|
|
#
|
1996-05-25 23:09:49 +00:00
|
|
|
# +++ targets +++
|
|
|
|
#
|
|
|
|
# maninstall:
|
|
|
|
# Install the manual pages and their links.
|
|
|
|
#
|
|
|
|
|
2002-04-17 13:49:29 +00:00
|
|
|
.if !target(__<bsd.init.mk>__)
|
|
|
|
.error bsd.man.mk cannot be included directly.
|
|
|
|
.endif
|
|
|
|
|
2021-03-16 06:11:56 +00:00
|
|
|
.if ${MK_MANSPLITPKG} == "no"
|
2015-02-13 00:16:05 +00:00
|
|
|
MINSTALL?= ${INSTALL} ${TAG_ARGS} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
|
2021-03-16 06:11:56 +00:00
|
|
|
.else
|
|
|
|
MINSTALL?= ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},man} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
|
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1997-07-24 18:39:46 +00:00
|
|
|
CATDIR= ${MANDIR:H:S/$/\/cat/}
|
|
|
|
CATEXT= .cat
|
2015-01-02 14:05:30 +00:00
|
|
|
MANDOC_CMD?= mandoc -Tascii
|
1997-07-24 18:39:46 +00:00
|
|
|
|
1997-03-08 23:46:56 +00:00
|
|
|
MCOMPRESS_CMD?= ${COMPRESS_CMD}
|
|
|
|
MCOMPRESS_EXT?= ${COMPRESS_EXT}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2013-01-16 23:21:04 +00:00
|
|
|
SECTIONS= 1 2 3 4 5 6 7 8 9
|
2001-03-28 14:58:08 +00:00
|
|
|
.SUFFIXES: ${SECTIONS:S/^/./g}
|
2001-03-26 08:04:11 +00:00
|
|
|
|
2015-02-13 00:16:05 +00:00
|
|
|
|
2001-03-26 08:04:11 +00:00
|
|
|
# Backwards compatibility.
|
2001-03-28 14:58:08 +00:00
|
|
|
.if !defined(MAN)
|
2007-03-12 13:54:52 +00:00
|
|
|
.for __sect in ${SECTIONS}
|
|
|
|
.if defined(MAN${__sect}) && !empty(MAN${__sect})
|
|
|
|
MAN+= ${MAN${__sect}}
|
1995-10-21 18:18:46 +00:00
|
|
|
.endif
|
|
|
|
.endfor
|
2001-03-28 14:58:08 +00:00
|
|
|
.endif
|
1995-10-21 18:18:46 +00:00
|
|
|
|
2016-02-26 22:13:31 +00:00
|
|
|
all-man:
|
1995-10-02 20:02:05 +00:00
|
|
|
|
2014-04-18 17:03:49 +00:00
|
|
|
.if ${MK_MANCOMPRESS} == "no"
|
1995-10-02 20:02:05 +00:00
|
|
|
|
1996-09-16 14:13:40 +00:00
|
|
|
# Make special arrangements to filter to a temporary file at build time
|
2014-04-18 17:03:49 +00:00
|
|
|
# for MK_MANCOMPRESS == no.
|
1996-09-16 14:13:40 +00:00
|
|
|
.if defined(MANFILTER)
|
|
|
|
FILTEXTENSION= .filt
|
|
|
|
.else
|
|
|
|
FILTEXTENSION=
|
|
|
|
.endif
|
|
|
|
|
1995-10-14 08:16:04 +00:00
|
|
|
ZEXT=
|
|
|
|
|
1996-08-11 12:31:57 +00:00
|
|
|
.if defined(MANFILTER)
|
2001-03-26 08:04:11 +00:00
|
|
|
.if defined(MAN) && !empty(MAN)
|
|
|
|
CLEANFILES+= ${MAN:T:S/$/${FILTEXTENSION}/g}
|
|
|
|
CLEANFILES+= ${MAN:T:S/$/${CATEXT}${FILTEXTENSION}/g}
|
2007-03-12 13:54:52 +00:00
|
|
|
.for __page in ${MAN}
|
|
|
|
.for __target in ${__page:T:S/$/${FILTEXTENSION}/g}
|
2016-02-26 22:13:31 +00:00
|
|
|
all-man: ${__target}
|
2007-03-12 13:54:52 +00:00
|
|
|
${__target}: ${__page}
|
1996-08-26 10:55:32 +00:00
|
|
|
${MANFILTER} < ${.ALLSRC} > ${.TARGET}
|
1996-08-11 12:31:57 +00:00
|
|
|
.endfor
|
1997-07-25 11:17:12 +00:00
|
|
|
.if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
|
2007-03-12 13:54:52 +00:00
|
|
|
.for __target in ${__page:T:S/$/${CATEXT}${FILTEXTENSION}/g}
|
2016-02-26 22:13:31 +00:00
|
|
|
all-man: ${__target}
|
2016-06-03 19:25:36 +00:00
|
|
|
${__target}: ${__page}
|
2015-01-02 14:05:30 +00:00
|
|
|
${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} > ${.TARGET}
|
1996-08-11 12:31:57 +00:00
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
.endfor
|
2015-10-22 22:29:25 +00:00
|
|
|
.endif # !empty(MAN)
|
|
|
|
.else # !defined(MANFILTER)
|
2001-03-26 08:04:11 +00:00
|
|
|
.if defined(MAN) && !empty(MAN)
|
|
|
|
CLEANFILES+= ${MAN:T:S/$/${CATEXT}/g}
|
1997-07-25 11:17:12 +00:00
|
|
|
.if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
|
2007-03-12 13:54:52 +00:00
|
|
|
.for __page in ${MAN}
|
|
|
|
.for __target in ${__page:T:S/$/${CATEXT}/g}
|
2016-02-26 22:13:31 +00:00
|
|
|
all-man: ${__target}
|
2016-06-03 19:25:36 +00:00
|
|
|
${__target}: ${__page}
|
2015-01-02 14:05:30 +00:00
|
|
|
${MANDOC_CMD} ${.ALLSRC} > ${.TARGET}
|
1997-07-24 18:39:46 +00:00
|
|
|
.endfor
|
|
|
|
.endfor
|
2002-05-13 13:04:46 +00:00
|
|
|
.else
|
2016-02-26 22:13:31 +00:00
|
|
|
all-man: ${MAN}
|
1997-07-24 18:39:46 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
2015-10-22 22:29:25 +00:00
|
|
|
.endif # defined(MANFILTER)
|
1996-08-11 12:31:57 +00:00
|
|
|
|
2015-10-22 22:29:25 +00:00
|
|
|
.else # ${MK_MANCOMPRESS} == "yes"
|
1995-10-14 08:16:04 +00:00
|
|
|
|
1997-03-08 23:46:56 +00:00
|
|
|
ZEXT= ${MCOMPRESS_EXT}
|
1995-10-14 08:16:04 +00:00
|
|
|
|
2001-03-26 08:04:11 +00:00
|
|
|
.if defined(MAN) && !empty(MAN)
|
2015-06-04 19:11:56 +00:00
|
|
|
.if ${MK_STAGING_MAN} == "yes"
|
2015-10-07 00:24:27 +00:00
|
|
|
STAGE_TARGETS+= stage_files
|
2015-06-08 23:32:27 +00:00
|
|
|
_mansets:= ${MAN:E:O:u:M*[1-9]:@s@man$s@}
|
2015-05-31 03:13:24 +00:00
|
|
|
STAGE_SETS+= ${_mansets}
|
|
|
|
.for _page in ${MAN}
|
|
|
|
stage_files.man${_page:T:E}: ${_page}
|
|
|
|
STAGE_DIR.man${_page:T:E}?= ${STAGE_OBJTOP}${MANDIR}${_page:T:E}${MANSUBDIR}
|
|
|
|
.endfor
|
|
|
|
.if !empty(MLINKS)
|
2015-06-04 19:11:56 +00:00
|
|
|
STAGE_SETS+= mlinks
|
2015-10-07 00:24:27 +00:00
|
|
|
STAGE_TARGETS+= stage_links
|
2015-06-04 19:11:56 +00:00
|
|
|
STAGE_LINKS.mlinks:= ${MLINKS:@f@${f:S,^,${MANDIR}${f:E}${MANSUBDIR}/,}@}
|
|
|
|
stage_links.mlinks: ${_mansets:@s@stage_files.$s@}
|
2015-05-31 03:13:24 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2001-03-26 08:04:11 +00:00
|
|
|
CLEANFILES+= ${MAN:T:S/$/${MCOMPRESS_EXT}/g}
|
|
|
|
CLEANFILES+= ${MAN:T:S/$/${CATEXT}${MCOMPRESS_EXT}/g}
|
2007-03-12 13:54:52 +00:00
|
|
|
.for __page in ${MAN}
|
|
|
|
.for __target in ${__page:T:S/$/${MCOMPRESS_EXT}/}
|
2016-02-26 22:13:31 +00:00
|
|
|
all-man: ${__target}
|
2016-06-03 19:25:36 +00:00
|
|
|
${__target}: ${__page}
|
1996-08-26 10:55:32 +00:00
|
|
|
.if defined(MANFILTER)
|
1997-03-08 23:46:56 +00:00
|
|
|
${MANFILTER} < ${.ALLSRC} | ${MCOMPRESS_CMD} > ${.TARGET}
|
1996-08-11 12:31:57 +00:00
|
|
|
.else
|
1997-03-08 23:46:56 +00:00
|
|
|
${MCOMPRESS_CMD} ${.ALLSRC} > ${.TARGET}
|
1996-08-11 12:31:57 +00:00
|
|
|
.endif
|
1995-10-02 20:02:05 +00:00
|
|
|
.endfor
|
1997-07-25 11:17:12 +00:00
|
|
|
.if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
|
2007-03-12 13:54:52 +00:00
|
|
|
.for __target in ${__page:T:S/$/${CATEXT}${MCOMPRESS_EXT}/}
|
2016-02-26 22:13:31 +00:00
|
|
|
all-man: ${__target}
|
2016-06-03 19:25:36 +00:00
|
|
|
${__target}: ${__page}
|
1997-07-24 18:39:46 +00:00
|
|
|
.if defined(MANFILTER)
|
2015-01-02 14:05:30 +00:00
|
|
|
${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} | ${MCOMPRESS_CMD} > ${.TARGET}
|
1997-07-24 18:39:46 +00:00
|
|
|
.else
|
2015-01-02 14:05:30 +00:00
|
|
|
${MANDOC_CMD} ${.ALLSRC} | ${MCOMPRESS_CMD} > ${.TARGET}
|
1997-07-24 18:39:46 +00:00
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
.endif
|
1995-10-02 20:02:05 +00:00
|
|
|
.endfor
|
1995-10-14 08:16:04 +00:00
|
|
|
.endif
|
1995-10-02 20:02:05 +00:00
|
|
|
|
2015-10-22 22:29:25 +00:00
|
|
|
.endif # ${MK_MANCOMPRESS} == "no"
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2016-02-04 01:08:48 +00:00
|
|
|
.if !defined(NO_MLINKS) && defined(MLINKS) && !empty(MLINKS)
|
|
|
|
.for _oname _osect _dname _dsect in ${MLINKS:C/\.([^.]*)$/.\1 \1/}
|
|
|
|
_MANLINKS+= ${MANDIR}${_osect}${MANSUBDIR}/${_oname} \
|
|
|
|
${MANDIR}${_dsect}${MANSUBDIR}/${_dname}
|
|
|
|
.if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
|
|
|
|
_MANLINKS+= ${CATDIR}${_osect}${MANSUBDIR}/${_oname} \
|
|
|
|
${CATDIR}${_dsect}${MANSUBDIR}/${_dname}
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
2016-02-26 22:13:31 +00:00
|
|
|
maninstall:
|
2001-03-26 08:04:11 +00:00
|
|
|
.if defined(MAN) && !empty(MAN)
|
2016-02-26 22:13:31 +00:00
|
|
|
maninstall: ${MAN}
|
2014-04-18 17:03:49 +00:00
|
|
|
.if ${MK_MANCOMPRESS} == "no"
|
1996-09-16 14:13:40 +00:00
|
|
|
.if defined(MANFILTER)
|
2007-03-12 13:54:52 +00:00
|
|
|
.for __page in ${MAN}
|
|
|
|
${MINSTALL} ${__page:T:S/$/${FILTEXTENSION}/g} \
|
|
|
|
${DESTDIR}${MANDIR}${__page:E}${MANSUBDIR}/${__page}
|
1997-07-25 11:17:12 +00:00
|
|
|
.if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
|
2007-03-12 13:54:52 +00:00
|
|
|
${MINSTALL} ${__page:T:S/$/${CATEXT}${FILTEXTENSION}/g} \
|
|
|
|
${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page}
|
1997-07-24 18:39:46 +00:00
|
|
|
.endif
|
1996-09-16 14:13:40 +00:00
|
|
|
.endfor
|
2015-10-22 22:29:25 +00:00
|
|
|
.else # !defined(MANFILTER)
|
|
|
|
@set ${.ALLSRC:C/\.([^.]*)$/.\1 \1/}; \
|
|
|
|
while : ; do \
|
|
|
|
case $$# in \
|
|
|
|
0) break;; \
|
|
|
|
1) echo "warn: missing extension: $$1"; break;; \
|
|
|
|
esac; \
|
|
|
|
page=$$1; shift; sect=$$1; shift; \
|
|
|
|
d=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}; \
|
|
|
|
${ECHO} ${MINSTALL} $${page} $${d}; \
|
|
|
|
${MINSTALL} $${page} $${d}; \
|
|
|
|
done
|
1997-07-25 11:17:12 +00:00
|
|
|
.if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
|
2007-03-12 13:54:52 +00:00
|
|
|
.for __page in ${MAN}
|
|
|
|
${MINSTALL} ${__page:T:S/$/${CATEXT}/} \
|
|
|
|
${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page:T}
|
1997-07-24 18:39:46 +00:00
|
|
|
.endfor
|
|
|
|
.endif
|
2015-10-22 22:29:25 +00:00
|
|
|
.endif # defined(MANFILTER)
|
|
|
|
.else # ${MK_MANCOMPRESS} == "yes"
|
2007-03-12 13:54:52 +00:00
|
|
|
.for __page in ${MAN}
|
|
|
|
${MINSTALL} ${__page:T:S/$/${MCOMPRESS_EXT}/g} \
|
2015-10-15 22:49:56 +00:00
|
|
|
${DESTDIR}${MANDIR}${__page:E}${MANSUBDIR}/
|
1997-07-25 11:17:12 +00:00
|
|
|
.if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
|
2007-03-12 13:54:52 +00:00
|
|
|
${MINSTALL} ${__page:T:S/$/${CATEXT}${MCOMPRESS_EXT}/g} \
|
|
|
|
${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page:T:S/$/${MCOMPRESS_EXT}/}
|
1997-07-24 18:39:46 +00:00
|
|
|
.endif
|
2001-03-26 08:04:11 +00:00
|
|
|
.endfor
|
2015-10-22 22:29:25 +00:00
|
|
|
.endif # ${MK_MANCOMPRESS} == "no"
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
2016-02-04 01:08:48 +00:00
|
|
|
.for l t in ${_MANLINKS}
|
2021-03-16 06:11:56 +00:00
|
|
|
.if ${MK_MANSPLITPKG} == "no"
|
2016-02-04 01:08:48 +00:00
|
|
|
rm -f ${DESTDIR}${t} ${DESTDIR}${t}${MCOMPRESS_EXT}; \
|
2018-06-29 16:07:56 +00:00
|
|
|
${INSTALL_MANLINK} ${TAG_ARGS} ${DESTDIR}${l}${ZEXT} ${DESTDIR}${t}${ZEXT}
|
2021-03-16 06:11:56 +00:00
|
|
|
.else
|
|
|
|
rm -f ${DESTDIR}${t} ${DESTDIR}${t}${MCOMPRESS_EXT}; \
|
|
|
|
${INSTALL_MANLINK} ${TAG_ARGS:D${TAG_ARGS},man} ${DESTDIR}${l}${ZEXT} ${DESTDIR}${t}${ZEXT}
|
|
|
|
.endif
|
2015-06-21 22:42:55 +00:00
|
|
|
.endfor
|
2001-09-05 11:24:34 +00:00
|
|
|
|
|
|
|
manlint:
|
|
|
|
.if defined(MAN) && !empty(MAN)
|
2007-03-12 13:54:52 +00:00
|
|
|
.for __page in ${MAN}
|
|
|
|
manlint: ${__page}lint
|
|
|
|
${__page}lint: ${__page}
|
2001-09-05 11:24:34 +00:00
|
|
|
.if defined(MANFILTER)
|
2015-01-02 13:54:03 +00:00
|
|
|
${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} -Tlint
|
2001-09-05 11:24:34 +00:00
|
|
|
.else
|
2015-01-02 13:54:03 +00:00
|
|
|
${MANDOC_CMD} -Tlint ${.ALLSRC}
|
2001-09-05 11:24:34 +00:00
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
.endif
|