Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Aug 1999 19:42:55 +0200
From:      Neil Blakey-Milner <nbm@mithrandr.moria.org>
To:        doc@FreeBSD.org
Subject:   First draft at splitting docproj.docbook.mk
Message-ID:  <19990827194255.A12153@mithrandr.moria.org>

next in thread | raw e-mail | index | archive | help

--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii

Hiya,

Attached please find my attempt to split docproj.docbook.mk, and make
them independent of system make files, when requested to be.

I've built with NOINCLUDEMK set and unset, and I'd like more testing.

Installation doesn't work yet, but I'm getting there.

Neil
-- 
Neil Blakey-Milner
nbm@rucus.ru.ac.za

--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Description: doc.project.mk
Content-Disposition: attachment; filename="doc.project.mk"

#
# $Id$
#
# This include file <doc.project.mk> is the FreeBSD Documentation Project 
# co-ordination make file.
#
# This file includes the other makefiles, which contain enough
# knowledge to perform their duties without the system make files.
#

# Document-specific variables:
#
#	DOCFORMAT	Format of the document.  Defaults to docbook.
#			docbook is also the only option currently.
#
# 	MAINTAINER	This denotes who is responsible for maintaining
# 			this section of the project.  If unset, set to
# 			doc@FreeBSD.org
#

# User-modifiable variables:
#
#	PREFIX		Standard path to document-building applications
#			installed to serve the documentation build
#			process, usually by installing the docproj port
#			or package.  Default is /usr/local
#
#	NOINCLUDEMK	Whether to include the standard BSD make files,
#			or just to emulate them poorly.  Set this if you
#			aren't on FreeBSD, or a compatible sibling.  By
#			default is not set.
#

# Make files included:
#
#	doc.install.mk	Installation specific information, including
#			ownership and permissions.
#
#	doc.subdir.mk	Subdirectory related configuration, including
#			handling "obj" builds.
#
# DOCFORMAT-specific make files, like:
#
#	doc.docbook.mk	Building and installing docbook documentation.
#			Currently the only method.
#

# Document-specific defaults
DOCFORMAT?=	docbook
FORMATS?=	${DEFAULT_FORMATS}
MAINTAINER?=	doc@FreeBSD.org

# User-modifiable
PREFIX?=	/usr/local

# Format-specific configuration
.if ${DOCFORMAT} == "docbook"
.include "doc.docbook.mk"
.endif

# Subdirectory handling and ownership information.
.include "doc.subdir.mk"
.include "doc.install.mk"

--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Description: doc.subdir.mk
Content-Disposition: attachment; filename="doc.subdir.mk"

# Taken from:
#	Id: bsd.subdir.mk,v 1.27 1999/03/21 06:43:40 bde
#
# $Id$
#
# This include file <doc.subdir.mk> contains the default targets
# for building subdirectories in the FreeBSD Documentation Project.
#
# For all of the directories listed in the variable SUBDIR, the
# specified directory will be visited and the target made. There is
# also a default target which allows the command "make subdir" where
# subdir is any directory listed in the variable SUBDIR.
#

# Document-specific variables:
#
#	DISTRIBUTION		Name of distribution. [doc]
#
#	SUBDIR			A list of subdirectories that should be
#				built as well.  Each of the targets will
#				execute the same target in the
#				subdirectories.
#


# Provided targets:
#
#	distribute:
# 		This is a variant of install, which will
# 		put the stuff into the right "distribution".
#
#	afterdistribute, afterinstall, all, beforeinstall, checkdpadd,
#	clean, cleandepend, cleandir, depend, install, lint, maninstall,
#	obj, objlink, realinstall, regress, tags
#

.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif

.if !defined(NOINCLUDEMK)

.include <bsd.obj.mk>
.include <bsd.subdir.mk>

.else


.MAIN: all

