From d3962c78a295d9814152e2dc6d7bd1a3268e1357 Mon Sep 17 00:00:00 2001 From: Tommy Reynolds Date: Sun, 12 Mar 2006 17:48:11 +0000 Subject: Separate PDF generation into two steps: first create the XML-FO form of the XML, and then render the XML-FO into PDF. Added "fo", "fo-all", "fo-${LANG}" targets to do the XML-FO conversion, and then have the "pdf-${LANG}" targets use the "${LANG}/${DOCBASE}.fo" file as their only prerequisite. I'm using xmllint to reformat the .FO files for now; otherwise it's all one very, very long line and all the diagnostics complain about that one line ;-) --- Makefile.common | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/Makefile.common b/Makefile.common index cc7ace7..5af73ea 100644 --- a/Makefile.common +++ b/Makefile.common @@ -2,18 +2,8 @@ # Makefile.common # # This file, to be included from every document's local Makefile, provides -# the basic targets used by the Fedora Docs Project: -# all -- Default target, builds HTML document only -# ${DOCNAME}/index.html -- Builds HTML version of document -# html -- See "${DOCNAME}/index.html" -# html-nochunks -- See "${DOCNAME}.html"; single HTML file -# ${DOCNAME}.tar.gz -- Packages HTML document into a tar archive -# tarball -- See "${DOCNAME}.tar.gz" -# clean -- Deletes all generated files and directories -# distclean -- See "clean" -# ${DOCNAME}.pdf -- Builds PDF version of document -# pdf -- See "${DOCNAME}.pdf" -# txt -- Make ASCII txt version +# the basic targets used by the Fedora Docs Project. To see a list, +# type "make help". ######################################################################### ######################################################################### @@ -480,21 +470,41 @@ tarball:: $(foreach LANG,${LANGUAGES},$(DOCBASE)-$(LANG).tar.gz) ######################################################################### # For each language in ${LANGUAGES}, generate an Adobe Portable Document # Format (PDF) file. +define FO_template +.PHONY: fo-${1} +fo-${1}:: ${1}/${DOCBASE}.fo +${1}/${DOCBASE}.fo:: ${XMLFILES-${1}} ${XMLDEPFILES-${1}} set-locale-${1} + LANG=${1}.UTF-8 xsltproc --xinclude ${XSLPDF} \ + ${1}/${DOCBASE}.xml | ${XMLLINT} --format -o $$@ - +clean:: + ${RM} ${1}/${DOCBASE}.fo +help:: + @printf ${TFMT} 'fo-${1}' 'Creates ${1}/${DOCBASE}.fo file' + @printf ${TFMT} '${1}/${DOCBASE}.fo' 'XSL-FO file for locale ${1}' +endef + +$(foreach L,${LANGUAGES},$(eval $(call FO_template,${L}))) + +.PHONY: fo fo-all +fo fo-all:: $(foreach L,${LANGUAGES},fo-${L}) +help:: + @printf ${TFMT} 'fo' 'Generate .FO files for all languages' + @printf ${TFMT} 'fo-all' 'Generate .FO files for all languages' + define PDF_template .PHONY: pdf-${1} - pdf-$(1):: ${DOCBASE}-$(1).pdf -${DOCBASE}-$(1).pdf:: ${XMLFILES-${1}} ${XMLDEPFILES-${1}} set-locale-${1} - LANG=${1}.UTF-8 ${XMLTO} pdf -x $(XSLPDF) $(1)/$(DOCBASE).xml - mv -f ${DOCBASE}.pdf ${DOCBASE}-${1}.pdf +${DOCBASE}-${1}.pdf:: ${1}/${DOCBASE}.fo + LANG=${1}.UTF-8 ${XMLTO} -o ${1} pdf $$< + mv -f ${1}/${DOCBASE}.pdf $$@ distclean:: ${RM} ${DOCBASE}-${1}.pdf help:: - @printf ${TFMT} 'pdf-${1}' 'Renders XML into PDF file for locale ${1}' - @printf ${TFMT} '${DOCBASE}-${1}.pdf' 'Renders XML into PDF file' + @printf ${TFMT} 'pdf-${1}' 'Renders XML-FO into PDF for locale ${1}' + @printf ${TFMT} '${DOCBASE}-${1}.pdf' 'Renders XML-FO into PDF file' endef -- cgit