10d133632SWolfram Schneider# The include file <bsd.doc.mk> handles installing BSD troff documents. 20d133632SWolfram Schneider# 30d133632SWolfram Schneider# 40d133632SWolfram Schneider# +++ variables +++ 50d133632SWolfram Schneider# 647a67661SRuslan Ermilov# DCOMPRESS_CMD Program to compress troff documents. Output is to stdout. 747a67661SRuslan Ermilov# [${COMPRESS_CMD}] 847a67661SRuslan Ermilov# 947a67661SRuslan Ermilov# DESTDIR Change the tree where the documents get installed. [not set] 1047a67661SRuslan Ermilov# 1147a67661SRuslan Ermilov# DOC Document name. [paper] 1247a67661SRuslan Ermilov# 1347a67661SRuslan Ermilov# EXTRA Extra files (not SRCS) that make up the document. [not set] 1447a67661SRuslan Ermilov# 150d133632SWolfram Schneider# LPR Printer command. [lpr] 160d133632SWolfram Schneider# 1747a67661SRuslan Ermilov# MACROS Macro packages used to build the document. [not set] 180d133632SWolfram Schneider# 197ecf742eSWarner Losh# WITHOUT_DOCCOMPRESS If you do not want formatted troff documents to be 2047a67661SRuslan Ermilov# compressed when they are installed. [not set] 210d133632SWolfram Schneider# 2247a67661SRuslan Ermilov# PRINTERDEVICE Indicates which output formats will be generated 2347a67661SRuslan Ermilov# (ascii, ps, html). [ascii] 2447a67661SRuslan Ermilov# 2547a67661SRuslan Ermilov# SRCDIR Directory where source files live. [${.CURDIR}] 2647a67661SRuslan Ermilov# 2747a67661SRuslan Ermilov# SRCS List of source files. [not set] 2847a67661SRuslan Ermilov# 2947a67661SRuslan Ermilov# TRFLAGS Additional flags to groff(1). [not set] 3047a67661SRuslan Ermilov# 3147a67661SRuslan Ermilov# USE_EQN If set, preprocess with eqn(1). [not set] 3247a67661SRuslan Ermilov# 3347a67661SRuslan Ermilov# USE_PIC If set, preprocess with pic(1). [not set] 3447a67661SRuslan Ermilov# 3547a67661SRuslan Ermilov# USE_REFER If set, preprocess with refer(1). [not set] 3647a67661SRuslan Ermilov# 3747a67661SRuslan Ermilov# USE_SOELIM If set, preprocess with soelim(1). [not set] 3847a67661SRuslan Ermilov# 3947a67661SRuslan Ermilov# USE_TBL If set, preprocess with tbl(1). [not set] 4047a67661SRuslan Ermilov# 4147a67661SRuslan Ermilov# VOLUME Volume the document belongs to. [not set] 423585b293SGarrett Wollman 432bdaf7e8SRuslan Ermilov.include <bsd.init.mk> 4481e53444SWolfram Schneider 4511205c34SMike PritchardPRINTERDEVICE?= ascii 46afe61c15SRodney W. Grimes 47afe61c15SRodney W. GrimesBIB?= bib 48afe61c15SRodney W. GrimesGREMLIN?= grn 49afe61c15SRodney W. GrimesGRIND?= vgrind -f 50afe61c15SRodney W. GrimesINDXBIB?= indxbib 51afe61c15SRodney W. GrimesPIC?= pic 52afe61c15SRodney W. GrimesREFER?= refer 53e5f3fe8cSRuslan Ermilov.for _dev in ${PRINTERDEVICE:Mascii} 54b4b4b530SBaptiste DaroussinROFF.ascii?= groff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1} 55e5f3fe8cSRuslan Ermilov.endfor 56e5f3fe8cSRuslan Ermilov.for _dev in ${PRINTERDEVICE:Nascii} 57b4b4b530SBaptiste DaroussinROFF.${_dev}?= groff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1} 58e5f3fe8cSRuslan Ermilov.endfor 59afe61c15SRodney W. GrimesSOELIM?= soelim 60afe61c15SRodney W. GrimesTBL?= tbl 61afe61c15SRodney W. Grimes 6225514a12SGarrett WollmanDOC?= paper 630d133632SWolfram SchneiderLPR?= lpr 6425514a12SGarrett Wollman 6525514a12SGarrett Wollman.if defined(USE_EQN) 6625514a12SGarrett WollmanTRFLAGS+= -e 6725514a12SGarrett Wollman.endif 6825514a12SGarrett Wollman.if defined(USE_PIC) 6925514a12SGarrett WollmanTRFLAGS+= -p 7025514a12SGarrett Wollman.endif 7125514a12SGarrett Wollman.if defined(USE_REFER) 729b990274SMike PritchardTRFLAGS+= -R 7325514a12SGarrett Wollman.endif 74b382ba4fSRuslan Ermilov.if defined(USE_SOELIM) 75729c67f5SBaptiste DaroussinTRFLAGS+= -I${.CURDIR} 76b382ba4fSRuslan Ermilov.endif 77b382ba4fSRuslan Ermilov.if defined(USE_TBL) 78b382ba4fSRuslan ErmilovTRFLAGS+= -t 79b382ba4fSRuslan Ermilov.endif 8025514a12SGarrett Wollman 81dc6d22c9SBaptiste Daroussin.if defined(NO_ROOT) 82dc6d22c9SBaptiste Daroussin.if !defined(TAGS) || ! ${TAGS:Mpackage=*} 83*4c1a82ceSEmmanuel VadotTAGS+= package=${PACKAGE:Uutilities} 84dc6d22c9SBaptiste Daroussin.endif 85dc6d22c9SBaptiste DaroussinTAG_ARGS= -T ${TAGS:[*]:S/ /,/g} 86dc6d22c9SBaptiste Daroussin.endif 87dc6d22c9SBaptiste Daroussin 88f7ea12a0SWolfram SchneiderDCOMPRESS_EXT?= ${COMPRESS_EXT} 89f7ea12a0SWolfram SchneiderDCOMPRESS_CMD?= ${COMPRESS_CMD} 90e5f3fe8cSRuslan Ermilov.for _dev in ${PRINTERDEVICE:Mhtml} 91e5f3fe8cSRuslan ErmilovDFILE.html= ${DOC}.html 92e5f3fe8cSRuslan Ermilov.endfor 93e5f3fe8cSRuslan Ermilov.for _dev in ${PRINTERDEVICE:Nhtml} 947ecf742eSWarner Losh.if ${MK_DOCCOMPRESS} == "no" 95e5f3fe8cSRuslan ErmilovDFILE.${_dev}= ${DOC}.${_dev} 96e5f3fe8cSRuslan Ermilov.else 97e5f3fe8cSRuslan ErmilovDFILE.${_dev}= ${DOC}.${_dev}${DCOMPRESS_EXT} 9891abfd34SGarrett Wollman.endif 99e5f3fe8cSRuslan Ermilov.endfor 10091abfd34SGarrett Wollman 101da5636b6SWolfram SchneiderUNROFF?= unroff 102da5636b6SWolfram SchneiderHTML_SPLIT?= yes 103934d03e4SWolfram SchneiderUNROFFFLAGS?= -fhtml 104da5636b6SWolfram Schneider.if ${HTML_SPLIT} == "yes" 105da5636b6SWolfram SchneiderUNROFFFLAGS+= split=1 106da5636b6SWolfram Schneider.endif 107da5636b6SWolfram Schneider 1083585b293SGarrett Wollman# Compatibility mode flag for groff. Use this when formatting documents with 109b382ba4fSRuslan Ermilov# Berkeley me macros (orig_me(7)). 1103585b293SGarrett WollmanCOMPAT?= -C 1113585b293SGarrett Wollman 11225514a12SGarrett Wollman.PATH: ${.CURDIR} ${SRCDIR} 113afe61c15SRodney W. Grimes 114db74470bSBryan Drewery.if !defined(_SKIP_BUILD) 115e5f3fe8cSRuslan Ermilov.for _dev in ${PRINTERDEVICE} 116e5f3fe8cSRuslan Ermilovall: ${DFILE.${_dev}} 117e5f3fe8cSRuslan Ermilov.endfor 118db74470bSBryan Drewery.endif 119afe61c15SRodney W. Grimes 120afe61c15SRodney W. Grimes.if !target(print) 121e5f3fe8cSRuslan Ermilov.for _dev in ${PRINTERDEVICE} 122e5f3fe8cSRuslan Ermilovprint: ${DFILE.${_dev}} 123e5f3fe8cSRuslan Ermilov.endfor 124e5f3fe8cSRuslan Ermilovprint: 125e5f3fe8cSRuslan Ermilov.for _dev in ${PRINTERDEVICE} 1267ecf742eSWarner Losh.if ${MK_DOCCOMPRESS} == "no" 127e5f3fe8cSRuslan Ermilov ${LPR} ${DFILE.${_dev}} 12891abfd34SGarrett Wollman.else 129e5f3fe8cSRuslan Ermilov ${DCOMPRESS_CMD} -d ${DFILE.${_dev}} | ${LPR} 13091abfd34SGarrett Wollman.endif 131e5f3fe8cSRuslan Ermilov.endfor 132afe61c15SRodney W. Grimes.endif 133afe61c15SRodney W. Grimes 134e5f3fe8cSRuslan Ermilov.for _dev in ${PRINTERDEVICE:Nascii:Nps:Nhtml} 135e5f3fe8cSRuslan ErmilovCLEANFILES+= ${DOC}.${_dev} ${DOC}.${_dev}${DCOMPRESS_EXT} 136e5f3fe8cSRuslan Ermilov.endfor 1376c36f075SBruce EvansCLEANFILES+= ${DOC}.ascii ${DOC}.ascii${DCOMPRESS_EXT} \ 138f7ea12a0SWolfram Schneider ${DOC}.ps ${DOC}.ps${DCOMPRESS_EXT} \ 139da5636b6SWolfram Schneider ${DOC}.html ${DOC}-*.html 140da5636b6SWolfram Schneider 141d448c6a9SGarrett Wollmanrealinstall: 1428251c561SBryan Drewery.if ${PRINTERDEVICE:Mhtml} 143534ac553SWolfram Schneider cd ${SRCDIR}; \ 144dc6d22c9SBaptiste Daroussin ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},docs} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 14508682b1bSBryan Drewery ${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}/ 1468251c561SBryan Drewery.endif 147e5f3fe8cSRuslan Ermilov.for _dev in ${PRINTERDEVICE:Nhtml} 148dc6d22c9SBaptiste Daroussin ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},docs} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 14908682b1bSBryan Drewery ${DFILE.${_dev}} ${DESTDIR}${BINDIR}/${VOLUME}/ 150e5f3fe8cSRuslan Ermilov.endfor 151afe61c15SRodney W. Grimes 152afe61c15SRodney W. Grimesspell: ${SRCS} 1533585b293SGarrett Wollman (cd ${.CURDIR}; spell ${SRCS} ) | sort | \ 1543585b293SGarrett Wollman comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell 155afe61c15SRodney W. Grimes 156afe61c15SRodney W. GrimesBINDIR?= /usr/share/doc 1578558dc3fSAndrey A. ChernovBINMODE= 444 15825514a12SGarrett Wollman 15925514a12SGarrett WollmanSRCDIR?= ${.CURDIR} 16025514a12SGarrett Wollman 161b382ba4fSRuslan Ermilov.if defined(EXTRA) && !empty(EXTRA) 162b382ba4fSRuslan Ermilov_stamp.extra: ${EXTRA} 1630b7162ffSBruce Evans touch ${.TARGET} 164e5f3fe8cSRuslan Ermilov.endif 165e5f3fe8cSRuslan Ermilov 166b382ba4fSRuslan ErmilovCLEANFILES+= _stamp.extra 167e5f3fe8cSRuslan Ermilov.for _dev in ${PRINTERDEVICE:Nhtml} 168e5f3fe8cSRuslan Ermilov.if !target(${DFILE.${_dev}}) 169e5f3fe8cSRuslan Ermilov.if target(_stamp.extra) 170e5f3fe8cSRuslan Ermilov${DFILE.${_dev}}: _stamp.extra 171b382ba4fSRuslan Ermilov.endif 172e5f3fe8cSRuslan Ermilov${DFILE.${_dev}}: ${SRCS} 1737ecf742eSWarner Losh.if ${MK_DOCCOMPRESS} == "no" 174e5f3fe8cSRuslan Ermilov ${ROFF.${_dev}} ${.ALLSRC:N_stamp.extra} > ${.TARGET} 175da5636b6SWolfram Schneider.else 176e5f3fe8cSRuslan Ermilov ${ROFF.${_dev}} ${.ALLSRC:N_stamp.extra} | ${DCOMPRESS_CMD} > ${.TARGET} 177b382ba4fSRuslan Ermilov.endif 17825514a12SGarrett Wollman.endif 179e5f3fe8cSRuslan Ermilov.endfor 180e5f3fe8cSRuslan Ermilov 181e5f3fe8cSRuslan Ermilov.for _dev in ${PRINTERDEVICE:Mhtml} 182e5f3fe8cSRuslan Ermilov.if !target(${DFILE.html}) 183e5f3fe8cSRuslan Ermilov.if target(_stamp.extra) 184e5f3fe8cSRuslan Ermilov${DFILE.html}: _stamp.extra 185e5f3fe8cSRuslan Ermilov.endif 186e5f3fe8cSRuslan Ermilov${DFILE.html}: ${SRCS} 187e5f3fe8cSRuslan Ermilov.if defined(MACROS) && !empty(MACROS) 188e5f3fe8cSRuslan Ermilov cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \ 189e5f3fe8cSRuslan Ermilov document=${DOC} ${SRCS} 190e5f3fe8cSRuslan Ermilov.else # unroff(1) requires a macro package as an argument 191e5f3fe8cSRuslan Ermilov cd ${SRCDIR}; ${UNROFF} -ms ${UNROFFFLAGS} \ 192e5f3fe8cSRuslan Ermilov document=${DOC} ${SRCS} 193e5f3fe8cSRuslan Ermilov.endif 194e5f3fe8cSRuslan Ermilov.endif 195e5f3fe8cSRuslan Ermilov.endfor 19625514a12SGarrett Wollman 197c5234b56SRuslan ErmilovDISTRIBUTION?= doc 198c5234b56SRuslan Ermilov 199cd9a2f5cSJordan K. Hubbard.include <bsd.obj.mk> 200