1 1.60 simonb # $NetBSD: bsd.man.mk,v 1.60 2001/03/21 04:04:15 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.49 perry .include <bsd.depall.mk> 12 1.28 mycroft .MAIN: all 13 1.1 cgd .endif 14 1.34 mycroft 15 1.56 phil .PHONY: catinstall maninstall catpages manpages catlinks manlinks cleanman html installhtml cleanhtml 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.56 phil HTMLDIR?= ${DESTDIR}/usr/share/man 23 1.37 thorpej CATDEPS?= ${TMACDIR}/tmac.andoc \ 24 1.37 thorpej ${TMACDIR}/tmac.doc \ 25 1.37 thorpej ${TMACDIR}/tmac.doc-ditroff \ 26 1.37 thorpej ${TMACDIR}/tmac.doc-common \ 27 1.37 thorpej ${TMACDIR}/tmac.doc-nroff \ 28 1.37 thorpej ${TMACDIR}/tmac.doc-syms 29 1.28 mycroft MANTARGET?= cat 30 1.46 mycroft NROFF?= nroff -Tascii 31 1.57 phil GROFF?= groff -Tascii 32 1.33 phil TBL?= tbl 33 1.12 jtc 34 1.56 phil 35 1.25 christos .SUFFIXES: .1 .2 .3 .4 .5 .6 .7 .8 .9 \ 36 1.56 phil .cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 \ 37 1.56 phil .html1 .html2 .html3 .html4 .html5 .html6 .html7 .html8 .html9 38 1.12 jtc 39 1.37 thorpej .9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3.cat3 .2.cat2 .1.cat1: \ 40 1.37 thorpej ${CATDEPS} 41 1.33 phil .if !defined(USETBL) 42 1.59 tron @echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}" 43 1.59 tron @${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || \ 44 1.25 christos (rm -f ${.TARGET}; false) 45 1.33 phil .else 46 1.59 tron @echo "${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET}" 47 1.59 tron @${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET} || \ 48 1.33 phil (rm -f ${.TARGET}; false) 49 1.33 phil .endif 50 1.12 jtc 51 1.56 phil .9.html9 .8.html8 .7.html7 .6.html6 .5.html5 .4.html4 .3.html3 .2.html2 .1.html1: \ 52 1.56 phil ${CATDEPS} 53 1.56 phil .if !defined(USETBL) 54 1.57 phil @echo "${GROFF} -mdoc2html -P-b -P-u -P-o ${.IMPSRC} > ${.TARGET}" 55 1.57 phil @${GROFF} -mdoc2html -P-b -P-u -P-o ${.IMPSRC} > ${.TARGET} || \ 56 1.56 phil (rm -f ${.TARGET}; false) 57 1.56 phil .else 58 1.57 phil @echo "${TBL} ${.IMPSRC} | ${GROFF} -mdoc2html -P-b -P-u -P-o > ${.TARGET}" 59 1.57 phil @cat ${.IMPSRC} | ${GROFF} -mdoc2html -P-b -P-u -P-o > ${.TARGET} || \ 60 1.56 phil (rm -f ${.TARGET}; false) 61 1.56 phil .endif 62 1.56 phil 63 1.16 cgd .if defined(MAN) && !empty(MAN) 64 1.25 christos MANPAGES= ${MAN} 65 1.25 christos CATPAGES= ${MANPAGES:C/(.*).([1-9])/\1.cat\2/} 66 1.51 erh .NOPATH: ${CATPAGES} 67 1.56 phil .if !defined(NOHTML) 68 1.56 phil HTMLPAGES= ${MANPAGES:C/(.*).([1-9])/\1.html\2/} 69 1.56 phil .endif 70 1.16 cgd .endif 71 1.1 cgd 72 1.47 simonb MINSTALL= ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \ 73 1.47 simonb -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} 74 1.25 christos 75 1.20 cgd .if defined(MANZ) 76 1.20 cgd # chown and chmod are done afterward automatically 77 1.20 cgd MCOMPRESS= gzip -cf 78 1.20 cgd MCOMPRESSSUFFIX= .gz 79 1.20 cgd .endif 80 1.1 cgd 81 1.25 christos catinstall: catlinks 82 1.25 christos maninstall: manlinks 83 1.25 christos 84 1.25 christos __installpage: .USE 85 1.25 christos .if defined(MCOMPRESS) && !empty(MCOMPRESS) 86 1.25 christos @rm -f ${.TARGET} 87 1.25 christos ${MCOMPRESS} ${.ALLSRC} > ${.TARGET} 88 1.25 christos @chown ${MANOWN}:${MANGRP} ${.TARGET} 89 1.25 christos @chmod ${MANMODE} ${.TARGET} 90 1.25 christos .else 91 1.60 simonb @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \ 92 1.60 simonb (echo "${MINSTALL} ${.ALLSRC} ${.TARGET}" && \ 93 1.60 simonb ${MINSTALL} ${.ALLSRC} ${.TARGET}) 94 1.25 christos .endif 95 1.25 christos 96 1.25 christos 97 1.25 christos # Rules for cat'ed man page installation 98 1.43 lukem .if defined(CATPAGES) && !empty(CATPAGES) && ${MKCATPAGES} != "no" 99 1.52 mycroft catpages:: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@} 100 1.53 mycroft .PRECIOUS: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@} 101 1.53 mycroft .if !defined(UPDATE) 102 1.52 mycroft .PHONY: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@} 103 1.53 mycroft .endif 104 1.52 mycroft 105 1.25 christos . for P in ${CATPAGES} 106 1.48 fredb . if !defined(BUILD) && !make(all) && !make(${P}) 107 1.25 christos ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: .MADE 108 1.25 christos . endif 109 1.25 christos ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: ${P} __installpage 110 1.25 christos . endfor 111 1.25 christos .else 112 1.25 christos catpages:: 113 1.30 mycroft .endif 114 1.30 mycroft 115 1.30 mycroft # Rules for source page installation 116 1.30 mycroft .if defined(MANPAGES) && !empty(MANPAGES) 117 1.52 mycroft manpages:: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@} 118 1.53 mycroft .PRECIOUS: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@} 119 1.53 mycroft .if !defined(UPDATE) 120 1.52 mycroft .PHONY: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@} 121 1.53 mycroft .endif 122 1.52 mycroft 123 1.30 mycroft . for P in ${MANPAGES} 124 1.30 mycroft ${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}: ${P} __installpage 125 1.30 mycroft . endfor 126 1.30 mycroft .else 127 1.30 mycroft manpages:: 128 1.25 christos .endif 129 1.25 christos 130 1.43 lukem .if ${MKCATPAGES} != "no" 131 1.25 christos catlinks: catpages 132 1.25 christos .if defined(MLINKS) && !empty(MLINKS) 133 1.25 christos @set ${MLINKS}; \ 134 1.25 christos while test $$# -ge 2; do \ 135 1.25 christos name=$$1; \ 136 1.25 christos shift; \ 137 1.25 christos dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \ 138 1.25 christos l=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \ 139 1.25 christos name=$$1; \ 140 1.25 christos shift; \ 141 1.25 christos dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \ 142 1.25 christos t=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \ 143 1.55 itojun if test $$l -nt $$t -o ! -f $$t; then \ 144 1.55 itojun echo $$t -\> $$l; \ 145 1.55 itojun ln -f $$l $$t; \ 146 1.55 itojun fi; \ 147 1.19 brezak done 148 1.19 brezak .endif 149 1.43 lukem .else 150 1.43 lukem catlinks: 151 1.43 lukem .endif 152 1.25 christos 153 1.25 christos manlinks: manpages 154 1.1 cgd .if defined(MLINKS) && !empty(MLINKS) 155 1.1 cgd @set ${MLINKS}; \ 156 1.1 cgd while test $$# -ge 2; do \ 157 1.1 cgd name=$$1; \ 158 1.1 cgd shift; \ 159 1.25 christos dir=${DESTDIR}${MANDIR}/man$${name##*.}; \ 160 1.27 perry l=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \ 161 1.1 cgd name=$$1; \ 162 1.1 cgd shift; \ 163 1.25 christos dir=${DESTDIR}${MANDIR}/man$${name##*.}; \ 164 1.27 perry t=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \ 165 1.55 itojun if test $$l -nt $$t -o ! -f $$t; then \ 166 1.55 itojun echo $$t -\> $$l; \ 167 1.55 itojun ln -f $$l $$t; \ 168 1.55 itojun fi; \ 169 1.20 cgd done 170 1.8 mycroft .endif 171 1.56 phil 172 1.56 phil # Html rules 173 1.56 phil html: ${HTMLPAGES} 174 1.56 phil 175 1.56 phil .if defined(HTMLPAGES) && !empty(HTMLPAGES) 176 1.56 phil .for P in ${HTMLPAGES} 177 1.56 phil ${HTMLDIR}/${P:T:E}/${P:T:R}.html: ${P} 178 1.56 phil ${MINSTALL} ${.ALLSRC} ${.TARGET} 179 1.56 phil .endfor 180 1.56 phil .endif 181 1.56 phil installhtml: ${HTMLPAGES:@P@${HTMLDIR}/${P:T:E}/${P:T:R}.html@} 182 1.56 phil 183 1.56 phil cleanhtml: 184 1.56 phil .if defined(HTMLPAGES) && !empty(HTMLPAGES) 185 1.56 phil rm -f ${HTMLPAGES} 186 1.56 phil .endif 187 1.56 phil 188 1.31 mycroft 189 1.25 christos .if defined(CATPAGES) 190 1.45 christos .if ${MKCATPAGES} != "no" && ${MKMAN} != "no" 191 1.50 mycroft realall: ${CATPAGES} 192 1.35 mrg .else 193 1.50 mycroft realall: 194 1.34 mycroft .endif 195 1.8 mycroft 196 1.8 mycroft cleanman: 197 1.25 christos rm -f ${CATPAGES} 198 1.31 mycroft .else 199 1.31 mycroft cleanman: 200 1.1 cgd .endif 201 1.34 mycroft 202 1.34 mycroft # Make sure all of the standard targets are defined, even if they do nothing. 203 1.34 mycroft clean depend includes lint regress tags: 204