1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
#----------------------------------------------------------------------------
#
# pgSphere documentation generation
#
#----------------------------------------------------------------------------
ifndef PGSPHERE_VERSION
include ../Makefile.common.mk
ifndef PGSPHERE_VERSION
$(error PGSPHERE_VERSION is not set)
endif
endif
ifndef FOP
FOP = fop
endif
ifdef XMLLINT
XMLLINT := $(XMLLINT) --nonet
else
XMLLINT = xmllint --nonet
endif
ifdef XSLTPROC
XSLTPROC := $(XSLTPROC) --nonet
else
XSLTPROC = xsltproc --nonet
endif
override XSLTPROCFLAGS += \
--path stylesheets --path img --path . \
--stringparam pg_sphere.version '$(PGSPHERE_VERSION)' \
--stringparam pg.version '$(PGSPHERE_VERSION)'
XMLINCLUDE = --path .
ALLSGML := $(wildcard *.sgm)
ALLIMAGES := $(wildcard img/*.jpg)
all: html pdf
.PHONY: all html pdf clean
# This line fixes the error like:
# No rule to make target 'pg_sphere.control'
.PHONY: pg_sphere.control
version.xml:
@echo $(PGSPHERE_VERSION) > version.xml
pg_sphere-full.xml: version.xml
pg_sphere-full.xml: pg_sphere.xml $(ALLSGML)
$(XMLLINT) $(XMLINCLUDE) --output $@ --noent --valid $<
#------------------------------------------------------------------------------
# HTML
#------------------------------------------------------------------------------
XSLTPROC_HTML_MULTIPAGE_FLAGS := --stringparam img.src.path ''
XSLTPROC_HTML_SINGLEPAGE_FLAGS := --stringparam img.src.path ''
html: html-singlepage html-multipage
html-multipage: stylesheets/stylesheet.xsl pg_sphere-full.xml version.xml $(ALLIMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_MULTIPAGE_FLAGS) $(wordlist 1,2,$^)
mkdir -p html/img
cp $(ALLIMAGES) html/img
html-singlepage: pg_sphere-$(PGSPHERE_VERSION).html
pg_sphere-$(PGSPHERE_VERSION).html: stylesheets/stylesheet-html-nochunk.xsl pg_sphere-full.xml version.xml $(ALLIMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_SINGLEPAGE_FLAGS) -o $@ $(wordlist 1,2,$^)
#------------------------------------------------------------------------------
# PDF
#------------------------------------------------------------------------------
pdf: pg_sphere-${PGSPHERE_VERSION}-A4.pdf pg_sphere-${PGSPHERE_VERSION}-US.pdf
pg_sphere-$(PGSPHERE_VERSION)-A4.pdf: pg_sphere.A4.fo
$(FOP) -v -fo $< -pdf $@
pg_sphere-$(PGSPHERE_VERSION)-US.pdf: pg_sphere.US.fo
$(FOP) -v -fo $< -pdf $@
pg_sphere.A4.fo: stylesheets/stylesheet-fo.xsl pg_sphere-full.xml version.xml $(ALLIMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type A4 -o $@ stylesheets/stylesheet-fo.xsl pg_sphere-full.xml
pg_sphere.US.fo: stylesheets/stylesheet-fo.xsl pg_sphere-full.xml version.xml $(ALLIMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type USLetter -o $@ stylesheets/stylesheet-fo.xsl pg_sphere-full.xml
#------------------------------------------------------------------------------
# Cleanup
#------------------------------------------------------------------------------
clean distclean:
rm -rf ./html
rm -f version.xml
rm -f pg_sphere-full.xml
rm -f pg_sphere.A4.fo
rm -f pg_sphere.US.fo
rm -f pg_sphere-$(PGSPHERE_VERSION).html
rm -f pg_sphere-$(PGSPHERE_VERSION)-A4.pdf
rm -f pg_sphere-$(PGSPHERE_VERSION)-US.pdf
|