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