1 # $FreeBSD: src/share/mk/bsd.man.mk,v 1.31.2.11 2002/12/19 13:48:33 ru Exp $
2 # $DragonFly: src/share/mk/bsd.man.mk,v 1.4 2005/12/10 00:15:01 swildner Exp $
4 # The include file <bsd.man.mk> handles installing manual pages and
10 # DESTDIR Change the tree where the man pages gets installed. [not set]
12 # MANDIR Base path for manual installation. [${SHAREDIR}/man/man]
14 # MANOWN Manual owner. [${SHAREOWN}]
16 # MANGRP Manual group. [${SHAREGRP}]
18 # MANMODE Manual mode. [${NOBINMODE}]
20 # MANSUBDIR Subdirectory under the manual page section, i.e. "/i386"
21 # or "/tahoe" for machine specific manual pages.
23 # MAN The manual pages to be installed. For sections see
24 # variable ${SECTIONS}
26 # MCOMPRESS_CMD Program to compress man pages. Output is to
27 # stdout. [${COMPRESS_CMD}]
29 # MLINKS List of manual page links (using a suffix). The
30 # linked-to file must come first, the linked file
31 # second, and there may be multiple pairs. The files
34 # NOMANCOMPRESS If you do not want unformatted manual pages to be
35 # compressed when they are installed. [not set]
37 # NOMLINKS If you do not want install manual page links. [not set]
39 # MANFILTER command to pipe the raw man page through before compressing
40 # or installing. Can be used to do sed substitution.
42 # MANBUILDCAT create preformatted manual pages in addition to normal
45 # MROFF_CMD command and flags to create preformatted pages
50 # Install the manual pages and their links.
53 .if
!target
(__
<bsd.init.mk
>__
)
54 .error bsd.man.mk cannot be included directly.
57 MINSTALL?
= ${INSTALL} -o
${MANOWN} -g
${MANGRP} -m
${MANMODE}
59 CATDIR
= ${MANDIR
:H
:S
/$/\
/cat
/}
61 MROFF_CMD?
= groff
-Tascii
-mtty-char
-man
-t
63 MCOMPRESS_CMD?
= ${COMPRESS_CMD}
64 MCOMPRESS_EXT?
= ${COMPRESS_EXT}
66 SECTIONS
= 1 2 3 4 5 6 7 8 9
67 .SUFFIXES
: ${SECTIONS
:S
/^
/.
/g
}
69 # Backwards compatibility.
71 .for sect in
${SECTIONS}
72 .if defined
(MAN
${sect}) && !empty
(MAN
${sect})
81 .if defined
(NOMANCOMPRESS
)
83 # Make special arrangements to filter to a temporary file at build time
85 .if defined
(MANFILTER
)
93 .if defined
(MANFILTER
)
94 .if defined
(MAN
) && !empty
(MAN
)
95 CLEANFILES
+= ${MAN
:T
:S
/$/${FILTEXTENSION}/g
}
96 CLEANFILES
+= ${MAN
:T
:S
/$/${CATEXT}${FILTEXTENSION}/g
}
98 .for target in
${page
:T
:S
/$/${FILTEXTENSION}/g
}
101 ${MANFILTER} < ${.ALLSRC
} > ${.TARGET
}
103 .if defined
(MANBUILDCAT
) && !empty
(MANBUILDCAT
)
104 .for target in
${page
:T
:S
/$/${CATEXT}${FILTEXTENSION}/g
}
107 ${MANFILTER} < ${.ALLSRC
} |
${MROFF_CMD} > ${.TARGET
}
113 .if defined
(MAN
) && !empty
(MAN
)
114 CLEANFILES
+= ${MAN
:T
:S
/$/${CATEXT}/g
}
115 .if defined
(MANBUILDCAT
) && !empty
(MANBUILDCAT
)
117 .for target in
${page
:T
:S
/$/${CATEXT}/g
}
120 ${MROFF_CMD} ${.ALLSRC
} > ${.TARGET
}
131 ZEXT
= ${MCOMPRESS_EXT}
133 .if defined
(MAN
) && !empty
(MAN
)
134 CLEANFILES
+= ${MAN
:T
:S
/$/${MCOMPRESS_EXT}/g
}
135 CLEANFILES
+= ${MAN
:T
:S
/$/${CATEXT}${MCOMPRESS_EXT}/g
}
137 .for target in
${page
:T
:S
/$/${MCOMPRESS_EXT}/}
140 .if defined
(MANFILTER
)
141 ${MANFILTER} < ${.ALLSRC
} |
${MCOMPRESS_CMD} > ${.TARGET
}
143 ${MCOMPRESS_CMD} ${.ALLSRC
} > ${.TARGET
}
146 .if defined
(MANBUILDCAT
) && !empty
(MANBUILDCAT
)
147 .for target in
${page
:T
:S
/$/${CATEXT}${MCOMPRESS_EXT}/}
150 .if defined
(MANFILTER
)
151 ${MANFILTER} < ${.ALLSRC
} |
${MROFF_CMD} |
${MCOMPRESS_CMD} > ${.TARGET
}
153 ${MROFF_CMD} ${.ALLSRC
} |
${MCOMPRESS_CMD} > ${.TARGET
}
162 maninstall
: _maninstall
164 .if defined
(MAN
) && !empty
(MAN
)
166 .if defined
(NOMANCOMPRESS
)
167 .if defined
(MANFILTER
)
169 ${MINSTALL} ${page
:T
:S
/$/${FILTEXTENSION}/g
} \
170 ${DESTDIR}${MANDIR}${page
:E
}${MANSUBDIR}/${page}
171 .if defined
(MANBUILDCAT
) && !empty
(MANBUILDCAT
)
172 ${MINSTALL} ${page
:T
:S
/$/${CATEXT}${FILTEXTENSION}/g
} \
173 ${DESTDIR}${CATDIR}${page
:E
}${MANSUBDIR}/${page}
177 @set
`echo ${.ALLSRC} " " | sed 's/\.\([^.]*\) /.\1 \1 /g'`; \
181 1) echo
"warn: missing extension: $$1"; break
;; \
183 page
=$$1; shift
; sect
=$$1; shift
; \
184 d
=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}; \
185 ${ECHO} ${MINSTALL} $${page} $${d}; \
186 ${MINSTALL} $${page} $${d}; \
188 .if defined
(MANBUILDCAT
) && !empty
(MANBUILDCAT
)
190 ${MINSTALL} ${page
:T
:S
/$/${CATEXT}/} \
191 ${DESTDIR}${CATDIR}${page
:E
}${MANSUBDIR}/${page
:T
}
197 ${MINSTALL} ${page
:T
:S
/$/${MCOMPRESS_EXT}/g
} \
198 ${DESTDIR}${MANDIR}${page
:E
}${MANSUBDIR}
199 .if defined
(MANBUILDCAT
) && !empty
(MANBUILDCAT
)
200 ${MINSTALL} ${page
:T
:S
/$/${CATEXT}${MCOMPRESS_EXT}/g
} \
201 ${DESTDIR}${CATDIR}${page
:E
}${MANSUBDIR}/${page
:T
:S
/$/${MCOMPRESS_EXT}/}
207 .if
!defined
(NOMLINKS
) && defined
(MLINKS
) && !empty
(MLINKS
)
208 @set
`echo ${MLINKS} " " | sed 's/\.\([^.]*\) /.\1 \1 /g'`; \
212 [123]) echo
"warn: empty MLINK: $$1 $$2 $$3"; break
;; \
214 name
=$$1; shift
; sect
=$$1; shift
; \
215 l
=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \
216 name
=$$1; shift
; sect
=$$1; shift
; \
217 t
=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \
218 ${ECHO} $${t}${ZEXT} -\
> $${l}${ZEXT}; \
219 rm -f
$${t} $${t}${MCOMPRESS_EXT}; \
220 ${LN} $${l}${ZEXT} $${t}${ZEXT}; \
222 .if defined
(MANBUILDCAT
) && !empty
(MANBUILDCAT
)
223 @set
`echo ${MLINKS} " " | sed 's/\.\([^.]*\) /.\1 \1 /g'`; \
227 [123]) echo
"warn: empty MLINK: $$1 $$2 $$3"; break
;; \
229 name
=$$1; shift
; sect
=$$1; shift
; \
230 l
=${DESTDIR}${CATDIR}$${sect}${MANSUBDIR}/$$name; \
231 name
=$$1; shift
; sect
=$$1; shift
; \
232 t
=${DESTDIR}${CATDIR}$${sect}${MANSUBDIR}/$$name; \
233 ${ECHO} $${t}${ZEXT} -\
> $${l}${ZEXT}; \
234 rm -f
$${t} $${t}${MCOMPRESS_EXT}; \
235 ${LN} $${l}${ZEXT} $${t}${ZEXT}; \
241 .if defined
(MAN
) && !empty
(MAN
)
245 .if defined
(MANFILTER
)
246 ${MANFILTER} < ${.ALLSRC
} |
${MROFF_CMD} -ww
-z
248 ${MROFF_CMD} -ww
-z
${.ALLSRC
}