_SUBDIRUSE: .USE
.for entry in ${SUBDIR}
	cd ${.CURDIR}/${entry}
	${MAKE} ${.TARGET:realinstall=install}
.endfor

${SUBDIR}::
	cd ${.CURDIR}/${.TARGET}
	${MAKE} all

.for __target in all checkdpadd cleandepend cleandir depend lint \
		 maninstall objlink regress tags
.if !target(${__target})
${__target}: _SUBDIRUSE
.endif
.endfor

.if !target(install)
install: beforeinstall realinstall afterinstall
.endif

.for __target in beforeinstall afterinstall depend _SUBDIR
.if !target(${__target})
${__target}:
.endif
.endfor

DISTRIBUTION?=	doc
.if !target(afterdistribute)
afterdistribute:
.endif
.if !target(distribute)
distribute: _SUBDIRUSE
.for dist in ${DISTRIBUTION}
	cd ${.CURDIR} ; ${MAKE} afterdistribute DESTDIR=${DISTDIR}/${dist}
.endfor
.endif

.if !target(obj)
obj:	_SUBDIRUSE
	@if ! test -d ${CANONICALOBJDIR}/; then \
		mkdir -p ${CANONICALOBJDIR}; \
		if ! test -d ${CANONICALOBJDIR}/; then \
			${ECHO} "Unable to create ${CANONICALOBJDIR}."; \
			exit 1; \
		fi; \
		${ECHO} "${CANONICALOBJDIR} created ${.CURDIR}"; \
	fi
.endif

.if !target(objlink)
objlink: _SUBDIRUSE
	@if test -d ${CANONICALOBJDIR}/; then \
		rm -f ${.CURDIR}/obj; \
		ln -s ${CANONICALOBJDIR} ${.CURDIR}/obj; \
	else \
		echo "No ${CANONICALOBJDIR} to link to - do a make obj."; \
	fi
.endif

.if !target(whereobj)
whereobj:
	@echo ${.OBJDIR}
.endif

cleanobj:
	@if [ -d ${CANONICALOBJDIR}/ ]; then \
		rm -rf ${CANONICALOBJDIR}; \
	else \
		cd ${.CURDIR} && ${MAKE} clean cleandepend; \
	fi
	@if [ -h ${.CURDIR}/obj ]; then rm -f ${.CURDIR}/obj; fi

.if !target(clean)
clean: _SUBDIRUSE
.if defined(CLEANFILES) && !empty(CLEANFILES)
	rm -f ${CLEANFILES}
.endif
.if defined(CLEANDIRS) && !empty(CLEANDIRS)
	rm -rf ${CLEANDIRS}
.endif
.endif

cleandir: cleanobj _SUBDIRUSE

.endif # end of NOINCLUDEMK section

--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Description: doc.install.mk
Content-Disposition: attachment; filename="doc.install.mk"

#
# $Id$
#
#
# This include file <doc.install.mk> provides variables defining the default
# ownership, location, and installation method of files generated by the 
# FreeBSD Documentation Project
#
# Since users often build and install documentation without root,
# default the document ownership to them, if they're not root.
#
# Document-specific variables:
#
#	NONE
#

# User-modifiabe variables:
#
#	DOCGRP_OVERRIDE	User may set this to a preferred group in the
#			case the documentation build is running as
#			non-root and desired group is not the user's
#			default group.
#	INSTALL_DOCS	The command to use to install the documentation.
#			Defaults to "install -o user -g group -m 444",
#			roughly.  
#
#			Should honour DOCOWN, DOCGRP and DOCMODE.
#
#			Should accept a list of files to install
#			followed by the directory to install into.
#
#	INSTALL_FLAGS	Flags to pass to the default INSTALL_DOCS'
#			install command.  Useful options are [cCdDp].
#			See install(1) for more information.
#
#	DOCDIR		Where to install the documentation.  Default is
#			/usr/share/doc.
#
#	DOCOWN		Owner of the documents when installed.  Forced
#			to the user installing the documentation, if the
#			user is not root. (for obvious reasons)
#
#	DOCGRP		Group of the documents when installed.  Forced
#			to the primary group of the documentation, if
#			the user is not root.  This action can be
#			overriden by setting:
#
#	DOCGRP_OVERRIDE Override the use of primary group when the user
#			installing is not root.  Sets GOCGRP to this
#			instead.
#
#	DOCMODE		Mode of the documents when installed.  Defaults
#			to 444.  See chmod(1).
#
#	DOCDIR		Installation directory.  Defaults to
#			/usr/share/doc
#

