1 1.33 phil # $NetBSD: bsd.man.mk,v 1.33 1997/06/30 19:26:21 phil Exp $ 2 1.26 mikel # @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93 3 1.1 cgd 4 1.9 mycroft .if !target(.MAIN) 5 1.1 cgd .if exists(${.CURDIR}/../Makefile.inc) 6 1.1 cgd .include "${.CURDIR}/../Makefile.inc" 7 1.9 mycroft .endif 8 1.9 mycroft 9 1.28 mycroft .MAIN: all 10 1.1 cgd .endif 11 1.28 mycroft .PHONY: catinstall maninstall catpages manpages catlinks manlinks cleanman 12 1.32 mycroft realinstall: ${MANINSTALL} 13 1.31 mycroft cleandir: cleanman 14 1.28 mycroft 15 1.28 mycroft MANTARGET?= cat 16 1.28 mycroft NROFF?= nroff 17 1.33 phil TBL?= tbl 18 1.12 jtc 19 1.25 christos .SUFFIXES: .1 .2 .3 .4 .5 .6 .7 .8 .9 \ 20 1.25 christos .cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 21 1.12 jtc 22 1.21 perry .9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3.cat3 .2.cat2 .1.cat1: 23 1.33 phil .if !defined(USETBL) 24 1.22 thorpej @echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}" 25 1.25 christos @${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || \ 26 1.25 christos (rm -f ${.TARGET}; false) 27 1.33 phil .else 28 1.33 phil @echo "${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET}" 29 1.33 phil @${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET} || \ 30 1.33 phil (rm -f ${.TARGET}; false) 31 1.33 phil .endif 32 1.12 jtc 33 1.16 cgd .if defined(MAN) && !empty(MAN) 34 1.25 christos MANPAGES= ${MAN} 35 1.25 christos CATPAGES= ${MANPAGES:C/(.*).([1-9])/\1.cat\2/} 36 1.16 cgd .endif 37 1.1 cgd 38 1.24 thorpej MINSTALL= ${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} 39 1.25 christos 40 1.20 cgd .if defined(MANZ) 41 1.20 cgd # chown and chmod are done afterward automatically 42 1.20 cgd MCOMPRESS= gzip -cf 43 1.20 cgd MCOMPRESSSUFFIX= .gz 44 1.20 cgd .endif 45 1.1 cgd 46 1.25 christos catinstall: catlinks 47 1.25 christos maninstall: manlinks 48 1.25 christos 49 1.25 christos __installpage: .USE 50 1.25 christos .if defined(MCOMPRESS) && !empty(MCOMPRESS) 51 1.25 christos @rm -f ${.TARGET} 52 1.25 christos ${MCOMPRESS} ${.ALLSRC} > ${.TARGET} 53 1.25 christos @chown ${MANOWN}:${MANGRP} ${.TARGET} 54 1.25 christos @chmod ${MANMODE} ${.TARGET} 55 1.25 christos .else 56 1.25 christos ${MINSTALL} ${.ALLSRC} ${.TARGET} 57 1.25 christos .endif 58 1.25 christos 59 1.25 christos 60 1.25 christos # Rules for cat'ed man page installation 61 1.25 christos .if defined(CATPAGES) && !empty(CATPAGES) 62 1.25 christos . for P in ${CATPAGES} 63 1.25 christos catpages:: ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX} 64 1.25 christos 65 1.25 christos . if !defined(UPDATE) 66 1.25 christos .PHONY: ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX} 67 1.25 christos . endif 68 1.25 christos . if !defined(BUILD) 69 1.25 christos ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: .MADE 70 1.25 christos . endif 71 1.25 christos 72 1.29 mycroft .PRECIOUS: ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX} 73 1.25 christos ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: ${P} __installpage 74 1.25 christos . endfor 75 1.25 christos .else 76 1.25 christos catpages:: 77 1.30 mycroft .endif 78 1.30 mycroft 79 1.30 mycroft # Rules for source page installation 80 1.30 mycroft .if defined(MANPAGES) && !empty(MANPAGES) 81 1.30 mycroft . for P in ${MANPAGES} 82 1.30 mycroft manpages:: ${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX} 83 1.30 mycroft . if !defined(UPDATE) 84 1.30 mycroft .PHONY: ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX} 85 1.30 mycroft . endif 86 1.30 mycroft 87 1.30 mycroft .PRECIOUS: ${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX} 88 1.30 mycroft ${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}: ${P} __installpage 89 1.30 mycroft . endfor 90 1.30 mycroft .else 91 1.30 mycroft manpages:: 92 1.25 christos .endif 93 1.25 christos 94 1.25 christos catlinks: catpages 95 1.25 christos .if defined(MLINKS) && !empty(MLINKS) 96 1.25 christos @set ${MLINKS}; \ 97 1.25 christos while test $$# -ge 2; do \ 98 1.25 christos name=$$1; \ 99 1.25 christos shift; \ 100 1.25 christos dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \ 101 1.25 christos l=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \ 102 1.25 christos name=$$1; \ 103 1.25 christos shift; \ 104 1.25 christos dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \ 105 1.25 christos t=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \ 106 1.25 christos if [ ! -f $$t -o -z "${UPDATE}" ]; then \ 107 1.25 christos echo $$t -\> $$l; \ 108 1.25 christos rm -f $$t; \ 109 1.25 christos ln $$l $$t; \ 110 1.25 christos fi; \ 111 1.19 brezak done 112 1.19 brezak .endif 113 1.25 christos 114 1.25 christos manlinks: manpages 115 1.1 cgd .if defined(MLINKS) && !empty(MLINKS) 116 1.1 cgd @set ${MLINKS}; \ 117 1.1 cgd while test $$# -ge 2; do \ 118 1.1 cgd name=$$1; \ 119 1.1 cgd shift; \ 120 1.25 christos dir=${DESTDIR}${MANDIR}/man$${name##*.}; \ 121 1.27 perry l=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \ 122 1.1 cgd name=$$1; \ 123 1.1 cgd shift; \ 124 1.25 christos dir=${DESTDIR}${MANDIR}/man$${name##*.}; \ 125 1.27 perry t=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \ 126 1.25 christos if [ ! -f $$t -o -z "${UPDATE}" ]; then \ 127 1.25 christos echo $$t -\> $$l; \ 128 1.25 christos rm -f $$t; \ 129 1.25 christos ln $$l $$t; \ 130 1.25 christos fi; \ 131 1.20 cgd done 132 1.8 mycroft .endif 133 1.31 mycroft 134 1.25 christos .if defined(CATPAGES) 135 1.25 christos all: ${CATPAGES} 136 1.8 mycroft 137 1.8 mycroft cleanman: 138 1.25 christos rm -f ${CATPAGES} 139 1.31 mycroft .else 140 1.31 mycroft cleanman: 141 1.1 cgd .endif 142