libc/nls: Sync with FreeBSD.
[dragonfly.git] / share / mk / bsd.doc.mk
blob8a8ca24aa95031b04a64c781bd87cb8434ca2445
1 # from: @(#)bsd.doc.mk 5.3 (Berkeley) 1/2/91
2 # $FreeBSD: head/share/mk/bsd.doc.mk 290773 2015-11-13 17:27:23Z bdrewery $
4 # The include file <bsd.doc.mk> handles installing BSD troff documents.
7 # +++ variables +++
9 # DCOMPRESS_CMD Program to compress troff documents. Output is to stdout.
10 # [${COMPRESS_CMD}]
12 # DESTDIR Change the tree where the documents get installed. [not set]
14 # DOC Document name. [paper]
16 # EXTRA Extra files (not SRCS) that make up the document. [not set]
18 # LPR Printer command. [lpr]
20 # MACROS Macro packages used to build the document. [not set]
22 # NODOCCOMPRESS If you do not want formatted troff documents to be
23 # compressed when they are installed. [not set]
25 # PRINTERDEVICE Indicates which output formats will be generated
26 # (ascii, ps, html). [ascii]
28 # SRCDIR Directory where source files live. [${.CURDIR}]
30 # SRCS List of source files. [not set]
32 # TRFLAGS Additional flags to groff(1). [not set]
34 # USE_EQN If set, preprocess with eqn(1). [not set]
36 # USE_PIC If set, preprocess with pic(1). [not set]
38 # USE_REFER If set, preprocess with refer(1). [not set]
40 # USE_SOELIM If set, preprocess with soelim(1). [not set]
42 # USE_TBL If set, preprocess with tbl(1). [not set]
44 # VOLUME Volume the document belongs to. [not set]
46 .include <bsd.init.mk>
48 PRINTERDEVICE?= ascii
50 BIB?= bib
51 GREMLIN?= grn
52 GRIND?= vgrind -f
53 INDXBIB?= indxbib
54 PIC?= pic
55 REFER?= refer
56 .for _dev in ${PRINTERDEVICE:Mascii}
57 ROFF.ascii?= groff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1}
58 .endfor
59 .for _dev in ${PRINTERDEVICE:Nascii}
60 ROFF.${_dev}?= groff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1}
61 .endfor
62 SOELIM?= soelim
63 TBL?= tbl
65 DOC?= paper
66 LPR?= lpr
68 .if defined(USE_EQN)
69 TRFLAGS+= -e
70 .endif
71 .if defined(USE_PIC)
72 TRFLAGS+= -p
73 .endif
74 .if defined(USE_REFER)
75 TRFLAGS+= -R
76 .endif
77 .if defined(USE_SOELIM)
78 TRFLAGS+= -I${.CURDIR}
79 .endif
80 .if defined(USE_TBL)
81 TRFLAGS+= -t
82 .endif
84 DCOMPRESS_EXT?= ${COMPRESS_EXT}
85 DCOMPRESS_CMD?= ${COMPRESS_CMD}
86 .for _dev in ${PRINTERDEVICE:Mhtml}
87 DFILE.html= ${DOC}.html
88 .endfor
89 .for _dev in ${PRINTERDEVICE:Nhtml}
90 .if defined(NODOCCOMPRESS)
91 DFILE.${_dev}= ${DOC}.${_dev}
92 .else
93 DFILE.${_dev}= ${DOC}.${_dev}${DCOMPRESS_EXT}
94 .endif
95 .endfor
97 # Compatibility mode flag for groff. Use this when formatting documents with
98 # Berkeley me macros (orig_me(7)).
99 COMPAT?= -C
101 .PATH: ${.CURDIR} ${SRCDIR}
103 .for _dev in ${PRINTERDEVICE}
104 all: ${DFILE.${_dev}}
105 .endfor
107 .if !target(print)
108 .for _dev in ${PRINTERDEVICE}
109 print: ${DFILE.${_dev}}
110 .endfor
111 print:
112 .for _dev in ${PRINTERDEVICE}
113 .if defined(NODOCCOMPRESS) || ${PRINTERDEVICE:Mhtml}
114 ${LPR} ${DFILE.${_dev}}
115 .else
116 ${DCOMPRESS_CMD} -d ${DFILE.${_dev}} | ${LPR}
117 .endif
118 .endfor
119 .endif
121 .for _dev in ${PRINTERDEVICE:Nascii:Nps:Nhtml}
122 CLEANFILES+= ${DOC}.${_dev} ${DOC}.${_dev}${DCOMPRESS_EXT}
123 .endfor
124 CLEANFILES+= ${DOC}.ascii ${DOC}.ascii${DCOMPRESS_EXT} \
125 ${DOC}.ps ${DOC}.ps${DCOMPRESS_EXT} \
126 ${DOC}.html ${DOC}-*.html
128 realinstall:
129 .if ${PRINTERDEVICE:Mhtml}
130 cd ${SRCDIR}; \
131 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
132 ${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}/
133 .endif
134 .for _dev in ${PRINTERDEVICE:Nhtml}
135 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
136 ${DFILE.${_dev}} ${DESTDIR}${BINDIR}/${VOLUME}/
137 .endfor
139 spell: ${SRCS}
140 (cd ${.CURDIR}; spell ${SRCS} ) | sort | \
141 comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell
143 BINDIR?= /usr/share/doc
144 BINMODE= 444
146 SRCDIR?= ${.CURDIR}
148 .if defined(EXTRA) && !empty(EXTRA)
149 _stamp.extra: ${EXTRA}
150 touch ${.TARGET}
151 .endif
153 CLEANFILES+= _stamp.extra
154 .for _dev in ${PRINTERDEVICE}
155 .if !target(${DFILE.${_dev}})
156 .if target(_stamp.extra)
157 ${DFILE.${_dev}}: _stamp.extra
158 .endif
159 ${DFILE.${_dev}}: ${SRCS}
160 .if defined(NODOCCOMPRESS) || ${PRINTERDEVICE:Mhtml}
161 ${ROFF.${_dev}} ${.ALLSRC:N_stamp.extra} > ${.TARGET}
162 .else
163 ${ROFF.${_dev}} ${.ALLSRC:N_stamp.extra} | ${DCOMPRESS_CMD} > ${.TARGET}
164 .endif
165 .endif
166 .endfor
168 .include <bsd.obj.mk>