# Make files included (if NOINCLUDEMK is not set):
# 
# 	bsd.own.mk	Default permissions and locations for install.

# Include system defaults, unless prevented.
.if !defined(NOINCLUDEMK)
.include <bsd.own.mk>
.endif

DOCOWN?=	root
DOCGRP?=	wheel

DOCMODE?=	0444

DOCDIR?=	/usr/share/doc

# hack to set DOCOWN and DOCGRP to those of the user installing, if that
# user is not root.

USERID!=	id -u
USERNAME!=	id -un
GROUPNAME!=	id -gn

.if ${USERID} != 0
DOCOWN:=	${USERNAME}
.if defined(DOCGRP_OVERRIDE)
DOCGRP:=	${DOCGRP_OVERRIDE}
.else
DOCGRP:=	${GROUPNAME}
.endif
.endif

# installation "script"
INSTALL_DOCS?= \
	${INSTALL} ${INSTALL_FLAGS} -o ${DOCOWN} -g ${DOCGRP} -m ${DOCMODE}



--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Description: doc.docbook.mk
Content-Disposition: attachment; filename="doc.docbook.mk"

#
# $Id$
#
# This include file <doc.docbook.mk> handles building and installing of
# DocBook documentation in the FreeBSD Documentation Project.
#
# Documentation using DOCFORMAT=docbook is expected to be marked up
# according to the DocBook DTD
#

# Document-specific variables
#
#	DOC		This should be set to the name of the DocBook
#			marked-up file, without the .sgml or .docb suffix.
#			
#			It also determins the name of the output files -
#			${DOC}.html.
#
#	DOCBOOKSUFFIX	The suffix of your document, defaulting to .sgml
#

# Variables used by both users and documents:
#
#	JADEFLAGS	Additional options to pass to Jade.  Typically
#			used to define "IGNORE" entities to "INCLUDE"
#			 with "-i<entity-name>"
#
#	TIDYFLAGS	Additional flags to pass to Tidy.  Typically
#			used to set "-raw" flag to handle 8bit characters.
#
#	EXTRA_CATALOGS	Additional catalog files that should be used by
#			any SGML processing applications.
#
# Documents should use the += format to access these.
#

MASTERDOC?=	${.CURDIR}/${DOC}.sgml

JADE=		${PREFIX}/bin/jade

DSLHTML=	${DOC_PREFIX}/share/sgml/freebsd.dsl
DSLPRINT=	${DOC_PREFIX}/share/sgml/freebsd.dsl
FREEBSDCATALOG=	${DOC_PREFIX}/share/sgml/catalog

DOCBOOKCATALOG=	${PREFIX}/share/sgml/docbook/catalog
JADECATALOG=	${PREFIX}/share/sgml/jade/catalog
DSSSLCATALOG=	${PREFIX}/share/sgml/docbook/dsssl/modular/catalog

JADEOPTS=	${JADEFLAGS} -c ${FREEBSDCATALOG} -c ${DSSSLCATALOG} -c ${DOCBOOKCATALOG} -c ${JADECATALOG} ${EXTRA_CATALOGS:S/^/-c /g}

KNOWN_FORMATS=	html html-split html-split.tar txt rtf ps pdf tex dvi tar

