common/Makefile.common

James Laska jlaska at redhat.com
Thu Jun 2 17:53:30 UTC 2005


Hello folks,

I've been maintaining a mirror of the
fedora-docs/{common,css,stylesheet-images,xsl} for internal Red Hat
pubs.  I've found that it can be somewhat annoying to maintain pretty
much the same Makefile across all the documents.  I therefore created
"common/Makefile.common" which does all the hard work.  All that is
required at this point is that a document include the common makefile
and establish 2 mandatory variables:

===================================
NAME := install-guide
LANG := en

include ../common/Makefile.common
===================================

There are optional arguments for those wishing to override or add
xsltproc parameters.  Those optional variables are: XSLTPROC_HTMLARGS,
XSLTPROC_NOCHUNKARGS, XSLTPROC_PDFARGS, XSLTPROC_ARGS.

I have attached Makefile.common to this email for review as well.  I
have not yet filed a bugzilla for this, because I first wanted to
solicit fedora-docs-list feedback.

Thoughts/concerns/feedback?

Thanks,
James Laska
-- 
==========================================
 James Laska         -- jlaska at redhat.com
 Quality Engineering -- Red Hat, Inc.
==========================================
-------------- next part --------------
###############################################################################
# Makefile.common for QA Docs
# $Id$
###############################################################################

ifndef NAME
$(error "You can not run this Makefile without having NAME defined")
endif
ifndef LANG
$(error "You can not run this Makefile without having LANG defined")
endif

XSLPDF           = ../xsl/main-pdf.xsl
XSLHTML_CHUNKS   = ../xsl/main-html-chunks.xsl
XSLHTML_NOCHUNKS = ../xsl/main-html-nochunks.xsl
DOCNAME          = $(NAME)-$(LANG)
XMLFILE          = $(DOCNAME).xml

XSLTPROC_HTMLARGS =
XSLTPROC_NOCHUNKARGS =
XSLTPROC_PDFARGS =
XSLTPROC_ARGS    =

txt: TMPFILE = $(shell mktemp /tmp/$(DOCNAME).XXXXXX)

######################################################
html: 
	@mkdir -p $(DOCNAME)
	@xsltproc $(XSLTPROC_ARGS) $(XSLTPROC_HTMLARGS) -o $(DOCNAME)/ $(XSLHTML_CHUNKS) $(XMLFILE)
	@mkdir -p $(DOCNAME)/stylesheet-images $(DOCNAME)/figs
	@cp ../stylesheet-images/*.png $(DOCNAME)/stylesheet-images
	@cp ../css/fedora.css $(DOCNAME)
	@test -d figs && cp -r figs/ $(DOCNAME)/ || test 1

html-nochunks: 
	@mkdir -p $(DOCNAME)
	@xsltproc $(XSLTPROC_ARGS) $(XSLTPROC_NOCHUNKARGS) -o $(DOCNAME)/$(DOCNAME).html $(XSLHTML_NOCHUNKS) $(XMLFILE)
	@mkdir -p $(DOCNAME)/stylesheet-images $(DOCNAME)/figs
	@cp ../stylesheet-images/*.png $(DOCNAME)/stylesheet-images
	@cp ../css/fedora.css $(DOCNAME)
	@test -d figs && cp -r figs/ $(DOCNAME)/ || test 1

pdf:
	@mkdir -p $(DOCNAME)
	@xsltproc $(XSLTPROC_ARGS) $(XSLTPROC_PDFARGS) -o $(DOCNAME)/$(DOCNAME).pdf $(XSLPDF) $(XMLFILE)

txt:
	@mkdir -p $(DOCNAME)
	@xsltproc $(XSLTPROC_ARGS) $(XSLTPROC_NOCHUNKARGS) -o $(TMPFILE) $(XSLHTML_NOCHUNKS) $(XMLFILE)
	@links -force-html -dump $(TMPFILE) > $(DOCNAME)/$(DOCNAME).txt
	@rm -f $(TMPFILE)

all: html html-nochunks pdf txt

######################################################

clean: 
	@rm -rfv *.html *.pdf *.tex $(DOCNAME)


More information about the fedora-docs-list mailing list