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