# ------------------------------------------------------------------------
#
# Look at ${FORMATS} and work out which documents need to be generated.
# It is assumed that the HTML transformation will always create a file
# called index.html, and that for every other transformation the name
# of the generated file is ${DOC}.format.
#
# ${_docs} will be set to a list of all documents that must be made
# up to date.
#
# ${CLEANFILES} is a list of files that should be removed by the "clean"
# target. ${COMPRESS_EXT:S/^/${DOC}.${_cf}.&/ takes the COMPRESS_EXT
# var, and prepends the filename to each listed extension, building a
# second list of files with the compressed extensions added.
#

# Note: ".for _curformat in ${KNOWN_FORMATS}" is used several times in
# this file. I know they could have been rolled together in to one, much
# larger, loop. However, that would have made things more complicated
# for a newcomer to this file to unravel and understand, and a syntax
# error in the loop would have affected the entire
# build/compress/install process, instead of just one of them, making it
# more difficult to debug.
#

# Note: It is the aim of this file that *all* the targets be available,
# not just those appropriate to the current ${FORMATS} and
# ${INSTALL_COMPRESSED} values.
#
# For example, if FORMATS=html and INSTALL_COMPRESSED=gz you could still
# type
#
#     make book.rtf.bz2
#
# and it will do the right thing. Or
#
#     make install-rtf.bz2
#
# for that matter. But don't expect "make clean" to work if the FORMATS
# and INSTALL_COMPRESSED variables are wrong.
#

.for _curformat in ${FORMATS}
_cf=${_curformat}
.if ${_cf} == "html-split"
_docs+= index.html HTML.manifest
CLEANFILES+= `xargs < HTML.manifest` HTML.manifest
.elif ${_cf} == "html-split.tar"
_docs+= ${DOC}.html-split.tar
CLEANFILES+= `xargs < HTML.manifest` HTML.manifest
CLEANFILES+= ${DOC}.html-split.tar
.elif ${_cf} == "html"
_docs+= ${DOC}.html
CLEANFILES+= ${DOC}.html
.elif ${_cf} == "txt"
_docs+= ${DOC}.txt
CLEANFILES+= ${DOC}.html ${DOC}.txt
.elif ${_cf} == "dvi"
_docs+= ${DOC}.dvi
CLEANFILES+= ${DOC}.aux ${DOC}.dvi ${DOC}.log ${DOC}.tex
.elif ${_cf} == "ps"
_docs+= ${DOC}.ps
CLEANFILES+= ${DOC}.aux ${DOC}.dvi ${DOC}.log ${DOC}.tex ${DOC}.ps
.elif ${_cf} == "pdf"
_docs+= ${DOC}.pdf
CLEANFILES+= ${DOC}.aux ${DOC}.dvi ${DOC}.log ${DOC}.tex ${DOC}.pdf
.elif ${_cf} == "rtf"
_docs+= ${DOC}.rtf
CLEANFILES+= ${DOC}.rtf
.elif ${_cf} == "tar"
_docs+= ${DOC}.tar
CLEANFILES+= ${DOC}.tar
.elif ${_cf} == "doc"
_docs+= ${DOC}.doc
CLEANFILES+= ${DOC}.doc
.endif
.endfor

#
# Build a list of install-${format}.${compress_format} targets to be
# by "make install". Also, add ${DOC}.${format}.${compress_format} to
# ${_docs} and ${CLEANFILES} so they get built/cleaned by "all" and
# "clean".
#

.if defined(INSTALL_COMPRESSED) && !empty(INSTALL_COMPRESSED)
.for _curformat in ${FORMATS}
_cf=${_curformat}
.for _curcomp in ${INSTALL_COMPRESSED}
.if ${_cf} != "html-split"
_curinst+= install-${_curformat}.${_curcomp}
_docs+= ${DOC}.${_curformat}.${_curcomp}
CLEANFILES+= ${DOC}.${_curformat}.${_curcomp}
.endif
.endfor
.endfor
.endif

.MAIN: all

