1# from: @(#)bsd.doc.mk 5.3 (Berkeley) 1/2/91 2# $Id: bsd.doc.mk,v 1.32 1997/02/22 13:56:09 peter Exp $ 3 4PRINTERDEVICE?= ascii 5 6BIB?= bib 7EQN?= eqn -T${PRINTERDEVICE} 8GREMLIN?= grn 9GRIND?= vgrind -f 10INDXBIB?= indxbib 11PIC?= pic 12REFER?= refer 13.if ${PRINTERDEVICE} == "ascii" 14ROFF?= groff -mtty-char ${TRFLAGS} ${MACROS} -o${PAGES} 15.else 16ROFF?= groff ${TRFLAGS} ${MACROS} -o${PAGES} 17.endif 18SOELIM?= soelim 19SOELIMPP= sed ${SOELIMPPARGS} 20SOELIMPPARGS0= ${SRCS} ${EXTRA} 21SOELIMPPARGS1= ${SOELIMPPARGS0:S/^/-e\\ \'s:\(\.so[\\ \\ ][\\ \\ ]*\)\(/} 22SOELIMPPARGS2= ${SOELIMPPARGS1:S/$/\)\$:\1${SRCDIR}\/\2:\'/} 23SOELIMPPARGS= ${SOELIMPPARGS2:S/\\'/'/g} 24TBL?= tbl 25 26DOC?= paper 27 28TRFLAGS+= -T${PRINTERDEVICE} 29.if defined(USE_EQN) 30TRFLAGS+= -e 31.endif 32.if defined(USE_TBL) 33TRFLAGS+= -t 34.endif 35.if defined(USE_PIC) 36TRFLAGS+= -p 37.endif 38.if defined(USE_SOELIM) 39TRFLAGS+= -s 40.endif 41.if defined(USE_REFER) 42TRFALGS+= -R 43.endif 44 45.if defined(NODOCCOMPRESS) || ${PRINTERDEVICE} == "html" 46DFILE= ${DOC}.${PRINTERDEVICE} 47GZIPCMD= cat 48.else 49DFILE= ${DOC}.${PRINTERDEVICE}.gz 50GZIPCMD= gzip -c 51.endif 52 53PAGES?= 1- 54 55UNROFF?= unroff 56HTML_SPLIT?= yes 57UNROFFFLAGS?= -fhtml 58.if ${HTML_SPLIT} == "yes" 59UNROFFFLAGS+= split=1 60.endif 61 62# Compatibility mode flag for groff. Use this when formatting documents with 63# Berkeley me macros. 64COMPAT?= -C 65 66.PATH: ${.CURDIR} ${SRCDIR} 67 68.MAIN: all 69all: ${DFILE} 70 71.if !target(print) 72print: ${DFILE} 73.if defined(NODOCCOMPRESS) 74 lpr ${DFILE} 75.else 76 ${GZIPCMD} -d ${DFILE} | lpr 77.endif 78.endif 79 80CLEANFILES+= ${DOC}.${PRINTERDEVICE} ${DOC}.${PRINTERDEVICE}.gz \ 81 ${DOC}.ascii ${DOC}.ascii.gz \ 82 ${DOC}.ps ${DOC}.ps.gz \ 83 ${DOC}.html ${DOC}-*.html 84 85 86FILES?= ${SRCS} 87realinstall: 88.if ${PRINTERDEVICE} == "html" 89 ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 90 ${.OBJDIR}/${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME} 91.else 92 ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 93 ${DFILE} ${DESTDIR}${BINDIR}/${VOLUME} 94.endif 95 96install: beforeinstall realinstall afterinstall 97 98.if !target(beforeinstall) 99beforeinstall: 100 101.endif 102.if !target(afterinstall) 103afterinstall: 104 105.endif 106 107DISTRIBUTION?= doc 108.if !target(distribute) 109distribute: 110 cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies 111.endif 112 113spell: ${SRCS} 114 (cd ${.CURDIR}; spell ${SRCS} ) | sort | \ 115 comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell 116 117BINDIR?= /usr/share/doc 118BINMODE= 444 119 120SRCDIR?= ${.CURDIR} 121 122.if !target(${DFILE}) 123.if ${PRINTERDEVICE} == "html" 124${DFILE}: ${SRCS} ${EXTRA} ${OBJS} 125 cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \ 126 document=${.OBJDIR}/${DOC} ${SRCS} 127.else 128 129${DFILE}:: ${SRCS} ${EXTRA} ${OBJS} 130# XXX ${.ALLSRC} doesn't work unless there are a lot of .PATH.foo statements. 131ALLSRCS= ${SRCS:S;^;${SRCDIR}/;} 132${DFILE}:: ${SRCS} 133.if defined(USE_SOELIMPP) 134 ${SOELIMPP} ${ALLSRCS} | ${ROFF} | ${GZIPCMD} > ${.TARGET} 135.else 136 (cd ${SRCDIR}; ${ROFF} ${.ALLSRC}) | ${GZIPCMD} > ${.TARGET} 137.endif 138.else 139.if !defined(NODOCCOMPRESS) 140${DFILE}: ${DOC}.${PRINTERDEVICE} 141 ${GZIPCMD} ${DOC}.${PRINTERDEVICE} > ${.TARGET} 142.endif 143.endif 144.endif 145 146.if !target(depend) 147depend: 148.endif 149 150.if !target(maninstall) 151maninstall: 152.endif 153 154.include <bsd.dep.mk> 155.include <bsd.obj.mk> 156