|
1 | 1 | #---------------------------------------------------------------------------- |
2 | 2 | # |
3 | | -# pgSphere documentation makefile |
| 3 | +# pgSphere documentation generation |
4 | 4 | # |
5 | 5 | #---------------------------------------------------------------------------- |
6 | 6 |
|
7 | | -USE_PGXS = 1 |
8 | | -ifdef USE_PGXS |
9 | | -PG_CONFIG = pg_config |
10 | | -PGXS := $(shell $(PG_CONFIG) --pgxs) |
11 | | -include $(PGXS) |
12 | | -else |
13 | | -subdir = contrib/pg_sphere/doc |
14 | | -top_builddir = ../../.. |
15 | | -include $(top_builddir)/src/Makefile.global |
16 | | -include $(top_srcdir)/contrib/contrib-global.mk |
| 7 | +ifndef PGSPHERE_VERSION |
| 8 | +include ../Makefile.common.mk |
| 9 | +ifndef PGSPHERE_VERSION |
| 10 | +$(error PGSPHERE_VERSION is not set) |
| 11 | +endif |
17 | 12 | endif |
18 | 13 |
|
19 | | -.SECONDARY: |
20 | | -.NOTPARALLEL: |
| 14 | +ifndef FOP |
| 15 | +FOP = fop |
| 16 | +endif |
21 | 17 |
|
22 | | -ifndef COLLATEINDEX |
23 | | -COLLATEINDEX = $(DOCBOOKSTYLE)/bin/collateindex.pl |
| 18 | +ifdef XMLLINT |
| 19 | +XMLLINT := $(XMLLINT) --nonet |
| 20 | +else |
| 21 | +XMLLINT = xmllint --nonet |
24 | 22 | endif |
25 | 23 |
|
26 | | -ifndef JADE |
27 | | -JADE = openjade |
| 24 | +ifdef XSLTPROC |
| 25 | +XSLTPROC := $(XSLTPROC) --nonet |
| 26 | +else |
| 27 | +XSLTPROC = xsltproc --nonet |
28 | 28 | endif |
29 | | -SGMLINCLUDE = -D $(srcdir) |
30 | 29 |
|
31 | | -ALLSGML := $(wildcard $(srcdir)/*.sgm) |
| 30 | +override XSLTPROCFLAGS += \ |
| 31 | + --path stylesheets --path img --path . \ |
| 32 | + --stringparam pg_sphere.version '$(PGSPHERE_VERSION)' \ |
| 33 | + --stringparam pg.version '$(PGSPHERE_VERSION)' |
32 | 34 |
|
33 | | -ifdef DOCBOOKSTYLE |
34 | | -CATALOG = -c $(DOCBOOKSTYLE)/catalog |
35 | | -endif |
| 35 | +XMLINCLUDE = --path . |
| 36 | +ALLSGML := $(wildcard *.sgm) |
| 37 | +ALLIMAGES := $(wildcard img/*.jpg) |
36 | 38 |
|
37 | | -COLLATEINDEX := $(PERL) $(COLLATEINDEX) -f -g |
| 39 | +all: html pdf |
38 | 40 |
|
| 41 | +.PHONY: all html pdf clean |
39 | 42 |
|
40 | | -all : html |
| 43 | +# This line fixes the error like: |
| 44 | +# No rule to make target 'pg_sphere.control' |
| 45 | +.PHONY: pg_sphere.control |
41 | 46 |
|
42 | | -.PHONY: html pdf ps |
| 47 | +version.xml: |
| 48 | + @echo $(PGSPHERE_VERSION) > version.xml |
43 | 49 |
|
44 | | -XMLDCL = declaration/xml.dcl |
| 50 | +pg_sphere-full.xml: version.xml |
| 51 | +pg_sphere-full.xml: pg_sphere.xml $(ALLSGML) |
| 52 | + $(XMLLINT) $(XMLINCLUDE) --output $@ --noent --valid $< |
45 | 53 |
|
46 | | -html : pg_sphere.xml $(ALLSGML) pg_sphere.dsl |
47 | | - @rm -f *.html |
48 | | - @rm -rf html |
49 | | - mkdir html |
50 | | - mkdir html/img |
51 | | - cp img/*.jpg img/*.png html/img |
52 | | - cp pg_sphere.css html |
53 | | - $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -b UTF-8 -d pg_sphere.dsl -i html -t sgml $(XMLDCL) $< |
54 | | - mv *.html html |
| 54 | +#------------------------------------------------------------------------------ |
| 55 | +# HTML |
| 56 | +#------------------------------------------------------------------------------ |
55 | 57 |
|
56 | | -pg_sphere.tex : pg_sphere.xml $(ALLSGML) pg_sphere.dsl |
57 | | - $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d pg_sphere.dsl -i print -t tex -o $@ $(XMLDCL) $< |
| 58 | +XSLTPROC_HTML_MULTIPAGE_FLAGS := --stringparam img.src.path '' |
| 59 | +XSLTPROC_HTML_SINGLEPAGE_FLAGS := --stringparam img.src.path '' |
58 | 60 |
|
59 | | -pdf : jadetex.cfg pg_sphere.pdf |
| 61 | +html: html-singlepage html-multipage |
60 | 62 |
|
61 | | -pg_sphere.pdf: pg_sphere.tex |
62 | | - @rm -f $*.aux $*.log $*.out |
63 | | - pdfjadetex $< |
64 | | - pdfjadetex $< |
65 | | - pdfjadetex $< |
| 63 | +html-multipage: stylesheets/stylesheet.xsl pg_sphere-full.xml version.xml $(ALLIMAGES) |
| 64 | + $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_MULTIPAGE_FLAGS) $(wordlist 1,2,$^) |
| 65 | + mkdir -p html/img |
| 66 | + cp $(ALLIMAGES) html/img |
66 | 67 |
|
67 | | -ps : pg_sphere.ps |
| 68 | +html-singlepage: pg_sphere-$(PGSPHERE_VERSION).html |
68 | 69 |
|
69 | | -pg_sphere.ps: pg_sphere.pdf |
70 | | - pdftops $< $@ |
| 70 | +pg_sphere-$(PGSPHERE_VERSION).html: stylesheets/stylesheet-html-nochunk.xsl pg_sphere-full.xml version.xml $(ALLIMAGES) |
| 71 | + $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_SINGLEPAGE_FLAGS) -o $@ $(wordlist 1,2,$^) |
71 | 72 |
|
72 | | -pg_sphere.dsl : pg_sphere.dsl-dist |
73 | | - cp $< $@ |
| 73 | +#------------------------------------------------------------------------------ |
| 74 | +# PDF |
| 75 | +#------------------------------------------------------------------------------ |
74 | 76 |
|
75 | | -jadetex.cfg : jadetex.cfg-dist |
76 | | - cp $< $@ |
| 77 | +pdf: pg_sphere-${PGSPHERE_VERSION}-A4.pdf pg_sphere-${PGSPHERE_VERSION}-US.pdf |
77 | 78 |
|
| 79 | +pg_sphere-$(PGSPHERE_VERSION)-A4.pdf: pg_sphere.A4.fo |
| 80 | + $(FOP) -v -fo $< -pdf $@ |
78 | 81 |
|
| 82 | +pg_sphere-$(PGSPHERE_VERSION)-US.pdf: pg_sphere.US.fo |
| 83 | + $(FOP) -v -fo $< -pdf $@ |
79 | 84 |
|
80 | | -## |
81 | | -## Clean |
82 | | -## |
| 85 | +pg_sphere.A4.fo: stylesheets/stylesheet-fo.xsl pg_sphere-full.xml version.xml $(ALLIMAGES) |
| 86 | + $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type A4 -o $@ stylesheets/stylesheet-fo.xsl pg_sphere-full.xml |
83 | 87 |
|
84 | | -clean distclean maintainer-clean: |
85 | | -# HTML |
86 | | - rm -rf html pg_sphere.dsl |
87 | | -# print |
88 | | - rm -f *.rtf *.tex *.dvi *.aux *.log *.ps *.pdf *.out *.fot jadetex.cfg |
89 | | -# img |
90 | | - make clean -C img |
| 88 | +pg_sphere.US.fo: stylesheets/stylesheet-fo.xsl pg_sphere-full.xml version.xml $(ALLIMAGES) |
| 89 | + $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type USLetter -o $@ stylesheets/stylesheet-fo.xsl pg_sphere-full.xml |
| 90 | + |
| 91 | +#------------------------------------------------------------------------------ |
| 92 | +# Cleanup |
| 93 | +#------------------------------------------------------------------------------ |
| 94 | + |
| 95 | +clean distclean: |
| 96 | + rm -rf ./html |
| 97 | + rm -f version.xml |
| 98 | + rm -f pg_sphere-full.xml |
| 99 | + rm -f pg_sphere.A4.fo |
| 100 | + rm -f pg_sphere.US.fo |
| 101 | + rm -f pg_sphere-$(PGSPHERE_VERSION).html |
| 102 | + rm -f pg_sphere-$(PGSPHERE_VERSION)-A4.pdf |
| 103 | + rm -f pg_sphere-$(PGSPHERE_VERSION)-US.pdf |
0 commit comments