all: ${_docs}

index.html HTML.manifest: ${SRCS}
	${JADE} -V html-manifest -ioutput.html ${JADEOPTS} -d ${DSLHTML} -t sgml ${MASTERDOC}
	-tidy -i -m -f /dev/null ${TIDYFLAGS} *.html

${DOC}.html: ${SRCS}
	${JADE} -ioutput.html -V nochunks ${JADEOPTS} -d ${DSLHTML} -t sgml ${MASTERDOC} > ${.TARGET}
	-tidy -i -m -f /dev/null ${TIDYFLAGS} ${.TARGET}

${DOC}.html-split.tar: HTML.manifest
	tar cf ${.TARGET} `xargs < HTML.manifest`

${DOC}.txt: ${DOC}.html
	lynx -nolist -dump ${.ALLSRC} > ${.TARGET}

${DOC}.rtf: ${SRCS}
	${JADE} -Vrtf-backend -ioutput.print ${JADEOPTS} -d ${DSLPRINT} -t rtf -o ${.TARGET} ${MASTERDOC}

${DOC}.doc: ${SRCS}
	${JADE} -ioutput.print ${JADEOPTS} -d ${DSLPRINT} -t doc -o ${.TARGET} ${MASTERDOC}

${DOC}.tex: ${SRCS}
	${JADE} -Vtex-backend -ioutput.print ${JADEOPTS} -d ${DSLPRINT} -t tex -o ${.TARGET} ${MASTERDOC}

${DOC}.dvi: ${DOC}.tex
	@echo "==> TeX pass 1/3"
	-tex "&jadetex" ${.ALLSRC}
	@echo "==> TeX pass 2/3"
	-tex "&jadetex" ${.ALLSRC}
	@echo "==> TeX pass 3/3"
	-tex "&jadetex" ${.ALLSRC}

${DOC}.pdf: ${DOC}.tex
	@echo "==> PDFTeX pass 1/3"
	-pdftex "&pdfjadetex" ${.ALLSRC}
	@echo "==> PDFTeX pass 2/3"
	-pdftex "&pdfjadetex" ${.ALLSRC}
	@echo "==> PDFTeX pass 3/3"
	pdftex "&pdfjadetex" ${.ALLSRC}

${DOC}.ps: ${DOC}.dvi
	dvips -o ${.TARGET} ${.ALLSRC}

${DOC}.tar: ${SRCS}
	tar cf ${.TARGET} ${.ALLSRC}

# ------------------------------------------------------------------------
#
# Validation targets
#

#
# Lets you quickly check that the document conforms to the DTD without
# having to convert it to any other formats
#

lint validate:
	nsgmls -s -c ${FREEBSDCATALOG} -c ${DOCBOOKCATALOG} ${EXTRA_CATALOGS:S/^/-c /g} ${DOC}.sgml

# ------------------------------------------------------------------------
#
# Compress targets
#

#
# The list of compression extensions this Makefile knows about. If you
# add new compression schemes, add to this list (which is a list of
# extensions, hence bz2, *not* bzip2) and extend the _PROG_COMPRESS_*
# targets.
#
KNOWN_COMPRESS=	gz bz2 zip

#
# You can't build suffix rules to do compression, since you can't
# wildcard
# the source suffix. So these are defined .USE, to be tacked on as
# dependencies of the compress-* targets.
#

_PROG_COMPRESS_gz: .USE
	gzip -9 -c ${.ALLSRC} > ${.TARGET}

_PROG_COMPRESS_bz2: .USE
	bzip2 -9 -c ${.ALLSRC} > ${.TARGET}

_PROG_COMPRESS_zip: .USE
	zip -j -9 ${.TARGET} ${.ALLSRC}

