Annotation of src/share/mk/bsd.man.mk, Revision 1.26
1.26 ! espie 1: # $OpenBSD: bsd.man.mk,v 1.25 2003/08/07 10:52:48 espie 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.20 deraadt 6: NROFF?= nroff -Tascii
1.13 downsj 7: TBL?= tbl
1.26 ! espie 8: MANLINT?= \#
1.1 deraadt 9:
10: .if !target(.MAIN)
1.25 espie 11: . if exists(${.CURDIR}/../Makefile.inc)
12: . include "${.CURDIR}/../Makefile.inc"
13: . endif
1.1 deraadt 14:
15: .MAIN: all
16: .endif
17:
1.16 millert 18: .SUFFIXES: .1 .2 .3 .3p .4 .5 .6 .7 .8 .9 .1tbl .2tbl .3tbl .4tbl .5tbl .6tbl \
1.19 deraadt 19: .7tbl .8tbl .9tbl .cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 \
20: .ps1 .ps2 .ps3 .ps4 .ps5 .ps6 .ps7 .ps8 .ps9
1.1 deraadt 21:
1.16 millert 22: .9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3p.cat3p .3.cat3 .2.cat2 .1.cat1:
1.20 deraadt 23: @echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}"
1.26 ! espie 24: @${MANLINT} ${.IMPSRC}
1.20 deraadt 25: @${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || (rm -f ${.TARGET}; false)
1.1 deraadt 26:
1.13 downsj 27: .9tbl.cat9 .8tbl.cat8 .7tbl.cat7 .6tbl.cat6 .5tbl.cat5 .4tbl.cat4 .3tbl.cat3 \
28: .2tbl.cat2 .1tbl.cat1:
1.20 deraadt 29: @echo "${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET}"
1.26 ! espie 30: @${MANLINT} -tbl ${.IMPSRC}
1.20 deraadt 31: @${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET} || \
1.19 deraadt 32: (rm -f ${.TARGET}; false)
33:
34: .9.ps9 .8.ps8 .7.ps7 .6.ps6 .5.ps5 .4.ps4 .3p.ps3p .3.ps3 .2.ps2 .1.ps1:
35: @echo "nroff -Tps -mandoc ${.IMPSRC} > ${.TARGET}"
36: @nroff -Tps -mandoc ${.IMPSRC} > ${.TARGET} || (rm -f ${.TARGET}; false)
37:
38: .9tbl.ps9 .8tbl.ps8 .7tbl.ps7 .6tbl.ps6 .5tbl.ps5 .4tbl.ps4 .3tbl.ps3 \
39: .2tbl.ps2 .1tbl.ps1:
40: @echo "${TBL} ${.IMPSRC} | nroff -Tps -mandoc > ${.TARGET}"
41: @${TBL} ${.IMPSRC} | nroff -Tps -mandoc > ${.TARGET} || (rm -f ${.TARGET}; false)
1.13 downsj 42:
1.11 downsj 43: .if defined(MAN) && !empty(MAN) && !defined(MANALL)
1.25 espie 44: . for v s in MANALL .cat PS2ALL .ps
1.19 deraadt 45:
1.25 espie 46: $v= ${MAN:S/.1$/$s1/g:S/.2$/$s2/g:S/.3$/$s3/g:S/.3p$/$s3p/g:S/.4$/$s4/g:S/.5$/$s5/g:S/.6$/$s6/g:S/.7$/$s7/g:S/.8$/$s8/g:S/.9$/$s9/g:S/.1tbl$/$s1/g:S/.2tbl$/$s2/g:S/.3tbl$/$s3/g:S/.4tbl$/$s4/g:S/.5tbl$/$s5/g:S/.6tbl$/$s6/g:S/.7tbl$/$s7/g:S/.8tbl$/$s8/g:S/.9tbl$/$s9/g}
1.19 deraadt 47:
1.25 espie 48: . endfor
1.24 deraadt 49:
1.25 espie 50: . if defined(MANPS)
1.24 deraadt 51: PSALL=${PS2ALL}
1.25 espie 52: . endif
1.19 deraadt 53:
1.1 deraadt 54: .endif
55:
1.15 millert 56: MINSTALL= ${INSTALL} ${INSTALL_COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
1.1 deraadt 57: .if defined(MANZ)
58: # chown and chmod are done afterward automatically
59: MCOMPRESS= gzip -cf
60: MCOMPRESSSUFFIX= .gz
61: .endif
62:
1.18 espie 63: .if defined(MANSUBDIR)
64: # Add / so that we don't have to specify it. Better arch -> MANSUBDIR mapping
65: MANSUBDIR:=${MANSUBDIR:S,^,/,}
66: .else
67: # XXX MANSUBDIR must be non empty for the mlink loops to work
68: MANSUBDIR=''
69: .endif
70:
1.25 espie 71: .if !defined(MCOMPRESS) || empty(MCOMPRESS)
72: install_manpage_fragment= \
73: echo ${MINSTALL} $$page $$instpage; \
74: ${MINSTALL} $$page $$instpage
75: .else
76: install_manpage_fragment= \
77: rm -f $$instpage; \
78: echo ${MCOMPRESS} $$page \> $$instpage; \
79: ${MCOMPRESS} $$page > $$instpage; \
80: chown ${MANOWN}:${MANGRP} $$instpage; \
81: chmod ${MANMODE} $$instpage
82: .endif
83:
1.1 deraadt 84: maninstall:
1.25 espie 85: .for v s t in MANALL .cat .0 PSALL .ps .ps
86: . if defined($v)
87: @for page in ${$v}; do \
1.18 espie 88: set -- ${MANSUBDIR}; \
89: subdir=$$1; \
1.25 espie 90: dir=${DESTDIR}${MANDIR}$${page##*$s}; \
1.10 niklas 91: base=$${page##*/}; \
1.25 espie 92: instpage=$${dir}$${subdir}/$${base%.*}$t${MCOMPRESSSUFFIX}; \
93: ${install_manpage_fragment}; \
1.18 espie 94: while test $$# -ge 2; do \
95: shift; \
1.25 espie 96: extra=$${dir}$$1/$${base%.*}$t${MCOMPRESSSUFFIX}; \
1.18 espie 97: echo $$extra -\> $$instpage; \
98: ln -f $$instpage $$extra; \
99: done; \
1.1 deraadt 100: done
1.25 espie 101: . endif
102: .endfor
103:
1.1 deraadt 104: .if defined(MLINKS) && !empty(MLINKS)
1.23 espie 105: . for sub in ${MANSUBDIR}
106: . for lnk file in ${MLINKS}
107: @l=${DESTDIR}${MANDIR}${lnk:E}${sub}/${lnk:R}.0${MCOMPRESSSUFFIX}; \
108: t=${DESTDIR}${MANDIR}${file:E}${sub}/${file:R}.0${MCOMPRESSSUFFIX}; \
109: echo $$t -\> $$l; \
110: rm -f $$t; ln $$l $$t;
111: . endfor
1.18 espie 112: . endfor
1.1 deraadt 113: .endif
114:
1.19 deraadt 115: .if (defined(MANALL) || defined(PSALL)) && !defined(MANLOCALBUILD)
116: all: ${MANALL} ${PSALL}
1.1 deraadt 117:
118: cleandir: cleanman
119: cleanman:
1.24 deraadt 120: rm -f ${MANALL} ${PS2ALL}
1.1 deraadt 121: .endif