]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/bsd.doc.mk
Use a different hack in the ${DFILE} rule to keep indirect dependencies
[FreeBSD/FreeBSD.git] / share / mk / bsd.doc.mk
1 #       from: @(#)bsd.doc.mk    5.3 (Berkeley) 1/2/91
2 #       $Id: bsd.doc.mk,v 1.44 1998/05/06 18:44:00 bde Exp $
3 #
4 # The include file <bsd.doc.mk> handles installing BSD troff documents.
5 #
6 #
7 # +++ variables +++
8 #
9 # LPR           Printer command. [lpr]
10 #
11 #       [incomplete]
12 #
13 # +++ targets +++
14 #
15 #       [incomplete]
16
17 .if exists(${.CURDIR}/../Makefile.inc)
18 .include "${.CURDIR}/../Makefile.inc"
19 .endif
20
21 PRINTERDEVICE?= ascii
22
23 BIB?=           bib
24 EQN?=           eqn -T${PRINTERDEVICE}
25 GREMLIN?=       grn
26 GRIND?=         vgrind -f
27 INDXBIB?=       indxbib
28 PIC?=           pic
29 REFER?=         refer
30 .if ${PRINTERDEVICE} == "ascii"
31 ROFF?=          groff -mtty-char ${TRFLAGS} ${MACROS} -o${PAGES}
32 .else
33 ROFF?=          groff ${TRFLAGS} ${MACROS} -o${PAGES}
34 .endif
35 SOELIM?=        soelim
36 SOELIMPP=       sed ${SOELIMPPARGS}
37 SOELIMPPARGS0=  ${SRCS} ${EXTRA}
38 SOELIMPPARGS1=  ${SOELIMPPARGS0:S/^/-e\\ \'s:\(\.so[\\ \\       ][\\ \\ ]*\)\(/}
39 SOELIMPPARGS2=  ${SOELIMPPARGS1:S/$/\)\$:\1${SRCDIR}\/\2:\'/}
40 SOELIMPPARGS=   ${SOELIMPPARGS2:S/\\'/'/g}
41 TBL?=           tbl
42
43 DOC?=           paper
44 LPR?=           lpr
45
46 TRFLAGS+=       -T${PRINTERDEVICE}
47 .if defined(USE_EQN)
48 TRFLAGS+=       -e
49 .endif
50 .if defined(USE_TBL)
51 TRFLAGS+=       -t
52 .endif
53 .if defined(USE_PIC)
54 TRFLAGS+=       -p
55 .endif
56 .if defined(USE_SOELIM)
57 TRFLAGS+=       -s
58 .endif
59 .if defined(USE_REFER)
60 TRFLAGS+=       -R
61 .endif
62
63 DCOMPRESS_EXT?= ${COMPRESS_EXT}
64 .if defined(NODOCCOMPRESS) || ${PRINTERDEVICE} == "html"
65 DFILE=  ${DOC}.${PRINTERDEVICE}
66 DCOMPRESS_CMD=  cat
67 .else
68 DFILE=  ${DOC}.${PRINTERDEVICE}${DCOMPRESS_EXT}
69 DCOMPRESS_CMD?= ${COMPRESS_CMD}
70 .endif
71
72 PAGES?=         1-
73
74 UNROFF?=        unroff
75 HTML_SPLIT?=    yes
76 UNROFFFLAGS?=   -fhtml
77 .if ${HTML_SPLIT} == "yes"
78 UNROFFFLAGS+=   split=1
79 .endif
80
81 # Compatibility mode flag for groff.  Use this when formatting documents with
82 # Berkeley me macros.
83 COMPAT?=        -C
84
85 .PATH: ${.CURDIR} ${SRCDIR}
86
87 .MAIN:  all
88 all:    ${DFILE}
89
90 .if !target(print)
91 print: ${DFILE}
92 .if defined(NODOCCOMPRESS)
93         ${LPR} ${DFILE}
94 .else
95         ${DCOMPRESS_CMD} -d ${DFILE} | ${LPR}
96 .endif
97 .endif
98
99 .if ${PRINTERDEVICE} != "ascii" && ${PRINTERDEVICE} != "ps"
100 CLEANFILES+=    ${DOC}.${PRINTERDEVICE} ${DOC}.${PRINTERDEVICE}${DCOMPRESS_EXT}
101 .endif
102 CLEANFILES+=    ${DOC}.ascii ${DOC}.ascii${DCOMPRESS_EXT} \
103                 ${DOC}.ps ${DOC}.ps${DCOMPRESS_EXT} \
104                 ${DOC}.html ${DOC}-*.html
105
106 FILES?= ${SRCS}
107 realinstall:
108 .if ${PRINTERDEVICE} == "html"
109         cd ${SRCDIR}; \
110                 ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
111                 ${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}
112 .else
113         ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
114                 ${DFILE} ${DESTDIR}${BINDIR}/${VOLUME}
115 .endif
116
117 install:        beforeinstall realinstall afterinstall
118
119 .if !target(beforeinstall)
120 beforeinstall:
121
122 .endif
123 .if !target(afterinstall)
124 afterinstall:
125
126 .endif
127
128 DISTRIBUTION?=  doc
129 .if !target(distribute)
130 distribute:
131 .for dist in ${DISTRIBUTION}
132         cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
133 .endfor
134 .endif
135
136 spell: ${SRCS}
137         (cd ${.CURDIR};  spell ${SRCS} ) | sort | \
138                 comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell
139
140 BINDIR?=        /usr/share/doc
141 BINMODE=        444
142
143 SRCDIR?=        ${.CURDIR}
144
145 .if !target(${DFILE})
146 _stamp.extraobjs: ${EXTRA} ${OBJS}
147         touch ${.TARGET}
148 CLEANFILES+=    _stamp.extraobjs
149 ${DFILE}: ${SRCS} _stamp.extraobjs
150 .if ${PRINTERDEVICE} == "html"
151         cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \
152             document=${DOC} ${SRCS}
153 .elif defined(USE_SOELIMPP)
154         ${SOELIMPP} ${.ALLSRC:N_stamp.extraobjs} | ${ROFF} | \
155             ${DCOMPRESS_CMD} > ${.TARGET}
156 .else
157         (cd ${SRCDIR}; ${ROFF} ${.ALLSRC:N_stamp.extraobjs}) | \
158             ${DCOMPRESS_CMD} > ${.TARGET}
159 .endif
160 .endif
161
162 .if !target(maninstall)
163 maninstall:
164 .endif
165
166 .if !target(regress)
167 regress:
168 .endif
169
170 .include <bsd.obj.mk>