Annotation of src/share/mk/bsd.man.mk, Revision 1.16
1.16 ! millert 1: # $OpenBSD: bsd.man.mk,v 1.15 1997/04/27 21:38:30 millert Exp $
1.8 mickey 2: # $NetBSD: bsd.man.mk,v 1.23 1996/02/10 07:49:33 jtc Exp $
1.1 deraadt 3: # @(#)bsd.man.mk 5.2 (Berkeley) 5/11/90
4:
5: MANTARGET?= cat
1.5 deraadt 6: NROFF?= nroff
1.13 downsj 7: TBL?= tbl
1.1 deraadt 8:
9: .if !target(.MAIN)
10: .if exists(${.CURDIR}/../Makefile.inc)
11: .include "${.CURDIR}/../Makefile.inc"
12: .endif
13:
14: .MAIN: all
15: .endif
16:
1.16 ! millert 17: .SUFFIXES: .1 .2 .3 .3p .4 .5 .6 .7 .8 .9 .1tbl .2tbl .3tbl .4tbl .5tbl .6tbl \
1.13 downsj 18: .7tbl .8tbl .9tbl .cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9
1.1 deraadt 19:
1.16 ! millert 20: .9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3p.cat3p .3.cat3 .2.cat2 .1.cat1:
1.6 niklas 21: @echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}"
22: @${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || (rm -f ${.TARGET}; false)
1.1 deraadt 23:
1.13 downsj 24: .9tbl.cat9 .8tbl.cat8 .7tbl.cat7 .6tbl.cat6 .5tbl.cat5 .4tbl.cat4 .3tbl.cat3 \
25: .2tbl.cat2 .1tbl.cat1:
26: @echo "${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET}"
27: @${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET} || (rm -f ${.TARGET}; false)
28:
1.11 downsj 29: .if defined(MAN) && !empty(MAN) && !defined(MANALL)
1.16 ! millert 30: MANALL= ${MAN:S/.1$/.cat1/g:S/.2$/.cat2/g:S/.3$/.cat3/g:S/.3p$/.cat3p/g:S/.4$/.cat4/g:S/.5$/.cat5/g:S/.6$/.cat6/g:S/.7$/.cat7/g:S/.8$/.cat8/g:S/.9$/.cat9/g:S/.1tbl$/.cat1/g:S/.2tbl$/.cat2/g:S/.3tbl$/.cat3/g:S/.4tbl$/.cat4/g:S/.5tbl$/.cat5/g:S/.6tbl$/.cat6/g:S/.7tbl$/.cat7/g:S/.8tbl$/.cat8/g:S/.9tbl$/.cat9/g}
1.1 deraadt 31: .endif
32:
1.15 millert 33: MINSTALL= ${INSTALL} ${INSTALL_COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
1.1 deraadt 34: .if defined(MANZ)
35: # chown and chmod are done afterward automatically
36: MCOMPRESS= gzip -cf
37: MCOMPRESSSUFFIX= .gz
38: .endif
39:
40: maninstall:
41: .if defined(MANALL)
42: @for page in ${MANALL}; do \
1.6 niklas 43: dir=${DESTDIR}${MANDIR}$${page##*.cat}; \
1.10 niklas 44: base=$${page##*/}; \
45: instpage=$${dir}${MANSUBDIR}/$${base%.*}.0${MCOMPRESSSUFFIX}; \
1.1 deraadt 46: if [ X"${MCOMPRESS}" = X ]; then \
47: echo ${MINSTALL} $$page $$instpage; \
48: ${MINSTALL} $$page $$instpage; \
49: else \
50: rm -f $$instpage; \
51: echo ${MCOMPRESS} $$page \> $$instpage; \
52: ${MCOMPRESS} $$page > $$instpage; \
53: chown ${MANOWN}:${MANGRP} $$instpage; \
54: chmod ${MANMODE} $$instpage; \
55: fi \
56: done
57: .endif
58: .if defined(MLINKS) && !empty(MLINKS)
59: @set ${MLINKS}; \
60: while test $$# -ge 2; do \
61: name=$$1; \
62: shift; \
1.6 niklas 63: dir=${DESTDIR}${MANDIR}$${name##*.}; \
64: l=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
1.1 deraadt 65: name=$$1; \
66: shift; \
1.6 niklas 67: dir=${DESTDIR}${MANDIR}$${name##*.}; \
68: t=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
1.1 deraadt 69: echo $$t -\> $$l; \
70: rm -f $$t; \
71: ln $$l $$t; \
72: done
73: .endif
74:
1.12 downsj 75: .if defined(MANALL) && !defined(MANLOCALBUILD)
1.1 deraadt 76: all: ${MANALL}
77:
78: cleandir: cleanman
79: cleanman:
80: rm -f ${MANALL}
81: .endif