#
# Build a list of targets for each compression scheme and output format.
# Don't compress the html-split output format.
#
.for _curformat in ${KNOWN_FORMATS}
_cf=${_curformat}
.for _curcompress in ${KNOWN_COMPRESS}
.if ${_cf} == "html-split"
${DOC}.${_cf}.tar.${_curcompress}: ${DOC}.${_cf}.tar _PROG_COMPRESS_${_curcompress}
.else
${DOC}.${_cf}.${_curcompress}: ${DOC}.${_cf} _PROG_COMPRESS_${_curcompress}
.endif
.endfor
.endfor

#
# Install targets
#
# Build install-* targets, one per allowed value in FORMATS. Need to
# build
# two specific targets;
#
#    install-html-split - Handles multiple .html files being generated
#                         from one source. Uses the HTML.manifest file
#                         created by the stylesheets, which should list
#                         each .html file that's been created.
#
#    install-*          - Every other format. The wildcard expands to
#                         the other allowed formats, all of which should
#                         generate just one file.
#
# "beforeinstall" and "afterinstall" are hooks in to this process.
# Redefine them to do things before and after the files are installed,
# respectively.
#
#install: beforeinstall realinstall afterinstall

#
# Build a list of install-format targets to be installed. These will be
# dependencies for the "realinstall" target.
#
.if !defined(INSTALL_ONLY_COMPRESSED) || empty(INSTALL_ONLY_COMPRESSED)
_curinst+= ${FORMATS:S/^/install-/g}
.endif

realinstall: ${_curinst}

.for _curformat in ${KNOWN_FORMATS}
_cf=${_curformat}
.if !target(install-${_cf})
.if ${_cf} == "html-split"
install-${_cf}: index.html
	[ -d ${DESTDIR} ] || mkdir -p ${DESTDIR}
	@if [ ! -f HTML.manifest ]; then \
		echo "HTML.manifest file does not exist, can't install";\
		exit 1; \
	fi
	cp -f `xargs < HTML.manifest` ${DESTDIR}
	-for file in `xargs < HTML.manifest`; do \
		chmod ${DOCMODE} ${DESTDIR}/$$file; \
		chown ${DOCOWN}:${DOCGROUP} ${DESTDIR}/$$file; \
	done
	if [ -f ${.OBJDIR}/${DOC}.ln ]; then \
		(cd ${DESTDIR}; sh ${.OBJDIR}/${DOC}.ln); \
	fi

.for _compressext in ${KNOWN_COMPRESS}
install-${_cf}.tar.${_compressext}: ${DOC}.${_cf}.tar.${_compressext}
	[ -d ${DESTDIR} ] || mkdir -p ${DESTDIR}
	cp -f ${.ALLSRC} ${DESTDIR}
	chmod ${DOCMODE} ${DESTDIR}/${.ALLSRC}
	-chown ${DOCOWN}:${DOCGROUP} ${DESTDIR}/${.ALLSRC}
.endfor
.else
install-${_cf}: ${DOC}.${_cf}
	[ -d ${DESTDIR} ] || mkdir -p ${DESTDIR}
	cp -f ${.ALLSRC} ${DESTDIR}
	chmod ${DOCMODE} ${DESTDIR}/${.ALLSRC}
	-chown ${DOCOWN}:${DOCGROUP} ${DESTDIR}/${.ALLSRC}

.for _compressext in ${KNOWN_COMPRESS}
install-${_cf}.${_compressext}: ${DOC}.${_cf}.${_compressext}
	[ -d ${DESTDIR} ] || mkdir -p ${DESTDIR}
	cp -f ${.ALLSRC} ${DESTDIR}
	chmod ${DOCMODE} ${DESTDIR}/${.ALLSRC}
	-chown ${DOCOWN}:${DOCGROUP} ${DESTDIR}/${.ALLSRC}
.endfor
.endif
.endif
.endfor

.for __target in beforeinstall afterinstall depend _SUBDIR
.if !target(${__target})
${__target}:
.endif
.endfor

--45Z9DzgjV8m4Oswq--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990827194255.A12153>