OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: Makefile (Was Re: DOCBOOK-APPS: Generating CHM HTML Help files fromDocBook?)


Michael,

> Would you mind to show all of us your Makefile as a template. 
> It might be of interest for many people here...

Sure... here it is, with the following provisos:

  1. I am by no means a Makefile expert, so there may be better ways to do
     what I do (and if there are, I'd love to hear them).

  2. Unfortunately, I just noticed that creation of the tarballs, etc. is 
     still off in another script. (Translation: the next version of our
     product isn't going public yet, so I haven't gotten around to updating
     the Makefile.  Previously I had everything in separate scripts, then
     I started centralizing it all into one makefile.) I am attaching the
     update-org script as well, although it obviously works just for our site.

You will also note that to create the XML file from the SGML file, I use
another file called "header.xml" which I have also attached.  If you look
at it:

  <?xml version="1.0"?>
  <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
  "/usr/share/sgml/docbook/xml-dtd-4.1.2/docbookx.dtd"[

you will notice that I end it with '['.  I do this because the next
part of my header for both SGML and XML has a series of entity 
references that I use throughout the document.  If you don't use
entities, you'll want to change that header.  The sed line was actually
something a sed guru in my local LUG came up with and I tweaked a bit.

I also used a pathname to the DocBook DTD because I frequently work offline
and therefore the parser cannot get to the DTD across the Internet. You
may need to change that to the appropriate path or the URL.

Have fun,
Dan

-- 
Dan York, Director of Training        dyork@e-smith.com
Ph: +1-613-751-4401  Mobile: +1-613-263-4312 Fax: +1-613-564-7739 
Mitel Network Corporation Network Server Solutions Group 
150 Metcalfe St., Suite 1500, Ottawa,ON K2P 1P1 Canada
http://www.e-smith.com/            open source, open mind
# Makefile for e-smith userguide
#
# $Id: Makefile,v 1.5 2001/08/13 13:39:15 dyork Exp $

# Base name to use in filenames

TARGET = userguide

# These filenames are built on the basis of TARGET

SGMLFILE = ${TARGET}.sgml
XMLFILE = ${TARGET}.xml
HTMLFILE = ${TARGET}.html
PDFFILE = ${TARGET}.pdf

# Filename for document plan

DOCPLAN = DocPlan.txt

# Location of manual on intranet

INTMANUAL = /home/e-smith/files/ibays/manual/html/5.0

# Various processing instructions. Placed here so that they can be easily
# modified in the future without having to scan through the whole Makefile.

PRHTML = xsltproc /usr/share/sgml/docbook/e-smith-html-chunk.xsl ../${XMLFILE}
PRHTMLSINGLEPAGE = xsltproc -o ${XMLFILE} /usr/share/sgml/docbook/e-smith-html.xsl ../${XMLFILE}
PRHTMLHELP = xsltproc /usr/share/sgml/docbook/e-smith-htmlhelp.xsl ../${XMLFILE}

# These are the older SGML processing instructions. They are left here in
# case they are ever needed again.
#
#PRHTML = openjade -t sgml -i html -d /usr/lib/sgml/stylesheets/docbook/ldp.dsl\#html ../${SGMLFILE}
#PRHTMLSINGLEPAGE = openjade -t sgml -i html -V nochunks -d /usr/lib/sgml/stylesheets/docbook/ldp.dsl\#html ../${SGMLFILE} > ${TARGET}.html

help:
	@echo
	@echo "---------------------------------------------------------"
	@echo "This makefile for building the e-smith manual contains"
	@echo "the following targets:"
	@echo
	@echo "check - uses 'onsgmls' to validate the SGML code'"
	@echo "pdf   - builds a PDF file"
	@echo "html  - builds the HTML files for the manual"
	@echo "update - updates *intranet* web site for manual"
	@echo "         (but does not update images on intranet web site)"
	@echo "all   - does 'check', 'pdf', 'html' and 'update'"
	@echo "update-images  - updates the images on intranet"
	@echo "update-all  - updates '.org' web site and builds associated"
	@echo "              tarballs and zip files"
	@echo "---------------------------------------------------------"
	@echo 

check:
	@echo
	@echo "Validating SGML code... "
	@onsgmls -s ${SGMLFILE}
	@echo "Validation check complete."
	@echo

# 
# Note that when V5.0 goes live, 'update-all' should be added to the 'all'
# target below so that the manual gets copied up to e-smith.org
#

all: check pdf html update	

pdf: force
	@echo
	@echo "Building PDF file..."
	@echo
	sgml2x --format pdf ${SGMLFILE}
	@echo
	@echo -n "Cleaning up files... "
	@rm *.{log,aux}
	@echo "done."
	@echo

#
# Note that this 'html' target below replaces the functionality
# of the 'process' script found in the 'scripts' subdirectory
#

html: xml force
	@echo -n "Generating HTML pages..."
	@(cd html; ${PRHTML})
	@echo "done."
	@echo -n "Generating single HTML page..."
	@(cd html; ${PRHTMLSINGLEPAGE})
	@echo "done."

htmlhelp: xml force
	@echo -n "Generating HTML Help pages..."
	@(cd htmlhelp; ${PRHTMLHELP})
	@echo "done."

#
# Note that this 'update' target below replaces the functionality
# of the 'update' script found in the 'scripts' subdirectory
#

update:  force
	@echo -n "Copying DocBook file..."
	@cp ${SGMLFILE} ${INTMANUAL}
	@echo "done."
	@echo -n "Copying PDF file..."
	@cp ${PDFFILE} ${INTMANUAL}
	@echo "done."
	@echo -n "Copying document plan file..."
	@cp ${DOCPLAN} ${INTMANUAL}
	@echo "done."
	@echo -n "Removing old manual..."
	@rm ${INTMANUAL}/html/*.html
	@echo "done."
	@echo -n "Installing new manual..."
	@cp html/*.html ${INTMANUAL}/html/
	@echo "done."

#
# Note that this 'update-images' target below replaces the functionality
# of the 'update-images' script found in the 'scripts' subdirectory
#

update-images: force
	@echo -n "Removing old images from html..."
	@rm html/images/*.jpg
	@echo "done."
	@echo -n "Installing new images into html..."
	@cp images/*.{gif,jpg} html/images
	@echo "done."
	@echo -n "Removing old images from htmlhelp..."
	@rm htmlhelp/images/*.jpg
	@echo "done."
	@echo -n "Installing new images into htmlhelp..."
	@cp images/*.{gif,jpg} htmlhelp/images
	@echo "done."
	@echo -n "Removing old images from intranet server..."
	@rm ${INTMANUAL}/html/images/*.jpg
	@echo "done."
	@echo -n "Installing new images on intranet server..."
	@cp images/*.{gif,jpg} ${INTMANUAL}/html/images/
	@echo "done."

#
# At some point, I need to add in here the 'update-org' functionality that
# builds the zip files and tarballs and copies them up to www.e-smith.org.
# For now, that still lives in another script
#

update-all: ${TARGET} update-images force
	(cd html; ../scripts/update-org)

#
# This target is included as a bogus target purely to force make to NOT
# check dependencies and to simply go ahead and perform the actions. There 
# probably is a command-line way to get 'make' to do this, but I do not know
# it and I do not want to have to remember it.
#
force:


# Creates a DocBook XML file from a DocBook SGML file

xml: force
	cp header.xml ${XMLFILE}
	sed -e "1c\\" < ${SGMLFILE} >> ${XMLFILE}


<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"/usr/share/sgml/docbook/xml-dtd-4.1.2/docbookx.dtd"[
# A simple shell script to copy the newest edition of the
# manual to the www.e-smith.org staging area.
#
# This needs to be run from the 'html' subdir under 'manual'
#
echo -n "Removing old manual..."
rm -r ~mirrors/www.e-smith.org/html/docs/manual/5.0/*
echo "done."
echo -n "Installing new manual..."
cp -r * ~mirrors/www.e-smith.org/html/docs/manual/5.0/
echo "done."
echo -n "Copying userguide.sgml..."
cp ../userguide.sgml ~mirrors/www.e-smith.org/html/docs/manual/5.0/
echo "done."
# Eventually this will generate the PDF file as well
echo -n "Copying userguide.pdf..."
cp ../userguide.pdf ~mirrors/www.e-smith.org/html/docs/manual/5.0/
echo "done."
echo -n "Copying single page HTML..."
cp userguide.html ~mirrors/www.e-smith.org/html/docs/manual/5.0/
echo "done."
echo -n "Building images zip file and copying to staging server..."
zip -r /tmp/userguide-images.zip images
cp /tmp/userguide-images.zip ~mirrors/www.e-smith.org/html/docs/manual/5.0/
echo "done."
echo -n "Building images tgz file and copying to staging server..."
tar -cvzf /tmp/userguide-images.tgz images
cp /tmp/userguide-images.tgz ~mirrors/www.e-smith.org/html/docs/manual/5.0/
echo "done."
echo -n "Building manual zip file and copying to staging server..."
rm -r /tmp/e-smith_userguide_5.0
mkdir /tmp/e-smith_userguide_5.0
cp -r . /tmp/e-smith_userguide_5.0
cd /tmp
zip -r /tmp/userguide.zip e-smith_userguide_5.0
cp /tmp/userguide.zip ~mirrors/www.e-smith.org/html/docs/manual/5.0/
echo "done."
echo -n "Building manual tgz file and copying to staging server..."
tar -cvzf /tmp/userguide.tgz e-smith_userguide_5.0
cp /tmp/userguide.tgz ~mirrors/www.e-smith.org/html/docs/manual/5.0/
echo "done."
echo -n "Building eps images zip and tar files and copying to staging server..."
rm -r /tmp/images
mkdir /tmp/images
cp ~dyork/documentation/manual/images/*.eps /tmp/images
zip -r /tmp/userguide-eps-images.zip images
tar -cvzf /tmp/userguide-eps-images.tgz images
cp /tmp/userguide-eps-images.* ~mirrors/www.e-smith.org/html/docs/manual/5.0/
echo "done."



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC