Annotation of src/share/mk/bsd.man.mk, Revision 1.18
1.18 ! espie 1: # $OpenBSD: bsd.man.mk,v 1.17 1999/11/27 04:31:12 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.17 millert 6: NROFF?= nroff -Tascii
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:
1.18 ! espie 40: .if defined(MANSUBDIR)
! 41: # Add / so that we don't have to specify it. Better arch -> MANSUBDIR mapping
! 42: MANSUBDIR:=${MANSUBDIR:S,^,/,}
! 43: .else
! 44: # XXX MANSUBDIR must be non empty for the mlink loops to work
! 45: MANSUBDIR=''
! 46: .endif
! 47:
1.1 deraadt 48: maninstall:
49: .if defined(MANALL)
50: @for page in ${MANALL}; do \
1.18 ! espie 51: set -- ${MANSUBDIR}; \
! 52: subdir=$$1; \
1.6 niklas 53: dir=${DESTDIR}${MANDIR}$${page##*.cat}; \
1.10 niklas 54: base=$${page##*/}; \
1.18 ! espie 55: instpage=$${dir}$${subdir}/$${base%.*}.0${MCOMPRESSSUFFIX}; \
1.1 deraadt 56: if [ X"${MCOMPRESS}" = X ]; then \
57: echo ${MINSTALL} $$page $$instpage; \
58: ${MINSTALL} $$page $$instpage; \
59: else \
60: rm -f $$instpage; \
61: echo ${MCOMPRESS} $$page \> $$instpage; \
62: ${MCOMPRESS} $$page > $$instpage; \
63: chown ${MANOWN}:${MANGRP} $$instpage; \
64: chmod ${MANMODE} $$instpage; \
1.18 ! espie 65: fi; \
! 66: while test $$# -ge 2; do \
! 67: shift; \
! 68: extra=$${dir}$$1/$${base%.*}.0${MCOMPRESSSUFFIX}; \
! 69: echo $$extra -\> $$instpage; \
! 70: ln -f $$instpage $$extra; \
! 71: done; \
1.1 deraadt 72: done
73: .endif
74: .if defined(MLINKS) && !empty(MLINKS)
1.18 ! espie 75: . for _subdir in ${MANSUBDIR}
1.1 deraadt 76: @set ${MLINKS}; \
77: while test $$# -ge 2; do \
78: name=$$1; \
79: shift; \
1.6 niklas 80: dir=${DESTDIR}${MANDIR}$${name##*.}; \
1.18 ! espie 81: l=$${dir}${_subdir}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
1.1 deraadt 82: name=$$1; \
83: shift; \
1.6 niklas 84: dir=${DESTDIR}${MANDIR}$${name##*.}; \
1.18 ! espie 85: t=$${dir}${_subdir}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
1.1 deraadt 86: echo $$t -\> $$l; \
87: rm -f $$t; \
88: ln $$l $$t; \
89: done
1.18 ! espie 90: . endfor
1.1 deraadt 91: .endif
92:
1.12 downsj 93: .if defined(MANALL) && !defined(MANLOCALBUILD)
1.1 deraadt 94: all: ${MANALL}
95:
96: cleandir: cleanman
97: cleanman:
98: rm -f ${MANALL}
99: .endif