Undo part of the last commit. OBJFORMAT_PATH controls how the cross
[dragonfly.git] / share / mk / bsd.doc.mk
1 #       from: @(#)bsd.doc.mk    5.3 (Berkeley) 1/2/91
2 # $FreeBSD: src/share/mk/bsd.doc.mk,v 1.47.2.5 2002/08/07 16:31:50 ru Exp $
3 # $DragonFly: src/share/mk/bsd.doc.mk,v 1.2 2003/06/17 04:37:02 dillon Exp $
4 #
5 # The include file <bsd.doc.mk> handles installing BSD troff documents.
6 #
7 #
8 # +++ variables +++
9 #
10 # LPR           Printer command. [lpr]
11 #
12 #       [incomplete]
13 #
14 # +++ targets +++
15 #
16 #       [incomplete]
17
18 .include <bsd.init.mk>
19
20 PRINTERDEVICE?= ascii
21
22 BIB?=           bib
23 EQN?=           eqn -T${PRINTERDEVICE}
24 GREMLIN?=       grn
25 GRIND?=         vgrind -f
26 INDXBIB?=       indxbib
27 PIC?=           pic
28 REFER?=         refer
29 .if ${PRINTERDEVICE} == "ascii"
30 ROFF?=          groff -mtty-char ${TRFLAGS} ${MACROS} -o${PAGES}
31 .else
32 ROFF?=          groff ${TRFLAGS} ${MACROS} -o${PAGES}
33 .endif
34 SOELIM?=        soelim
35 SOELIMPP=       sed ${SOELIMPPARGS}
36 SOELIMPPARGS0=  ${SRCS} ${EXTRA}
37 SOELIMPPARGS1=  ${SOELIMPPARGS0:S/^/-e\\ \'s:\(\.so[\\ \\       ][\\ \\ ]*\)\(/}
38 SOELIMPPARGS2=  ${SOELIMPPARGS1:S/$/\)\$:\1${SRCDIR}\/\2:\'/}
39 SOELIMPPARGS=   ${SOELIMPPARGS2:S/\\'/'/g}
40 TBL?=           tbl
41
42 DOC?=           paper
43 LPR?=           lpr
44
45 TRFLAGS+=       -T${PRINTERDEVICE}
46 .if defined(USE_EQN)
47 TRFLAGS+=       -e
48 .endif
49 .if defined(USE_TBL)
50 TRFLAGS+=       -t
51 .endif
52 .if defined(USE_PIC)
53 TRFLAGS+=       -p
54 .endif
55 .if defined(USE_SOELIM)
56 TRFLAGS+=       -s
57 .endif
58 .if defined(USE_REFER)
59 TRFLAGS+=       -R
60 .endif
61
62 DCOMPRESS_EXT?= ${COMPRESS_EXT}
63 .if defined(NODOCCOMPRESS) || ${PRINTERDEVICE} == "html"
64 DFILE=  ${DOC}.${PRINTERDEVICE}
65 DCOMPRESS_CMD=  cat
66 .else
67 DFILE=  ${DOC}.${PRINTERDEVICE}${DCOMPRESS_EXT}
68 DCOMPRESS_CMD?= ${COMPRESS_CMD}
69 .endif
70
71 PAGES?=         1-
72
73 UNROFF?=        unroff
74 HTML_SPLIT?=    yes
75 UNROFFFLAGS?=   -fhtml
76 .if ${HTML_SPLIT} == "yes"
77 UNROFFFLAGS+=   split=1
78 .endif
79
80 # Compatibility mode flag for groff.  Use this when formatting documents with
81 # Berkeley me macros.
82 COMPAT?=        -C
83
84 .PATH: ${.CURDIR} ${SRCDIR}
85
86 all:    ${DFILE}
87
88 .if !target(print)
89 print: ${DFILE}
90 .if defined(NODOCCOMPRESS)
91         ${LPR} ${DFILE}
92 .else
93         ${DCOMPRESS_CMD} -d ${DFILE} | ${LPR}
94 .endif
95 .endif
96
97 .if ${PRINTERDEVICE} != "ascii" && ${PRINTERDEVICE} != "ps"
98 CLEANFILES+=    ${DOC}.${PRINTERDEVICE} ${DOC}.${PRINTERDEVICE}${DCOMPRESS_EXT}
99 .endif
100 CLEANFILES+=    ${DOC}.ascii ${DOC}.ascii${DCOMPRESS_EXT} \
101                 ${DOC}.ps ${DOC}.ps${DCOMPRESS_EXT} \
102                 ${DOC}.html ${DOC}-*.html
103
104 realinstall:
105 .if ${PRINTERDEVICE} == "html"
106         cd ${SRCDIR}; \
107                 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
108                 ${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}
109 .else
110         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
111                 ${DFILE} ${DESTDIR}${BINDIR}/${VOLUME}
112 .endif
113
114 spell: ${SRCS}
115         (cd ${.CURDIR};  spell ${SRCS} ) | sort | \
116                 comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell
117
118 BINDIR?=        /usr/share/doc
119 BINMODE=        444
120
121 SRCDIR?=        ${.CURDIR}
122
123 .if !target(${DFILE})
124 _stamp.extraobjs: ${EXTRA} ${OBJS}
125         touch ${.TARGET}
126 CLEANFILES+=    _stamp.extraobjs
127 ${DFILE}: ${SRCS} _stamp.extraobjs
128 .if ${PRINTERDEVICE} == "html"
129         cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \
130             document=${DOC} ${SRCS}
131 .elif defined(USE_SOELIMPP)
132         ${SOELIMPP} ${.ALLSRC:N_stamp.extraobjs} | ${ROFF} | \
133             ${DCOMPRESS_CMD} > ${.TARGET}
134 .else
135         (cd ${SRCDIR}; ${ROFF} ${.ALLSRC:N_stamp.extraobjs}) | \
136             ${DCOMPRESS_CMD} > ${.TARGET}
137 .endif
138 .endif
139
140 DISTRIBUTION?=  doc
141
142 .include <bsd.obj.mk>