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