Deleted Added
full compact
bsd.man.mk (17831) bsd.man.mk (18314)
1# $Id: bsd.man.mk,v 1.14 1996/08/11 12:31:57 peter Exp $
1# $Id: bsd.man.mk,v 1.15 1996/08/26 10:55:32 peter Exp $
2#
3# The include file <bsd.man.mk> handles installing manual pages and
4# their links. <bsd.man.mk> includes the file named "../Makefile.inc"
5# if it exists.
6#
7#
8# +++ variables +++
9#
10# DESTDIR Change the tree where the man pages gets installed. [not set]
11#
12# MANDIR Base path for manual installation. [${SHAREDIR}/man/man]
13#
14# MANOWN Manual owner. [${SHAREOWN}]
15#
16# MANGRP Manual group. [${SHAREGRP}]
17#
18# MANMODE Manual mode. [${NOBINMODE}]
19#
20# MANSUBDIR Subdirectory under the manual page section, i.e. "/i386"
21# or "/tahoe" for machine specific manual pages.
22#
23# MAN${sect} The manual pages to be installed. For sections see
24# variable ${SECTIONS}
25#
26# _MANPAGES List of all man pages to be installed.
27# (``_MANPAGES=$MAN1 $MAN2 ... $MANn'')
28#
29# MCOMPRESS Program to compress man pages. Output is to
30# stdout. [gzip -c]
31#
32# MLINKS List of manual page links (using a suffix). The
33# linked-to file must come first, the linked file
34# second, and there may be multiple pairs. The files
35# are hard-linked.
36#
37# NOMANCOMPRESS If you do not want unformatted manual pages to be
38# compressed when they are installed. [not set]
39#
40# MANFILTER command to pipe the raw man page though before compressing
41# or installing. Can be used to do sed substitution.
42#
43# +++ targets +++
44#
45# maninstall:
46# Install the manual pages and their links.
47#
48
49
50.if exists(${.CURDIR}/../Makefile.inc)
51.include "${.CURDIR}/../Makefile.inc"
52.endif
53
54MANSRC?= ${.CURDIR}
55MINSTALL= ${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
56
57MCOMPRESS= gzip -c
58ZEXTENSION= .gz
59
60SECTIONS= 1 2 3 3f 4 5 6 7 8 9 n
61
62.undef _MANPAGES
63.for sect in ${SECTIONS}
64.if defined(MAN${sect}) && !empty(MAN${sect})
65.SUFFIXES: .${sect}
66.PATH.${sect}: ${MANSRC}
67_MANPAGES+= ${MAN${sect}}
68.endif
69.endfor
70
71all-man: ${MANDEPEND}
72
73.if defined(NOMANCOMPRESS)
74
75COPY= -c
2#
3# The include file <bsd.man.mk> handles installing manual pages and
4# their links. <bsd.man.mk> includes the file named "../Makefile.inc"
5# if it exists.
6#
7#
8# +++ variables +++
9#
10# DESTDIR Change the tree where the man pages gets installed. [not set]
11#
12# MANDIR Base path for manual installation. [${SHAREDIR}/man/man]
13#
14# MANOWN Manual owner. [${SHAREOWN}]
15#
16# MANGRP Manual group. [${SHAREGRP}]
17#
18# MANMODE Manual mode. [${NOBINMODE}]
19#
20# MANSUBDIR Subdirectory under the manual page section, i.e. "/i386"
21# or "/tahoe" for machine specific manual pages.
22#
23# MAN${sect} The manual pages to be installed. For sections see
24# variable ${SECTIONS}
25#
26# _MANPAGES List of all man pages to be installed.
27# (``_MANPAGES=$MAN1 $MAN2 ... $MANn'')
28#
29# MCOMPRESS Program to compress man pages. Output is to
30# stdout. [gzip -c]
31#
32# MLINKS List of manual page links (using a suffix). The
33# linked-to file must come first, the linked file
34# second, and there may be multiple pairs. The files
35# are hard-linked.
36#
37# NOMANCOMPRESS If you do not want unformatted manual pages to be
38# compressed when they are installed. [not set]
39#
40# MANFILTER command to pipe the raw man page though before compressing
41# or installing. Can be used to do sed substitution.
42#
43# +++ targets +++
44#
45# maninstall:
46# Install the manual pages and their links.
47#
48
49
50.if exists(${.CURDIR}/../Makefile.inc)
51.include "${.CURDIR}/../Makefile.inc"
52.endif
53
54MANSRC?= ${.CURDIR}
55MINSTALL= ${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
56
57MCOMPRESS= gzip -c
58ZEXTENSION= .gz
59
60SECTIONS= 1 2 3 3f 4 5 6 7 8 9 n
61
62.undef _MANPAGES
63.for sect in ${SECTIONS}
64.if defined(MAN${sect}) && !empty(MAN${sect})
65.SUFFIXES: .${sect}
66.PATH.${sect}: ${MANSRC}
67_MANPAGES+= ${MAN${sect}}
68.endif
69.endfor
70
71all-man: ${MANDEPEND}
72
73.if defined(NOMANCOMPRESS)
74
75COPY= -c
76
77# Make special arrangements to filter to a temporary file at build time
78# for NOMANCOMPRESS.
79.if defined(MANFILTER)
80FILTEXTENSION= .filt
81.else
82FILTEXTENSION=
83.endif
84
76ZEXT=
77
78.if defined(MANFILTER)
79.for sect in ${SECTIONS}
80.if defined(MAN${sect}) && !empty(MAN${sect})
85ZEXT=
86
87.if defined(MANFILTER)
88.for sect in ${SECTIONS}
89.if defined(MAN${sect}) && !empty(MAN${sect})
81CLEANFILES+= ${MAN${sect}}
90CLEANFILES+= ${MAN${sect}:T:S/$/${FILTEXTENSION}/g}
82.for page in ${MAN${sect}}
91.for page in ${MAN${sect}}
83.for target in ${page}
92.for target in ${page:T:S/$/${FILTEXTENSION}/g}
84all-man: ${target}
85${target}: ${page}
86 ${MANFILTER} < ${.ALLSRC} > ${.TARGET}
87.endfor
88.endfor
89.endif
90.endfor
91.endif
92
93.else
94
95ZEXT= ${ZEXTENSION}
96
97.for sect in ${SECTIONS}
98.if defined(MAN${sect}) && !empty(MAN${sect})
99CLEANFILES+= ${MAN${sect}:T:S/$/${ZEXTENSION}/g}
100.for page in ${MAN${sect}}
101.for target in ${page:T:S/$/${ZEXTENSION}/}
102all-man: ${target}
103${target}: ${page}
104.if defined(MANFILTER)
105 ${MANFILTER} < ${.ALLSRC} | ${MCOMPRESS} > ${.TARGET}
106.else
107 ${MCOMPRESS} ${.ALLSRC} > ${.TARGET}
108.endif
109.endfor
110.endfor
111.endif
112.endfor
113
114.endif
115
116maninstall::
117.for sect in ${SECTIONS}
118.if defined(MAN${sect}) && !empty(MAN${sect})
119maninstall:: ${MAN${sect}}
120.if defined(NOMANCOMPRESS)
93all-man: ${target}
94${target}: ${page}
95 ${MANFILTER} < ${.ALLSRC} > ${.TARGET}
96.endfor
97.endfor
98.endif
99.endfor
100.endif
101
102.else
103
104ZEXT= ${ZEXTENSION}
105
106.for sect in ${SECTIONS}
107.if defined(MAN${sect}) && !empty(MAN${sect})
108CLEANFILES+= ${MAN${sect}:T:S/$/${ZEXTENSION}/g}
109.for page in ${MAN${sect}}
110.for target in ${page:T:S/$/${ZEXTENSION}/}
111all-man: ${target}
112${target}: ${page}
113.if defined(MANFILTER)
114 ${MANFILTER} < ${.ALLSRC} | ${MCOMPRESS} > ${.TARGET}
115.else
116 ${MCOMPRESS} ${.ALLSRC} > ${.TARGET}
117.endif
118.endfor
119.endfor
120.endif
121.endfor
122
123.endif
124
125maninstall::
126.for sect in ${SECTIONS}
127.if defined(MAN${sect}) && !empty(MAN${sect})
128maninstall:: ${MAN${sect}}
129.if defined(NOMANCOMPRESS)
130.if defined(MANFILTER)
131.for page in ${MAN${sect}}
132 ${MINSTALL} ${page:T:S/$/${FILTEXTENSION}/g} ${DESTDIR}${MANDIR}${sect}${MANSUBDIR}/${page}
133.endfor
134.else
121 ${MINSTALL} ${.ALLSRC} ${DESTDIR}${MANDIR}${sect}${MANSUBDIR}
135 ${MINSTALL} ${.ALLSRC} ${DESTDIR}${MANDIR}${sect}${MANSUBDIR}
136.endif
122.else
123 ${MINSTALL} ${.ALLSRC:T:S/$/${ZEXTENSION}/g} \
124 ${DESTDIR}${MANDIR}${sect}${MANSUBDIR}
125.endif
126.endif
127.endfor
128
129.if defined(MLINKS) && !empty(MLINKS)
130 @set `echo ${MLINKS} " " | sed 's/\.\([^.]*\) /.\1 \1 /g'`; \
131 while : ; do \
132 case $$# in \
133 0) break;; \
134 [123]) echo "warn: empty MLINK: $$1 $$2 $$3"; break;; \
135 esac; \
136 name=$$1; shift; sect=$$1; shift; \
137 l=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \
138 name=$$1; shift; sect=$$1; shift; \
139 t=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \
140 ${ECHO} $${t}${ZEXT} -\> $${l}${ZEXT}; \
141 rm -f $${t} $${t}${ZEXTENSION}; \
142 ln $${l}${ZEXT} $${t}${ZEXT}; \
143 done
144.endif
137.else
138 ${MINSTALL} ${.ALLSRC:T:S/$/${ZEXTENSION}/g} \
139 ${DESTDIR}${MANDIR}${sect}${MANSUBDIR}
140.endif
141.endif
142.endfor
143
144.if defined(MLINKS) && !empty(MLINKS)
145 @set `echo ${MLINKS} " " | sed 's/\.\([^.]*\) /.\1 \1 /g'`; \
146 while : ; do \
147 case $$# in \
148 0) break;; \
149 [123]) echo "warn: empty MLINK: $$1 $$2 $$3"; break;; \
150 esac; \
151 name=$$1; shift; sect=$$1; shift; \
152 l=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \
153 name=$$1; shift; sect=$$1; shift; \
154 t=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \
155 ${ECHO} $${t}${ZEXT} -\> $${l}${ZEXT}; \
156 rm -f $${t} $${t}${ZEXTENSION}; \
157 ln $${l}${ZEXT} $${t}${ZEXT}; \
158 done
159.endif