1 1.53 mycroft # $NetBSD: bsd.man.mk,v 1.53 2000/06/06 09:22:02 mycroft Exp $ 2 1.26 mikel # @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93 3 1.1 cgd 4 1.34 mycroft .if !target(__initialized__) 5 1.34 mycroft __initialized__: 6 1.1 cgd .if exists(${.CURDIR}/../Makefile.inc) 7 1.1 cgd .include "${.CURDIR}/../Makefile.inc" 8 1.9 mycroft .endif 9 1.34 mycroft .include <bsd.own.mk> 10 1.34 mycroft .include <bsd.obj.mk> 11 1.49 perry .include <bsd.depall.mk> 12 1.28 mycroft .MAIN: all 13 1.1 cgd .endif 14 1.34 mycroft 15 1.28 mycroft .PHONY: catinstall maninstall catpages manpages catlinks manlinks cleanman 16 1.44 lukem .if ${MKMAN} != "no" 17 1.32 mycroft realinstall: ${MANINSTALL} 18 1.34 mycroft .endif 19 1.39 lukem cleandir distclean: cleanman 20 1.28 mycroft 21 1.37 thorpej TMACDIR?= ${DESTDIR}/usr/share/tmac 22 1.37 thorpej CATDEPS?= ${TMACDIR}/tmac.andoc \ 23 1.37 thorpej ${TMACDIR}/tmac.doc \ 24 1.37 thorpej ${TMACDIR}/tmac.doc-ditroff \ 25 1.37 thorpej ${TMACDIR}/tmac.doc-common \ 26 1.37 thorpej ${TMACDIR}/tmac.doc-nroff \ 27 1.37 thorpej ${TMACDIR}/tmac.doc-syms 28 1.28 mycroft MANTARGET?= cat 29 1.46 mycroft NROFF?= nroff -Tascii 30 1.33 phil TBL?= tbl 31 1.12 jtc 32 1.25 christos .SUFFIXES: .1 .2 .3 .4 .5 .6 .7 .8 .9 \ 33 1.25 christos .cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 34 1.12 jtc 35 1.37 thorpej .9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3.cat3 .2.cat2 .1.cat1: \ 36 1.37 thorpej ${CATDEPS} 37 1.33 phil .if !defined(USETBL) 38 1.22 thorpej @echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}" 39 1.25 christos @${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || \ 40 1.25 christos (rm -f ${.TARGET}; false) 41 1.33 phil .else 42 1.33 phil @echo "${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET}" 43 1.33 phil @${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET} || \ 44 1.33 phil (rm -f ${.TARGET}; false) 45 1.33 phil .endif 46 1.12 jtc 47 1.16 cgd .if defined(MAN) && !empty(MAN) 48 1.25 christos MANPAGES= ${MAN} 49 1.25 christos CATPAGES= ${MANPAGES:C/(.*).([1-9])/\1.cat\2/} 50 1.51 erh .NOPATH: ${CATPAGES} 51 1.16 cgd .endif 52 1.1 cgd 53 1.47 simonb MINSTALL= ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \ 54 1.47 simonb -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} 55 1.25 christos 56 1.20 cgd .if defined(MANZ) 57 1.20 cgd # chown and chmod are done afterward automatically 58 1.20 cgd MCOMPRESS= gzip -cf 59 1.20 cgd MCOMPRESSSUFFIX= .gz 60 1.20 cgd .endif 61 1.1 cgd 62 1.25 christos catinstall: catlinks 63 1.25 christos maninstall: manlinks 64 1.25 christos 65 1.25 christos __installpage: .USE 66 1.25 christos .if defined(MCOMPRESS) && !empty(MCOMPRESS) 67 1.25 christos @rm -f ${.TARGET} 68 1.25 christos ${MCOMPRESS} ${.ALLSRC} > ${.TARGET} 69 1.25 christos @chown ${MANOWN}:${MANGRP} ${.TARGET} 70 1.25 christos @chmod ${MANMODE} ${.TARGET} 71 1.25 christos .else 72 1.25 christos ${MINSTALL} ${.ALLSRC} ${.TARGET} 73 1.25 christos .endif 74 1.25 christos 75 1.25 christos 76 1.25 christos # Rules for cat'ed man page installation 77 1.43 lukem .if defined(CATPAGES) && !empty(CATPAGES) && ${MKCATPAGES} != "no" 78 1.52 mycroft catpages:: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@} 79 1.53 mycroft .PRECIOUS: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@} 80 1.53 mycroft .if !defined(UPDATE) 81 1.52 mycroft .PHONY: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@} 82 1.53 mycroft .endif 83 1.52 mycroft 84 1.25 christos . for P in ${CATPAGES} 85 1.48 fredb . if !defined(BUILD) && !make(all) && !make(${P}) 86 1.25 christos ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: .MADE 87 1.25 christos . endif 88 1.25 christos ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: ${P} __installpage 89 1.25 christos . endfor 90 1.25 christos .else 91 1.25 christos catpages:: 92 1.30 mycroft .endif 93 1.30 mycroft 94 1.30 mycroft # Rules for source page installation 95 1.30 mycroft .if defined(MANPAGES) && !empty(MANPAGES) 96 1.52 mycroft manpages:: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@} 97 1.53 mycroft .PRECIOUS: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@} 98 1.53 mycroft .if !defined(UPDATE) 99 1.52 mycroft .PHONY: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@} 100 1.53 mycroft .endif 101 1.52 mycroft 102 1.30 mycroft . for P in ${MANPAGES} 103 1.30 mycroft ${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}: ${P} __installpage 104 1.30 mycroft . endfor 105 1.30 mycroft .else 106 1.30 mycroft manpages:: 107 1.25 christos .endif 108 1.25 christos 109 1.43 lukem .if ${MKCATPAGES} != "no" 110 1.25 christos catlinks: catpages 111 1.25 christos .if defined(MLINKS) && !empty(MLINKS) 112 1.25 christos @set ${MLINKS}; \ 113 1.25 christos while test $$# -ge 2; do \ 114 1.25 christos name=$$1; \ 115 1.25 christos shift; \ 116 1.25 christos dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \ 117 1.25 christos l=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \ 118 1.25 christos name=$$1; \ 119 1.25 christos shift; \ 120 1.25 christos dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \ 121 1.25 christos t=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \ 122 1.38 fair if [ -z "${UPDATE}" -o ! -f $$t ]; then \ 123 1.25 christos echo $$t -\> $$l; \ 124 1.38 fair ln -f $$l $$t; \ 125 1.25 christos fi; \ 126 1.19 brezak done 127 1.19 brezak .endif 128 1.43 lukem .else 129 1.43 lukem catlinks: 130 1.43 lukem .endif 131 1.25 christos 132 1.25 christos manlinks: manpages 133 1.1 cgd .if defined(MLINKS) && !empty(MLINKS) 134 1.1 cgd @set ${MLINKS}; \ 135 1.1 cgd while test $$# -ge 2; do \ 136 1.1 cgd name=$$1; \ 137 1.1 cgd shift; \ 138 1.25 christos dir=${DESTDIR}${MANDIR}/man$${name##*.}; \ 139 1.27 perry l=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \ 140 1.1 cgd name=$$1; \ 141 1.1 cgd shift; \ 142 1.25 christos dir=${DESTDIR}${MANDIR}/man$${name##*.}; \ 143 1.27 perry t=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \ 144 1.38 fair if [ -z "${UPDATE}" -o ! -f $$t ]; then \ 145 1.25 christos echo $$t -\> $$l; \ 146 1.38 fair ln -f $$l $$t; \ 147 1.25 christos fi; \ 148 1.20 cgd done 149 1.8 mycroft .endif 150 1.31 mycroft 151 1.25 christos .if defined(CATPAGES) 152 1.45 christos .if ${MKCATPAGES} != "no" && ${MKMAN} != "no" 153 1.50 mycroft realall: ${CATPAGES} 154 1.35 mrg .else 155 1.50 mycroft realall: 156 1.34 mycroft .endif 157 1.8 mycroft 158 1.8 mycroft cleanman: 159 1.25 christos rm -f ${CATPAGES} 160 1.31 mycroft .else 161 1.31 mycroft cleanman: 162 1.1 cgd .endif 163 1.34 mycroft 164 1.34 mycroft # Make sure all of the standard targets are defined, even if they do nothing. 165 1.34 mycroft clean depend includes lint regress tags: 166