2004-06-23 19:28:19 +04:00
|
|
|
# $NetBSD: bsd.man.mk,v 1.93 2004/06/23 15:28:19 jmc Exp $
|
1997-03-29 11:02:45 +03:00
|
|
|
# @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
.include <bsd.init.mk>
|
1997-10-11 12:16:24 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Basic targets
|
2004-01-29 04:48:45 +03:00
|
|
|
.PHONY: catinstall maninstall catpages manpages
|
1997-05-09 17:25:46 +04:00
|
|
|
realinstall: ${MANINSTALL}
|
1997-05-07 00:54:31 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Default values
|
2001-11-13 02:16:17 +03:00
|
|
|
.if ${USETOOLS} == "yes"
|
2001-11-28 08:01:28 +03:00
|
|
|
TMACDEPDIR?= ${TOOLDIR}/share/groff/tmac
|
2001-11-13 02:16:17 +03:00
|
|
|
.else
|
2004-06-23 19:28:19 +04:00
|
|
|
TMACDEPDIR?= /usr/share/tmac
|
2001-11-13 02:16:17 +03:00
|
|
|
.endif
|
|
|
|
|
2000-09-22 09:37:57 +04:00
|
|
|
HTMLDIR?= ${DESTDIR}/usr/share/man
|
2003-06-30 22:49:05 +04:00
|
|
|
CATDEPS?= ${TMACDEPDIR}/andoc.tmac \
|
|
|
|
${TMACDEPDIR}/doc.tmac \
|
|
|
|
${TMACDEPDIR}/mdoc/doc-common \
|
|
|
|
${TMACDEPDIR}/mdoc/doc-ditroff \
|
|
|
|
${TMACDEPDIR}/mdoc/doc-nroff \
|
|
|
|
${TMACDEPDIR}/mdoc/doc-syms
|
|
|
|
HTMLDEPS?= ${TMACDEPDIR}/doc2html.tmac
|
1997-05-07 00:54:31 +04:00
|
|
|
MANTARGET?= cat
|
2001-11-13 02:16:17 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
MAN?=
|
|
|
|
MLINKS?=
|
|
|
|
_MNUMBERS= 1 2 3 4 5 6 7 8 9
|
|
|
|
.SUFFIXES: ${_MNUMBERS:@N@.$N@}
|
2000-09-22 09:37:57 +04:00
|
|
|
|
2003-07-18 06:52:51 +04:00
|
|
|
.if ${MKMANZ} == "no"
|
|
|
|
MANCOMPRESS?=
|
|
|
|
MANSUFFIX?=
|
|
|
|
.else
|
|
|
|
MANCOMPRESS?= gzip -cf
|
|
|
|
MANSUFFIX?= .gz
|
|
|
|
.endif
|
1994-01-31 21:40:10 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
# make MANCOMPRESS a filter, so it can be inserted on an as-needed basis
|
|
|
|
.if !empty(MANCOMPRESS)
|
|
|
|
MANCOMPRESS:= | ${MANCOMPRESS}
|
1997-06-30 23:26:21 +04:00
|
|
|
.endif
|
1994-01-31 21:40:10 +03:00
|
|
|
|
1997-03-25 00:54:12 +03:00
|
|
|
__installpage: .USE
|
2001-03-21 07:04:15 +03:00
|
|
|
@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
|
2003-11-07 03:05:24 +03:00
|
|
|
(${_MKSHMSG_INSTALL} ${.TARGET}; \
|
2003-10-19 07:00:55 +04:00
|
|
|
${_MKSHECHO} "${INSTALL_FILE} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
|
2002-10-22 22:48:27 +04:00
|
|
|
${SYSPKGDOCTAG} ${.ALLSRC} ${.TARGET}" && \
|
2001-11-02 08:21:47 +03:00
|
|
|
${INSTALL_FILE} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
|
2002-10-22 22:48:27 +04:00
|
|
|
${SYSPKGDOCTAG} ${.ALLSRC} ${.TARGET})
|
1997-03-25 00:54:12 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Build and install rules (source form pages)
|
1997-03-25 00:54:12 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
.if ${MKMAN} != "no"
|
|
|
|
maninstall: manlinks
|
|
|
|
manpages:: # ensure target exists
|
2001-11-04 03:30:52 +03:00
|
|
|
MANPAGES= ${MAN:C/.$/&${MANSUFFIX}/}
|
1997-03-25 00:54:12 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
realall: ${MANPAGES}
|
2001-12-18 00:27:45 +03:00
|
|
|
.if !empty(MANSUFFIX)
|
2001-11-02 08:21:47 +03:00
|
|
|
.NOPATH: ${MANPAGES}
|
|
|
|
.SUFFIXES: ${_MNUMBERS:@N@.$N${MANSUFFIX}@}
|
1997-03-25 00:54:12 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
${_MNUMBERS:@N@.$N.$N${MANSUFFIX}@}: # build rule
|
2002-01-06 04:27:25 +03:00
|
|
|
cat ${.IMPSRC} ${MANCOMPRESS} > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
|
2001-11-02 08:21:47 +03:00
|
|
|
.endif # !empty(MANSUFFIX)
|
1997-05-07 19:53:28 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
.for F in ${MANPAGES:S/${MANSUFFIX}$//:O:u}
|
|
|
|
_F:= ${DESTDIR}${MANDIR}/man${F:T:E}${MANSUBDIR}/${F}${MANSUFFIX}
|
|
|
|
|
2003-07-18 12:26:01 +04:00
|
|
|
.if ${MKUPDATE} == "no"
|
2002-02-12 00:14:58 +03:00
|
|
|
${_F}! ${F}${MANSUFFIX} __installpage # install rule
|
|
|
|
.if !defined(BUILD) && !make(all) && !make(${F})
|
|
|
|
${_F}! .MADE # no build at install
|
|
|
|
.endif
|
|
|
|
.else
|
2001-11-02 08:21:47 +03:00
|
|
|
${_F}: ${F}${MANSUFFIX} __installpage # install rule
|
|
|
|
.if !defined(BUILD) && !make(all) && !make(${F})
|
|
|
|
${_F}: .MADE # no build at install
|
1997-05-07 19:53:28 +04:00
|
|
|
.endif
|
2002-02-12 00:14:58 +03:00
|
|
|
.endif
|
|
|
|
|
|
|
|
manpages:: ${_F}
|
|
|
|
.PRECIOUS: ${_F} # keep if install fails
|
2001-11-02 08:21:47 +03:00
|
|
|
.endfor
|
1997-05-07 19:53:28 +04:00
|
|
|
|
2004-01-29 04:48:45 +03:00
|
|
|
manlinks: .PHONY manpages # symlink install
|
2001-11-02 08:21:47 +03:00
|
|
|
.if !empty(MLINKS)
|
1993-03-21 12:45:37 +03:00
|
|
|
@set ${MLINKS}; \
|
|
|
|
while test $$# -ge 2; do \
|
2001-11-02 08:21:47 +03:00
|
|
|
name=$$1; shift; \
|
|
|
|
dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
|
|
|
|
l=$${dir}${MANSUBDIR}/$${name}${MANSUFFIX}; \
|
|
|
|
name=$$1; shift; \
|
|
|
|
dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
|
|
|
|
t=$${dir}${MANSUBDIR}/$${name}${MANSUFFIX}; \
|
2000-08-13 10:56:25 +04:00
|
|
|
if test $$l -nt $$t -o ! -f $$t; then \
|
2003-11-07 03:05:24 +03:00
|
|
|
${_MKSHMSG_INSTALL} $$t; \
|
2003-11-07 01:59:03 +03:00
|
|
|
${_MKSHECHO} ${INSTALL_LINK} ${SYSPKGDOCTAG} $$l $$t; \
|
2002-10-22 22:48:27 +04:00
|
|
|
${INSTALL_LINK} ${SYSPKGDOCTAG} $$l $$t; \
|
2000-08-13 10:56:25 +04:00
|
|
|
fi; \
|
1995-06-07 05:15:20 +04:00
|
|
|
done
|
1993-03-21 12:45:37 +03:00
|
|
|
.endif
|
2001-11-02 08:21:47 +03:00
|
|
|
.endif # ${MKMAN} != "no"
|
|
|
|
|
|
|
|
##### Build and install rules (plaintext pages)
|
|
|
|
|
|
|
|
.if (${MKCATPAGES} != "no") && (${MKMAN} != "no")
|
|
|
|
catinstall: catlinks
|
|
|
|
catpages:: # ensure target exists
|
|
|
|
CATPAGES= ${MAN:C/\.([1-9])$/.cat\1${MANSUFFIX}/}
|
|
|
|
|
|
|
|
realall: ${CATPAGES}
|
|
|
|
.NOPATH: ${CATPAGES}
|
|
|
|
.SUFFIXES: ${_MNUMBERS:@N@.cat$N${MANSUFFIX}@}
|
2002-02-04 20:25:44 +03:00
|
|
|
.MADE: ${CATDEPS}
|
2002-02-07 03:52:23 +03:00
|
|
|
.MADE: ${HTMLDEPS}
|
2001-11-02 08:21:47 +03:00
|
|
|
|
|
|
|
${_MNUMBERS:@N@.$N.cat$N${MANSUFFIX}@}: ${CATDEPS} # build rule
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_FORMAT}
|
2001-11-02 08:21:47 +03:00
|
|
|
.if defined(USETBL)
|
2003-07-10 14:33:58 +04:00
|
|
|
${TOOL_TBL} ${.IMPSRC} | ${TOOL_ROFF_ASCII} -mandoc ${MANCOMPRESS} \
|
|
|
|
> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
|
1999-02-12 04:10:06 +03:00
|
|
|
.else
|
2003-07-10 14:33:58 +04:00
|
|
|
${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \
|
|
|
|
> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
|
2001-11-02 08:21:47 +03:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.for F in ${CATPAGES:S/${MANSUFFIX}$//:O:u}
|
|
|
|
_F:= ${DESTDIR}${MANDIR}/${F:T:E}${MANSUBDIR}/${F:R}.0${MANSUFFIX}
|
2002-02-12 00:14:58 +03:00
|
|
|
|
2003-07-18 12:26:01 +04:00
|
|
|
.if ${MKUPDATE} == "no"
|
2002-02-12 00:14:58 +03:00
|
|
|
${_F}! ${F}${MANSUFFIX} __installpage # install rule
|
|
|
|
.if !defined(BUILD) && !make(all) && !make(${F})
|
|
|
|
${_F}! .MADE # no build at install
|
|
|
|
.endif
|
|
|
|
.else
|
2001-11-02 08:21:47 +03:00
|
|
|
${_F}: ${F}${MANSUFFIX} __installpage # install rule
|
|
|
|
.if !defined(BUILD) && !make(all) && !make(${F})
|
|
|
|
${_F}: .MADE # no build at install
|
1999-02-12 04:10:06 +03:00
|
|
|
.endif
|
2002-02-12 00:14:58 +03:00
|
|
|
.endif
|
|
|
|
|
|
|
|
catpages:: ${_F}
|
|
|
|
.PRECIOUS: ${_F} # keep if install fails
|
2001-11-02 08:21:47 +03:00
|
|
|
.endfor
|
1993-08-16 00:42:39 +04:00
|
|
|
|
2004-01-29 04:48:45 +03:00
|
|
|
catlinks: .PHONY catpages # symlink install
|
2001-11-02 08:21:47 +03:00
|
|
|
.if !empty(MLINKS)
|
1997-03-25 00:54:12 +03:00
|
|
|
@set ${MLINKS}; \
|
|
|
|
while test $$# -ge 2; do \
|
2001-11-02 08:21:47 +03:00
|
|
|
name=$$1; shift; \
|
|
|
|
dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
|
|
|
|
l=$${dir}${MANSUBDIR}/$${name%.*}.0${MANSUFFIX}; \
|
|
|
|
name=$$1; shift; \
|
|
|
|
dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
|
|
|
|
t=$${dir}${MANSUBDIR}/$${name%.*}.0${MANSUFFIX}; \
|
2000-08-13 10:56:25 +04:00
|
|
|
if test $$l -nt $$t -o ! -f $$t; then \
|
2003-11-07 03:05:24 +03:00
|
|
|
${_MKSHMSG_INSTALL} $$t; \
|
2003-11-07 01:59:03 +03:00
|
|
|
${_MKSHECHO} ${INSTALL_LINK} ${SYSPKGDOCTAG} $$l $$t; \
|
2002-10-22 22:48:27 +04:00
|
|
|
${INSTALL_LINK} ${SYSPKGDOCTAG} $$l $$t; \
|
2000-08-13 10:56:25 +04:00
|
|
|
fi; \
|
1997-03-25 00:54:12 +03:00
|
|
|
done
|
|
|
|
.endif
|
2001-11-02 08:21:47 +03:00
|
|
|
.endif # (${MKCATPAGES} != "no") && (${MKMAN} != "no")
|
1997-05-07 20:45:40 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Build and install rules (HTML pages)
|
2000-09-22 09:37:57 +04:00
|
|
|
|
2003-07-18 06:52:51 +04:00
|
|
|
.if ${MKHTML} != "no" # {
|
2004-01-29 04:48:45 +03:00
|
|
|
installhtml: .PHONY htmlpages
|
2001-11-02 08:21:47 +03:00
|
|
|
htmlpages:: # ensure target exists
|
|
|
|
HTMLPAGES= ${MAN:C/\.([1-9])$/.html\1/}
|
|
|
|
|
2004-01-29 04:48:45 +03:00
|
|
|
html: .PHONY ${HTMLPAGES}
|
2001-11-02 08:21:47 +03:00
|
|
|
.NOPATH: ${HTMLPAGES}
|
|
|
|
.SUFFIXES: ${_MNUMBERS:@N@.html$N@}
|
|
|
|
|
2002-02-07 03:52:23 +03:00
|
|
|
${_MNUMBERS:@N@.$N.html$N@}: ${HTMLDEPS} # build rule
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_FORMAT}
|
2003-07-10 14:33:58 +04:00
|
|
|
${TOOL_ROFF_HTML} ${.IMPSRC} > ${.TARGET}.tmp && \
|
|
|
|
mv ${.TARGET}.tmp ${.TARGET}
|
2001-11-02 08:21:47 +03:00
|
|
|
|
|
|
|
.for F in ${HTMLPAGES:O:u}
|
2002-02-07 04:56:02 +03:00
|
|
|
# construct installed path
|
|
|
|
_F:= ${HTMLDIR}/${F:T:E}${MANSUBDIR}/${F:R:S-/index$-/x&-}.html
|
2002-02-12 00:14:58 +03:00
|
|
|
|
2003-07-18 12:26:01 +04:00
|
|
|
.if ${MKUPDATE} == "no"
|
2002-02-12 00:14:58 +03:00
|
|
|
${_F}! ${F} __installpage # install rule
|
|
|
|
.if !defined(BUILD) && !make(all) && !make(${F})
|
|
|
|
${_F}! .MADE # no build at install
|
|
|
|
.endif
|
|
|
|
.else
|
2001-11-02 08:21:47 +03:00
|
|
|
${_F}: ${F} __installpage # install rule
|
|
|
|
.if !defined(BUILD) && !make(all) && !make(${F})
|
|
|
|
${_F}: .MADE # no build at install
|
2000-09-22 09:37:57 +04:00
|
|
|
.endif
|
2002-02-12 00:14:58 +03:00
|
|
|
.endif
|
|
|
|
|
|
|
|
htmlpages:: ${_F}
|
|
|
|
.PRECIOUS: ${_F} # keep if install fails
|
2001-11-02 08:21:47 +03:00
|
|
|
.endfor
|
2000-09-22 09:37:57 +04:00
|
|
|
|
2004-01-29 04:48:45 +03:00
|
|
|
cleanhtml: .PHONY
|
2000-09-22 09:37:57 +04:00
|
|
|
rm -f ${HTMLPAGES}
|
2003-07-18 06:52:51 +04:00
|
|
|
.endif # }
|
2000-09-22 09:37:57 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Clean rules
|
|
|
|
.undef _F
|
1993-08-16 00:42:39 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
cleandir: cleanman
|
2004-01-29 04:48:45 +03:00
|
|
|
cleanman: .PHONY
|
2001-11-02 08:21:47 +03:00
|
|
|
.if !empty(MAN) && (${MKMAN} != "no")
|
|
|
|
.if (${MKCATPAGES} != "no")
|
1997-03-25 00:54:12 +03:00
|
|
|
rm -f ${CATPAGES}
|
1993-08-16 00:42:39 +04:00
|
|
|
.endif
|
2001-11-02 08:21:47 +03:00
|
|
|
.if !empty(MANSUFFIX)
|
|
|
|
rm -f ${MANPAGES} ${CATPAGES:S/${MANSUFFIX}$//}
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
# (XXX ${CATPAGES:S...} cleans up old .catN files where .catN.gz now used)
|
|
|
|
|
|
|
|
##### Pull in related .mk logic
|
|
|
|
.include <bsd.obj.mk>
|
2003-09-03 09:40:12 +04:00
|
|
|
.include <bsd.files.mk>
|
2001-11-17 23:38:45 +03:00
|
|
|
.include <bsd.sys.mk>
|
1997-10-11 12:16:24 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
${TARGETS} catinstall maninstall: # ensure existence
|