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