Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Aug 1995 04:09:15 -0700 (PDT)
From:      "Rodney W. Grimes" <rgrimes@gndrsh.aac.dev.com>
To:        jfieber@indiana.edu (John Fieber)
Cc:        CVS-commiters@freefall.FreeBSD.org, current@freebsd.org
Subject:   Re: Proposal for bsd.sgml.mk
Message-ID:  <199508311109.EAA10935@gndrsh.aac.dev.com>
In-Reply-To: <199508310248.VAA18063@fieber-john.campusview.indiana.edu> from "John Fieber" at Aug 30, 95 09:48:49 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> Here is a sample makefile (for the handbook) using my proposed
> bsd.sgml.mk:
> 
> -------------------
> SGMLOPTS= -links
> .include <bsd.sgml.mk>
> -------------------
> 
> Simple, eh?
> 
> Now, here is the bsd.sgml.mk which I plan to commit if there are
> no great objections.  It isn't perfect, but it gets the job done:

A flash review.. just some nits...

> -------------------
> #       bsd.sgml.mk - 30 Aug 1995 John Fieber
> #       This file is in the public domain.
> #
> #	$Id$
> 
> .if exists(${.CURDIR}/../Makefile.inc)
> .include "${.CURDIR}/../Makefile.inc"
> .endif
> 
> # Variables of possible interest to the user
> 
> FORMATS?=	ascii html
> VOLUME?=	${.CURDIR:T}
> DOC?=		${.CURDIR:T}
> SRCS?=		*.sgml
> SGMLFMT?=	sgmlfmt
> LPR?=		lpr
> SGMLFLAGS+=	${SGMLOPTS}
> BINDIR?=	/usr/share/doc
> BINMODE=        444

BINMODE?=	444
[And the above line has spaces instead of a tab :-(]

> SRCDIR?=	${.CURDIR}
> DISTRIBUTION?=	doc
> 
> # Everything else
> 
> DOCS=	${FORMATS:S/^/${DOC}./g}
> 
> .MAIN:	all
> all:	${DOCS}
> 
> .if !target(obj)
> .if defined(NOOBJ)
> obj:
> .else
> obj:
> 	@cd ${.CURDIR}; rm -f obj; \
> 	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
> 	${ECHO} "$$here -> $$dest"; ln -s $$dest obj; \
> 	if test -d /usr/obj -a ! -d $$dest; then \
> 		mkdir -p $$dest; \
> 	else \
> 		true; \
> 	fi;
> .endif
> .endif
> 
> clean:
> 	rm -f [eE]rrs mklog ${CLEANFILES}
> 
> cleandir: clean
> 	cd ${.CURDIR}; rm -rf obj
> 
> install:	beforeinstall realinstall afterinstall
> 
> .if !target(beforeinstall)
> beforeinstall:
> 
> .endif
> .if !target(afterinstall)
> afterinstall:
> 
> .endif
> .if !target(maninstall)
> maninstall:
> 
> .endif
> 
> 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:
> 	cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies
> .endif
> 
> .if !target(depend)
> depend:
> 
> .endif
> 
> 
> # For each FORMATS type, define a build, install and print target.
> 
> .for _XFORMAT in ${FORMATS}
> 
> # XXX This doesn't work:
> #    .if ${_FORMAT} == "foobar"
> # but defining another variable does:  (?!?!)

Perhaps
.if X${_FORMAT} == X"foobar"
would be what you need.  If ${_FORMAT} is null your statement
above that you say does not work becomes:
.if == "foorbar" and yes, that fails, just like in old /bin/sh :-)

> _FORMAT = ${_XFORMAT}
> 
> .if !target(print-${_FORMAT})
> .if ${_FORMAT} == "html"
> print-${_FORMAT}:
> 
> .else
> print-${_FORMAT}: ${DOC}.${_FORMAT}
> 	${LPR} -P${.TARGET:S/print-//} ${DOC}.${_FORMAT}
> 
> .endif
> .endif
> 
> .if !target(install-${_FORMAT})
> .if ${_FORMAT} == "html"
> install-${_FORMAT}: ${DOC}.${_FORMAT}
> 	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
> 	*.${.TARGET:S/install-//} ${DESTDIR}${BINDIR}/${VOLUME}

	 	*.${.TARGET:S/install-//} ${DESTDIR}${BINDIR}/${VOLUME}
Please indent continutation lines one level.

> 
> .else
> install-${_FORMAT}: ${DOC}.${_FORMAT}
> 	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
> 	${DOC}.${.TARGET:S/install-//} ${DESTDIR}${BINDIR}/${VOLUME}
	 	${DOC}.${.TARGET:S/install-//} ${DESTDIR}${BINDIR}/${VOLUME}
Ditto
> 
> .endif
> .endif
> 
> .if !target(${DOC}.${_FORMAT})
> .if ${_FORMAT} == "html"
> CLEANFILES+=	*.${_FORMAT}
> .else
> CLEANFILES+=	${DOC}.${_FORMAT}
> .endif
> 
> ${DOC}.${_FORMAT}:	${SRCS}
> 	(cd ${SRCDIR}; ${SGMLFMT} -f ${.TARGET:S/${DOC}.//} ${SGMLFLAGS} ${DOC})
> 
> .endif
> 
> .endfor
> 


-- 
Rod Grimes                                      rgrimes@gndrsh.aac.dev.com
Accurate Automation Company                 Reliable computers for FreeBSD



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