2001-11-04 03:30:52 +03:00
|
|
|
# $NetBSD: bsd.man.mk,v 1.65 2001/11/04 00:30:52 enami 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
|
|
|
|
.PHONY: catinstall maninstall catpages manpages catlinks manlinks \
|
|
|
|
cleanman html installhtml cleanhtml
|
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
|
1998-02-15 04:07:46 +03:00
|
|
|
TMACDIR?= ${DESTDIR}/usr/share/tmac
|
2000-09-22 09:37:57 +04:00
|
|
|
HTMLDIR?= ${DESTDIR}/usr/share/man
|
1998-02-15 04:07:46 +03:00
|
|
|
CATDEPS?= ${TMACDIR}/tmac.andoc \
|
|
|
|
${TMACDIR}/tmac.doc \
|
|
|
|
${TMACDIR}/tmac.doc-ditroff \
|
|
|
|
${TMACDIR}/tmac.doc-common \
|
|
|
|
${TMACDIR}/tmac.doc-nroff \
|
|
|
|
${TMACDIR}/tmac.doc-syms
|
1997-05-07 00:54:31 +04:00
|
|
|
MANTARGET?= cat
|
1999-04-16 22:56:19 +04:00
|
|
|
NROFF?= nroff -Tascii
|
2000-09-26 19:33:28 +04:00
|
|
|
GROFF?= groff -Tascii
|
2001-11-02 08:21:47 +03:00
|
|
|
GROFF_HTML?= groff -Tlatin1 -mdoc2html -P-b -P-o -P-u
|
1997-06-30 23:26:21 +04:00
|
|
|
TBL?= tbl
|
1993-08-16 00:59:36 +04: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
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
MANCOMPRESS?= ${MANZ:Dgzip -cf}
|
|
|
|
MANSUFFIX?= ${MANZ:D.gz}
|
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 || \
|
2001-11-02 08:21:47 +03:00
|
|
|
(echo "${INSTALL_FILE} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
|
|
|
|
${.ALLSRC} ${.TARGET}" && \
|
|
|
|
${INSTALL_FILE} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
|
|
|
|
${.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
|
|
|
.if !empty(MANSUFFIX)
|
|
|
|
realall: ${MANPAGES}
|
|
|
|
.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
|
|
|
|
cat ${.IMPSRC} ${MANCOMPRESS} > ${.TARGET}
|
|
|
|
.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}
|
|
|
|
|
|
|
|
${_F}: ${F}${MANSUFFIX} __installpage # install rule
|
|
|
|
manpages:: ${_F}
|
|
|
|
.PRECIOUS: ${_F} # keep if install fails
|
|
|
|
.PHONY: ${UPDATE:U${_F}} # clobber unless UPDATE
|
|
|
|
.if !defined(BUILD) && !make(all) && !make(${F})
|
|
|
|
${_F}: .MADE # no build at install
|
1997-05-07 19:53:28 +04:00
|
|
|
.endif
|
2001-11-02 08:21:47 +03:00
|
|
|
.endfor
|
1997-05-07 19:53:28 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
manlinks: manpages # symlink install
|
|
|
|
.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 \
|
|
|
|
echo $$t -\> $$l; \
|
|
|
|
ln -f $$l $$t; \
|
|
|
|
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}@}
|
|
|
|
|
|
|
|
${_MNUMBERS:@N@.$N.cat$N${MANSUFFIX}@}: ${CATDEPS} # build rule
|
|
|
|
.if defined(USETBL)
|
|
|
|
${TBL} ${.IMPSRC} | ${NROFF} -mandoc ${MANCOMPRESS} > ${.TARGET}
|
1999-02-12 04:10:06 +03:00
|
|
|
.else
|
2001-11-02 08:21:47 +03:00
|
|
|
${NROFF} -mandoc ${.IMPSRC} ${MANCOMPRESS} > ${.TARGET}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.for F in ${CATPAGES:S/${MANSUFFIX}$//:O:u}
|
|
|
|
_F:= ${DESTDIR}${MANDIR}/${F:T:E}${MANSUBDIR}/${F:R}.0${MANSUFFIX}
|
|
|
|
${_F}: ${F}${MANSUFFIX} __installpage # install rule
|
|
|
|
catpages:: ${_F}
|
|
|
|
.PRECIOUS: ${_F} # keep if install fails
|
|
|
|
.PHONY: ${UPDATE:U${_F}} # noclobber install
|
|
|
|
.if !defined(BUILD) && !make(all) && !make(${F})
|
|
|
|
${_F}: .MADE # no build at install
|
1999-02-12 04:10:06 +03:00
|
|
|
.endif
|
2001-11-02 08:21:47 +03:00
|
|
|
.endfor
|
1993-08-16 00:42:39 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
catlinks: catpages # symlink install
|
|
|
|
.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 \
|
|
|
|
echo $$t -\> $$l; \
|
|
|
|
ln -f $$l $$t; \
|
|
|
|
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
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
.if !defined(NOHTML)
|
|
|
|
installhtml: htmlpages
|
|
|
|
htmlpages:: # ensure target exists
|
|
|
|
HTMLPAGES= ${MAN:C/\.([1-9])$/.html\1/}
|
|
|
|
|
|
|
|
html: ${HTMLPAGES}
|
|
|
|
.NOPATH: ${HTMLPAGES}
|
|
|
|
.SUFFIXES: ${_MNUMBERS:@N@.html$N@}
|
|
|
|
|
|
|
|
${_MNUMBERS:@N@.$N.html$N@}: ${CATDEPS} # build rule
|
|
|
|
${GROFF_HTML} ${.IMPSRC} > ${.TARGET}
|
|
|
|
|
|
|
|
.for F in ${HTMLPAGES:O:u}
|
|
|
|
_F:= ${HTMLDIR}/${F:T:E}/${F:R}.html # installed path
|
|
|
|
${_F}: ${F} __installpage # install rule
|
|
|
|
htmlpages:: ${_F}
|
|
|
|
.PRECIOUS: ${_F} # keep if install fails
|
|
|
|
.PHONY: ${UPDATE:U${_F}} # noclobber install
|
|
|
|
.if !defined(BUILD) && !make(all) && !make(${F})
|
|
|
|
${_F}: .MADE # no build at install
|
2000-09-22 09:37:57 +04:00
|
|
|
.endif
|
2001-11-02 08:21:47 +03:00
|
|
|
.endfor
|
2000-09-22 09:37:57 +04:00
|
|
|
|
|
|
|
cleanhtml:
|
|
|
|
rm -f ${HTMLPAGES}
|
2001-11-02 08:21:47 +03:00
|
|
|
.endif # !defined(NOHTML)
|
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
|
1993-08-16 00:42:39 +04:00
|
|
|
cleanman:
|
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>
|
1997-10-11 12:16:24 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
${TARGETS} catinstall maninstall: # ensure existence
|