| @@ -1,137 +1,181 @@ | | | @@ -1,137 +1,181 @@ |
1 | # $NetBSD: OpenBSD.bsd.man.mk,v 1.1.1.1 2006/07/14 23:13:01 jlam Exp $ | | 1 | # $NetBSD: OpenBSD.bsd.man.mk,v 1.2 2012/04/15 13:03:11 obache Exp $ |
2 | # From: | | 2 | # @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93 |
3 | # OpenBSD: bsd.man.mk,v 1.23 2001/07/20 23:02:21 espie Exp | | | |
4 | # NetBSD: bsd.man.mk,v 1.23 1996/02/10 07:49:33 jtc Exp | | | |
5 | # @(#)bsd.man.mk 5.2 (Berkeley) 5/11/90 | | | |
6 | | | 3 | |
7 | MANTARGET?= cat | | 4 | .if !target(__initialized__) |
8 | NROFF?= nroff -Tascii | | 5 | __initialized__: |
9 | TBL?= tbl | | | |
10 | | | | |
11 | .if !target(.MAIN) | | | |
12 | .if exists(${.CURDIR}/../Makefile.inc) | | 6 | .if exists(${.CURDIR}/../Makefile.inc) |
13 | .include "${.CURDIR}/../Makefile.inc" | | 7 | .include "${.CURDIR}/../Makefile.inc" |
14 | .endif | | 8 | .endif |
15 | | | 9 | .include <bsd.own.mk> |
16 | .MAIN: all | | 10 | .include <bsd.obj.mk> |
| | | 11 | .include <bsd.depall.mk> |
| | | 12 | .MAIN: all |
17 | .endif | | 13 | .endif |
18 | | | 14 | |
19 | .SUFFIXES: .1 .2 .3 .3p .4 .5 .6 .7 .8 .9 .1tbl .2tbl .3tbl .4tbl .5tbl .6tbl \ | | 15 | .PHONY: catinstall maninstall catpages manpages catlinks manlinks cleanman html installhtml cleanhtml |
20 | .7tbl .8tbl .9tbl .cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 \ | | 16 | .if ${MKMAN} != "no" |
21 | .ps1 .ps2 .ps3 .ps4 .ps5 .ps6 .ps7 .ps8 .ps9 | | 17 | realinstall: ${MANINSTALL} |
22 | | | 18 | .endif |
23 | .9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3p.cat3p .3.cat3 .2.cat2 .1.cat1: | | 19 | cleandir: cleanman |
24 | @echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}" | | | |
25 | @${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || (rm -f ${.TARGET}; false) | | | |
26 | | | | |
27 | .9tbl.cat9 .8tbl.cat8 .7tbl.cat7 .6tbl.cat6 .5tbl.cat5 .4tbl.cat4 .3tbl.cat3 \ | | | |
28 | .2tbl.cat2 .1tbl.cat1: | | | |
29 | @echo "${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET}" | | | |
30 | @${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET} || \ | | | |
31 | (rm -f ${.TARGET}; false) | | | |
32 | | | 20 | |
33 | .9.ps9 .8.ps8 .7.ps7 .6.ps6 .5.ps5 .4.ps4 .3p.ps3p .3.ps3 .2.ps2 .1.ps1: | | 21 | HTMLDIR?= ${DESTDIR}/usr/share/man |
34 | @echo "nroff -Tps -mandoc ${.IMPSRC} > ${.TARGET}" | | | |
35 | @nroff -Tps -mandoc ${.IMPSRC} > ${.TARGET} || (rm -f ${.TARGET}; false) | | | |
36 | | | 22 | |
37 | .9tbl.ps9 .8tbl.ps8 .7tbl.ps7 .6tbl.ps6 .5tbl.ps5 .4tbl.ps4 .3tbl.ps3 \ | | 23 | MANTARGET?= cat |
38 | .2tbl.ps2 .1tbl.ps1: | | 24 | MANDOC?= mandoc -Tascii |
39 | @echo "${TBL} ${.IMPSRC} | nroff -Tps -mandoc > ${.TARGET}" | | | |
40 | @${TBL} ${.IMPSRC} | nroff -Tps -mandoc > ${.TARGET} || (rm -f ${.TARGET}; false) | | | |
41 | | | 25 | |
42 | .if defined(MAN) && !empty(MAN) && !defined(MANALL) | | | |
43 | | | 26 | |
44 | MANALL= ${MAN:S/.1$/.cat1/g:S/.2$/.cat2/g:S/.3$/.cat3/g:S/.3p$/.cat3p/g:S/.4$/.cat4/g:S/.5$/.cat5/g:S/.6$/.cat6/g:S/.7$/.cat7/g:S/.8$/.cat8/g:S/.9$/.cat9/g:S/.1tbl$/.cat1/g:S/.2tbl$/.cat2/g:S/.3tbl$/.cat3/g:S/.4tbl$/.cat4/g:S/.5tbl$/.cat5/g:S/.6tbl$/.cat6/g:S/.7tbl$/.cat7/g:S/.8tbl$/.cat8/g:S/.9tbl$/.cat9/g} | | 27 | .SUFFIXES: .1 .2 .3 .3p .4 .5 .6 .7 .8 .9 \ |
| | | 28 | .cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 \ |
| | | 29 | .html1 .html2 .html3 .html4 .html5 .html6 .html7 .html8 .html9 |
45 | | | 30 | |
46 | .if defined(MANPS) | | 31 | .9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 3p.cat3p .3.cat3 .2.cat2 .1.cat1: |
| | | 32 | @echo "${MANDOC} ${.IMPSRC} > ${.TARGET}" |
| | | 33 | @${MANDOC} ${.IMPSRC} > ${.TARGET} || \ |
| | | 34 | (rm -f ${.TARGET}; false) |
47 | | | 35 | |
48 | PSALL= ${MAN:S/.1$/.ps1/g:S/.2$/.ps2/g:S/.3$/.ps3/g:S/.3p$/.ps3p/g:S/.4$/.ps4/g:S/.5$/.ps5/g:S/.6$/.ps6/g:S/.7$/.ps7/g:S/.8$/.ps8/g:S/.9$/.ps9/g:S/.1tbl$/.ps1/g:S/.2tbl$/.ps2/g:S/.3tbl$/.ps3/g:S/.4tbl$/.ps4/g:S/.5tbl$/.ps5/g:S/.6tbl$/.ps6/g:S/.7tbl$/.ps7/g:S/.8tbl$/.ps8/g:S/.9tbl$/.ps9/g} | | 36 | .9.html9 .8.html8 .7.html7 .6.html6 .5.html5 .4.html4 .3p.html3p .3.html3 .2.html2 .1.html1: |
| | | 37 | @echo "${MANDOC} -Thtml ${.IMPSRC} > ${.TARGET}" |
| | | 38 | @${MANDOC} -Thtml ${.IMPSRC} > ${.TARGET} || \ |
| | | 39 | (rm -f ${.TARGET}; false) |
49 | | | 40 | |
| | | 41 | .if defined(MAN) && !empty(MAN) |
| | | 42 | MANPAGES= ${MAN} |
| | | 43 | CATPAGES= ${MANPAGES:C/(.*).([1-9]p?)/\1.cat\2/} |
| | | 44 | .NOPATH: ${CATPAGES} |
| | | 45 | .if !defined(NOHTML) |
| | | 46 | HTMLPAGES= ${MANPAGES:C/(.*).([1-9]p?)/\1.html\2/} |
50 | .endif | | 47 | .endif |
51 | | | | |
52 | .endif | | 48 | .endif |
53 | | | 49 | |
54 | MINSTALL= ${INSTALL} ${INSTALL_COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} | | 50 | MINSTALL= ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \ |
| | | 51 | -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} |
| | | 52 | |
55 | .if defined(MANZ) | | 53 | .if defined(MANZ) |
56 | # chown and chmod are done afterward automatically | | 54 | # chown and chmod are done afterward automatically |
57 | MCOMPRESS= gzip -cf | | 55 | MCOMPRESS= gzip -cf |
58 | MCOMPRESSSUFFIX= .gz | | 56 | MCOMPRESSSUFFIX= .gz |
59 | .endif | | 57 | .endif |
60 | | | 58 | |
61 | .if defined(MANSUBDIR) | | 59 | catinstall: catlinks |
62 | # Add / so that we don't have to specify it. Better arch -> MANSUBDIR mapping | | 60 | maninstall: manlinks |
63 | MANSUBDIR:=${MANSUBDIR:S,^,/,} | | 61 | |
64 | .else | | 62 | __installpage: .USE |
65 | # XXX MANSUBDIR must be non empty for the mlink loops to work | | 63 | .if defined(MCOMPRESS) && !empty(MCOMPRESS) |
66 | MANSUBDIR='' | | 64 | @rm -f ${.TARGET} |
67 | .endif | | 65 | ${MCOMPRESS} ${.ALLSRC} > ${.TARGET} |
68 | | | 66 | @chown ${MANOWN}:${MANGRP} ${.TARGET} |
69 | maninstall: | | 67 | @chmod ${MANMODE} ${.TARGET} |
70 | .if defined(MANALL) | | 68 | .else |
71 | @for page in ${MANALL}; do \ | | 69 | @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \ |
72 | set -- ${MANSUBDIR}; \ | | 70 | (echo "${MINSTALL} ${.ALLSRC} ${.TARGET}" && \ |
73 | subdir=$$1; \ | | 71 | ${MINSTALL} ${.ALLSRC} ${.TARGET}) |
74 | dir=${DESTDIR}${MANDIR}$${page##*.cat}; \ | | 72 | .endif |
75 | base=$${page##*/}; \ | | 73 | |
76 | instpage=$${dir}$${subdir}/$${base%.*}.0${MCOMPRESSSUFFIX}; \ | | 74 | |
77 | if [ X"${MCOMPRESS}" = X ]; then \ | | 75 | # Rules for cat'ed man page installation |
78 | echo ${MINSTALL} $$page $$instpage; \ | | 76 | .if defined(CATPAGES) && !empty(CATPAGES) && ${MKCATPAGES} != "no" |
79 | ${MINSTALL} $$page $$instpage; \ | | 77 | catpages:: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@} |
80 | else \ | | 78 | .PRECIOUS: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@} |
81 | rm -f $$instpage; \ | | 79 | .if !defined(UPDATE) |
82 | echo ${MCOMPRESS} $$page \> $$instpage; \ | | 80 | .PHONY: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@} |
83 | ${MCOMPRESS} $$page > $$instpage; \ | | 81 | .endif |
84 | chown ${MANOWN}:${MANGRP} $$instpage; \ | | 82 | |
85 | chmod ${MANMODE} $$instpage; \ | | 83 | . for P in ${CATPAGES:O:u} |
| | | 84 | . if !defined(BUILD) && !make(all) && !make(${P}) |
| | | 85 | ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: .MADE |
| | | 86 | . endif |
| | | 87 | ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: ${P} __installpage |
| | | 88 | . endfor |
| | | 89 | .else |
| | | 90 | catpages:: |
| | | 91 | .endif |
| | | 92 | |
| | | 93 | # Rules for source page installation |
| | | 94 | .if defined(MANPAGES) && !empty(MANPAGES) |
| | | 95 | manpages:: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@} |
| | | 96 | .PRECIOUS: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@} |
| | | 97 | .if !defined(UPDATE) |
| | | 98 | .PHONY: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@} |
| | | 99 | .endif |
| | | 100 | |
| | | 101 | . for P in ${MANPAGES:O:u} |
| | | 102 | ${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}: ${P} __installpage |
| | | 103 | . endfor |
| | | 104 | .else |
| | | 105 | manpages:: |
| | | 106 | .endif |
| | | 107 | |
| | | 108 | .if ${MKCATPAGES} != "no" |
| | | 109 | catlinks: catpages |
| | | 110 | .if defined(MLINKS) && !empty(MLINKS) |
| | | 111 | @set ${MLINKS}; \ |
| | | 112 | while test $$# -ge 2; do \ |
| | | 113 | name=$$1; \ |
| | | 114 | shift; \ |
| | | 115 | dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \ |
| | | 116 | l=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \ |
| | | 117 | name=$$1; \ |
| | | 118 | shift; \ |
| | | 119 | dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \ |
| | | 120 | t=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \ |
| | | 121 | if test $$l -nt $$t -o ! -f $$t; then \ |
| | | 122 | echo $$t -\> $$l; \ |
| | | 123 | ln -f $$l $$t; \ |
86 | fi; \ | | 124 | fi; \ |
87 | while test $$# -ge 2; do \ | | | |
88 | shift; \ | | | |
89 | extra=$${dir}$$1/$${base%.*}.0${MCOMPRESSSUFFIX}; \ | | | |
90 | echo $$extra -\> $$instpage; \ | | | |
91 | ln -f $$instpage $$extra; \ | | | |
92 | done; \ | | | |
93 | done | | 125 | done |
94 | .endif | | 126 | .endif |
95 | .if defined(PSALL) | | 127 | .else |
96 | @for page in ${PSALL}; do \ | | 128 | catlinks: |
97 | set -- ${MANSUBDIR}; \ | | 129 | .endif |
98 | subdir=$$1; \ | | 130 | |
99 | dir=${DESTDIR}${PSDIR}$${page##*.ps}; \ | | 131 | manlinks: manpages |
100 | base=$${page##*/}; \ | | 132 | .if defined(MLINKS) && !empty(MLINKS) |
101 | instpage=$${dir}$${subdir}/$${base%.*}.ps${MCOMPRESSSUFFIX}; \ | | 133 | @set ${MLINKS}; \ |
102 | if [ X"${MCOMPRESS}" = X ]; then \ | | 134 | while test $$# -ge 2; do \ |
103 | echo ${MINSTALL} $$page $$instpage; \ | | 135 | name=$$1; \ |
104 | ${MINSTALL} $$page $$instpage; \ | | 136 | shift; \ |
105 | else \ | | 137 | dir=${DESTDIR}${MANDIR}/man$${name##*.}; \ |
106 | rm -f $$instpage; \ | | 138 | l=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \ |
107 | echo ${MCOMPRESS} $$page \> $$instpage; \ | | 139 | name=$$1; \ |
108 | ${MCOMPRESS} $$page > $$instpage; \ | | 140 | shift; \ |
109 | chown ${PSOWN}:${PSGRP} $$instpage; \ | | 141 | dir=${DESTDIR}${MANDIR}/man$${name##*.}; \ |
110 | chmod ${PSMODE} $$instpage; \ | | 142 | t=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \ |
| | | 143 | if test $$l -nt $$t -o ! -f $$t; then \ |
| | | 144 | echo $$t -\> $$l; \ |
| | | 145 | ln -f $$l $$t; \ |
111 | fi; \ | | 146 | fi; \ |
112 | while test $$# -ge 2; do \ | | | |
113 | shift; \ | | | |
114 | extra=$${dir}$$1/$${base%.*}.ps${MCOMPRESSSUFFIX}; \ | | | |
115 | echo $$extra -\> $$instpage; \ | | | |
116 | ln -f $$instpage $$extra; \ | | | |
117 | done; \ | | | |
118 | done | | 147 | done |
119 | .endif | | 148 | .endif |
120 | .if defined(MLINKS) && !empty(MLINKS) | | 149 | |
121 | . for sub in ${MANSUBDIR} | | 150 | # PS rules |
122 | . for lnk file in ${MLINKS} | | 151 | ps: ${PSPAGES} |
123 | @l=${DESTDIR}${MANDIR}${lnk:E}${sub}/${lnk:R}.0${MCOMPRESSSUFFIX}; \ | | 152 | |
124 | t=${DESTDIR}${MANDIR}${file:E}${sub}/${file:R}.0${MCOMPRESSSUFFIX}; \ | | 153 | .if defined(HTMLPAGES) && !empty(HTMLPAGES) |
125 | echo $$t -\> $$l; \ | | 154 | .for P in ${HTMLPAGES:O:u} |
126 | rm -f $$t; ln $$l $$t; | | 155 | ${HTMLDIR}/${P:T:E}/${P:T:R}.html: ${P} |
127 | . endfor | | 156 | ${MINSTALL} ${.ALLSRC} ${.TARGET} |
128 | . endfor | | 157 | .endfor |
129 | .endif | | 158 | .endif |
| | | 159 | installhtml: ${HTMLPAGES:@P@${HTMLDIR}/${P:T:E}/${P:T:R}.html@} |
130 | | | 160 | |
131 | .if (defined(MANALL) || defined(PSALL)) && !defined(MANLOCALBUILD) | | 161 | cleanhtml: |
132 | all: ${MANALL} ${PSALL} | | 162 | .if defined(HTMLPAGES) && !empty(HTMLPAGES) |
| | | 163 | rm -f ${HTMLPAGES} |
| | | 164 | .endif |
| | | 165 | |
| | | 166 | |
| | | 167 | .if defined(CATPAGES) |
| | | 168 | .if ${MKCATPAGES} != "no" && ${MKMAN} != "no" |
| | | 169 | realall: ${CATPAGES} |
| | | 170 | .else |
| | | 171 | realall: |
| | | 172 | .endif |
133 | | | 173 | |
134 | cleandir: cleanman | | | |
135 | cleanman: | | 174 | cleanman: |
136 | rm -f ${MANALL} ${PSALL} | | 175 | rm -f ${CATPAGES} |
| | | 176 | .else |
| | | 177 | cleanman: |
137 | .endif | | 178 | .endif |
| | | 179 | |
| | | 180 | # Make sure all of the standard targets are defined, even if they do nothing. |
| | | 181 | clean depend includes lint regress tags: |