1995-09-08 19:23:19 +00:00
|
|
|
# bsd.sgml.mk - 8 Sep 1995 John Fieber
|
|
|
|
# This file is in the public domain.
|
|
|
|
#
|
1998-09-17 11:35:11 +00:00
|
|
|
# $Id: bsd.sgml.mk,v 1.26 1998/08/08 07:02:08 peter Exp $
|
1996-05-27 23:12:15 +00:00
|
|
|
#
|
|
|
|
# The include file <bsd.sgml.mk> handles installing sgml documents.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# +++ variables +++
|
|
|
|
#
|
1998-09-17 11:35:11 +00:00
|
|
|
# DISTRIBUTION Name of distribution. [doc]
|
1996-05-27 23:12:15 +00:00
|
|
|
#
|
|
|
|
# FORMATS Indicates which output formats will be generated
|
1997-05-25 12:43:06 +00:00
|
|
|
# (ascii, html, koi8-r, latex, latin1, ps, roff).
|
|
|
|
# [html latin1 ascii]
|
1996-05-27 23:12:15 +00:00
|
|
|
#
|
|
|
|
# LPR Printer command. [lpr]
|
|
|
|
#
|
1997-05-11 00:32:14 +00:00
|
|
|
# NOSGMLCOMPRESS If you do not want SGML formatted documents
|
|
|
|
# be compressed when they are installed. [yes]
|
|
|
|
#
|
|
|
|
# SCOMPRESS_CMD Program to compress SGML formatted documents. Output is to
|
|
|
|
# stdout. [${COMPRESS_CMD}]
|
|
|
|
#
|
1996-05-27 23:12:15 +00:00
|
|
|
# SGMLFLAGS Flags to sgmlfmt. [${SGMLOPTS}]
|
|
|
|
#
|
|
|
|
# SGMLFMT Format sgml files command. [sgmlfmt]
|
|
|
|
#
|
|
|
|
# Variables DOCOWN, DOCGRP, DOCMODE, DOCDIR, DESTDIR, DISTDIR are
|
|
|
|
# set by other Makefiles (e.g. bsd.own.mk)
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# +++ targets +++
|
|
|
|
#
|
|
|
|
# all:
|
|
|
|
# Converts sgml files to the specified output format
|
|
|
|
# (see ${FORMATS}).
|
|
|
|
#
|
|
|
|
# distribute:
|
|
|
|
# This is a variant of install, which will
|
|
|
|
# put the stuff into the right "distribution".
|
|
|
|
#
|
|
|
|
# install:
|
|
|
|
# Install formated output.
|
|
|
|
#
|
|
|
|
# print:
|
|
|
|
# Print formated output.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# bsd.obj.mk: clean, cleandir, obj
|
|
|
|
#
|
|
|
|
|
1995-09-08 19:23:19 +00:00
|
|
|
|
1998-08-08 07:02:08 +00:00
|
|
|
.if !target(__initialized__)
|
|
|
|
__initialized__:
|
1995-09-08 19:23:19 +00:00
|
|
|
.if exists(${.CURDIR}/../Makefile.inc)
|
|
|
|
.include "${.CURDIR}/../Makefile.inc"
|
|
|
|
.endif
|
1998-08-08 07:02:08 +00:00
|
|
|
.endif
|
1995-09-08 19:23:19 +00:00
|
|
|
|
|
|
|
# FORMATS indicates which output formats will be generated. See
|
|
|
|
# the sgmlfmt(1) man page for a list of valid formats.
|
1995-09-10 21:49:24 +00:00
|
|
|
# If FORMATS is empty, nothing will be built or installed.
|
|
|
|
# Use SGMLOPTS to pass extra flags to sgmlfmt(1).
|
1995-09-08 19:23:19 +00:00
|
|
|
|
1997-05-02 05:02:54 +00:00
|
|
|
FORMATS?= html latin1 ascii
|
1995-09-10 21:49:24 +00:00
|
|
|
SGMLFLAGS+= ${SGMLOPTS}
|
1995-09-08 19:23:19 +00:00
|
|
|
|
|
|
|
VOLUME?= ${.CURDIR:T}
|
|
|
|
DOC?= ${.CURDIR:T}
|
|
|
|
SRCDIR?= ${.CURDIR}
|
1998-09-17 11:35:11 +00:00
|
|
|
DISTRIBUTION?= doc
|
1995-09-10 21:49:24 +00:00
|
|
|
SGMLFMT?= sgmlfmt
|
|
|
|
LPR?= lpr
|
1995-09-08 19:23:19 +00:00
|
|
|
|
1997-05-11 00:32:14 +00:00
|
|
|
NOSGMLCOMPRESS?= yes
|
|
|
|
SCOMPRESS_CMD?= ${COMPRESS_CMD}
|
|
|
|
.if !empty(NOSGMLCOMPRESS)
|
|
|
|
SCOMPRESS_EXT=
|
|
|
|
.else
|
|
|
|
SCOMPRESS_EXT?= ${COMPRESS_EXT}
|
|
|
|
.endif
|
|
|
|
|
1998-05-18 16:57:10 +00:00
|
|
|
|
|
|
|
PS2PDF?= ps2pdf
|
|
|
|
|
|
|
|
.SUFFIXES: .ps .pdf
|
|
|
|
|
|
|
|
.ps.pdf:
|
|
|
|
${PS2PDF} < ${.IMPSRC} > ${.TARGET}
|
|
|
|
|
1997-05-11 00:32:14 +00:00
|
|
|
_docs=
|
1997-05-25 12:43:06 +00:00
|
|
|
_strip=
|
|
|
|
.for _f in ${FORMATS}
|
|
|
|
__f=${_f}
|
|
|
|
.if ${__f} == "html"
|
|
|
|
_docs+= ${DOC}.${_f}
|
1997-05-11 00:32:14 +00:00
|
|
|
.else
|
1997-05-25 12:43:06 +00:00
|
|
|
_docs+= ${DOC}.${_f}${SCOMPRESS_EXT}
|
|
|
|
.if ${__f} == "ascii" || ${__f} == "latin1" || ${__f} == "koi8-r"
|
|
|
|
_strip+= ${DOC}.${_f}
|
|
|
|
CLEANFILES+=${DOC}.${_f}.bak
|
|
|
|
.endif
|
1997-05-11 00:32:14 +00:00
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
|
1997-05-25 12:43:06 +00:00
|
|
|
strip: ${_strip}
|
|
|
|
.if !empty(_strip)
|
|
|
|
perl -i.bak -npe 's/.\010//g' ${_strip}
|
|
|
|
.endif
|
|
|
|
|
1995-09-08 19:23:19 +00:00
|
|
|
|
|
|
|
.MAIN: all
|
1997-05-11 00:32:14 +00:00
|
|
|
all: ${_docs}
|
1995-09-08 19:23:19 +00:00
|
|
|
|
1995-09-10 21:49:24 +00:00
|
|
|
# If FORMATS is empty, do nothing
|
|
|
|
.if empty(FORMATS)
|
|
|
|
${DOC}. install- print- clean-:
|
|
|
|
.endif
|
1995-09-08 19:23:19 +00:00
|
|
|
|
|
|
|
install: beforeinstall realinstall afterinstall
|
|
|
|
|
|
|
|
realinstall: ${FORMATS:S/^/install-/g}
|
|
|
|
|
|
|
|
.if !target(print)
|
|
|
|
print: ${FORMATS:S/^/print-/g}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
spell: ${SRCS}
|
|
|
|
(cd ${.CURDIR}; spell ${SRCS} ) | sort | \
|
|
|
|
comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell
|
|
|
|
|
|
|
|
.if !target(distribute)
|
|
|
|
distribute:
|
1997-06-21 15:40:34 +00:00
|
|
|
.for dist in ${DISTRIBUTION}
|
|
|
|
cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
|
|
|
|
.endfor
|
1995-09-08 19:23:19 +00:00
|
|
|
.endif
|
|
|
|
|
1995-09-10 17:18:24 +00:00
|
|
|
# For each FORMATS type, define a build, install, clean and print target.
|
1995-09-08 19:23:19 +00:00
|
|
|
# Note that there is special case handling for html targets
|
|
|
|
# because the number of files generated is generally not possible
|
|
|
|
# to predict outside of sgmlfmt(1).
|
|
|
|
|
|
|
|
.for _XFORMAT in ${FORMATS}
|
|
|
|
|
|
|
|
# XXX This doesn't work:
|
|
|
|
# .if ${_FORMAT} == "foobar"
|
|
|
|
# but defining another variable does: (?!?!)
|
|
|
|
|
|
|
|
_FORMAT = ${_XFORMAT}
|
|
|
|
|
|
|
|
.if !target(print-${_FORMAT})
|
|
|
|
.if ${_FORMAT} == "html"
|
|
|
|
print-${_FORMAT}:
|
|
|
|
|
|
|
|
.else
|
1997-05-11 00:32:14 +00:00
|
|
|
print-${_FORMAT}: ${DOC}.${_FORMAT}${SCOMPRESS_EXT}
|
|
|
|
.if !empty(NOSGMLCOMPRESS)
|
|
|
|
${LPR} ${.ALLSRC}
|
|
|
|
.else
|
|
|
|
${SCOMPRESS_CMD} -d ${.ALLSRC} | ${LPR}
|
|
|
|
.endif
|
1995-09-08 19:23:19 +00:00
|
|
|
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(install-${_FORMAT})
|
|
|
|
.if ${_FORMAT} == "html"
|
1996-05-27 23:12:15 +00:00
|
|
|
install-${_FORMAT}:
|
|
|
|
${INSTALL} ${COPY} -o ${DOCOWN} -g ${DOCGRP} -m ${DOCMODE} \
|
1996-10-01 23:44:03 +00:00
|
|
|
${DOC}*.html ${DESTDIR}${DOCDIR}/${VOLUME}
|
|
|
|
if [ -f ${.OBJDIR}/${DOC}.ln ]; then \
|
|
|
|
(cd ${DESTDIR}${DOCDIR}/${VOLUME}; \
|
|
|
|
sh ${.OBJDIR}/${DOC}.ln); \
|
|
|
|
fi
|
1995-09-08 19:23:19 +00:00
|
|
|
|
|
|
|
.else
|
1996-05-27 23:12:15 +00:00
|
|
|
install-${_FORMAT}:
|
|
|
|
${INSTALL} ${COPY} -o ${DOCOWN} -g ${DOCGRP} -m ${DOCMODE} \
|
1997-05-11 00:32:14 +00:00
|
|
|
${DOC}.${.TARGET:S/install-//}${SCOMPRESS_EXT} \
|
|
|
|
${DESTDIR}${DOCDIR}/${VOLUME}
|
1995-09-08 19:23:19 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(${DOC}.${_FORMAT})
|
1997-05-11 00:32:14 +00:00
|
|
|
.if ${_FORMAT} != "html" && empty(NOSGMLCOMPRESS)
|
|
|
|
${DOC}.${_FORMAT}${SCOMPRESS_EXT}: ${SRCS}
|
|
|
|
${SGMLFMT} -f ${_XFORMAT} ${SGMLFLAGS} ${.CURDIR}/${DOC}.sgml
|
|
|
|
${SCOMPRESS_CMD} ${DOC}.${_XFORMAT} > ${.TARGET}
|
|
|
|
.else
|
1996-05-27 23:12:15 +00:00
|
|
|
${DOC}.${_FORMAT}: ${SRCS}
|
1997-05-11 00:32:14 +00:00
|
|
|
${SGMLFMT} -f ${_XFORMAT} ${SGMLFLAGS} ${.CURDIR}/${DOC}.sgml
|
|
|
|
.endif
|
1995-09-08 19:23:19 +00:00
|
|
|
.endif
|
|
|
|
|
1995-09-10 17:18:24 +00:00
|
|
|
.if ${_FORMAT} == "html"
|
1996-10-01 23:44:03 +00:00
|
|
|
CLEANFILES+= ${DOC}*.html ${DOC}.ln
|
1997-05-11 00:32:14 +00:00
|
|
|
.else
|
|
|
|
.if empty(NOSGMLCOMPRESS)
|
|
|
|
CLEANFILES+= ${DOC}.${_XFORMAT}${SCOMPRESS_EXT}
|
|
|
|
.endif
|
|
|
|
CLEANFILES+= ${DOC}.${_XFORMAT}
|
1995-09-10 17:18:24 +00:00
|
|
|
.endif
|
|
|
|
|
1995-09-08 19:23:19 +00:00
|
|
|
.endfor
|
1996-05-27 23:12:15 +00:00
|
|
|
|
|
|
|
|
1998-05-06 18:44:04 +00:00
|
|
|
.for __target in beforeinstall afterinstall maninstall _SUBDIR
|
1997-11-09 14:37:40 +00:00
|
|
|
.if !target(${__target})
|
1996-05-27 23:12:15 +00:00
|
|
|
${__target}:
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
.include <bsd.obj.mk>
|