| 1 | .SUFFIXES: .dbk .html .dia .eps .png .pdf |
|---|
| 2 | |
|---|
| 3 | # To make this work, you need: |
|---|
| 4 | # - perl, sed. |
|---|
| 5 | # - dia, if you want to edit the graphs. |
|---|
| 6 | # - docbook DTDs. Modify the "catalog" file to point to them. |
|---|
| 7 | # - docbook XSLT stylesheets. Modify DOCBOOK_XSLT below to point to them. |
|---|
| 8 | # - xsltproc. |
|---|
| 9 | # - xep. Modify XEP below to point to it. |
|---|
| 10 | # - ps2pdf, if you want to create the PDF files. |
|---|
| 11 | |
|---|
| 12 | # This depends on where you installed xep. |
|---|
| 13 | XEP = /bin/sh /usr/local/XEP/xep.sh \ |
|---|
| 14 | -DLICENSE=Render-X-license.txt \ |
|---|
| 15 | -DTMPDIR=/tmp -quiet |
|---|
| 16 | |
|---|
| 17 | # Get xsltproc to use the local XML catalog file. |
|---|
| 18 | XSLTPROC = SGML_CATALOG_FILES=catalog xsltproc --catalogs |
|---|
| 19 | |
|---|
| 20 | # Each system places this somewhere else. |
|---|
| 21 | # Gentoo: /usr/share/sgml/docbook/xsl-stylesheets-1.65.1 |
|---|
| 22 | # MAX OS C: /sw/share/xml/xsl/docbook-xsl |
|---|
| 23 | # Ubuntu: /usr/share/xml/docbook/stylesheet/nwalsh |
|---|
| 24 | # BSD: /usr/share/csl/docbook/ |
|---|
| 25 | # Cygwin: /usr/share/docbook-xsl |
|---|
| 26 | DOCBOOK_XSLT = /usr/share/xml/docbook/stylesheet/nwalsh |
|---|
| 27 | |
|---|
| 28 | HTML = \ |
|---|
| 29 | spec.html changes.html index.html type.html map.html seq.html str.html \ |
|---|
| 30 | bool.html binary.html float.html int.html merge.html null.html \ |
|---|
| 31 | timestamp.html value.html yaml.html omap.html pairs.html set.html |
|---|
| 32 | |
|---|
| 33 | PS = \ |
|---|
| 34 | spec.ps changes.ps index.ps type.ps map.ps seq.ps str.ps \ |
|---|
| 35 | bool.ps binary.ps float.ps int.ps merge.ps null.ps \ |
|---|
| 36 | timestamp.ps value.ps yaml.ps omap.ps pairs.ps set.ps |
|---|
| 37 | |
|---|
| 38 | PDF = \ |
|---|
| 39 | spec.pdf changes.pdf index.pdf type.pdf map.pdf seq.pdf str.pdf \ |
|---|
| 40 | bool.pdf binary.pdf float.pdf int.pdf merge.pdf null.pdf \ |
|---|
| 41 | timestamp.pdf value.pdf yaml.pdf omap.pdf pairs.pdf set.pdf |
|---|
| 42 | |
|---|
| 43 | EPS_IMAGES = \ |
|---|
| 44 | model2.eps overview2.eps \ |
|---|
| 45 | present2.eps represent2.eps serialize2.eps styles2.eps validity2.eps |
|---|
| 46 | |
|---|
| 47 | PNG_IMAGES = \ |
|---|
| 48 | model2.png overview2.png \ |
|---|
| 49 | present2.png represent2.png serialize2.png styles2.png validity2.png |
|---|
| 50 | |
|---|
| 51 | all: html pdf |
|---|
| 52 | |
|---|
| 53 | site: all |
|---|
| 54 | mkdir site |
|---|
| 55 | mkdir site/spec |
|---|
| 56 | mkdir site/type |
|---|
| 57 | mkdir site/spec/cvs |
|---|
| 58 | cp type.html site/type/index.html |
|---|
| 59 | cp type.pdf site/type/index.pdf |
|---|
| 60 | cp type.ps site/type/index.ps |
|---|
| 61 | for T in map seq str bool binary float int merge null timestamp value \ |
|---|
| 62 | yaml omap pairs set; do cp $$T.html $$T.pdf $$T.ps site/type; done |
|---|
| 63 | cp spec.html site/spec/cvs/current.html |
|---|
| 64 | cp spec.pdf site/spec/cvs/current.pdf |
|---|
| 65 | cp spec.ps site/spec/cvs/current.ps |
|---|
| 66 | cp $(PNG_IMAGES) site/spec/cvs |
|---|
| 67 | cp single_html.css site/spec/cvs |
|---|
| 68 | cp single_html.css site/type |
|---|
| 69 | for F in changes index; do cp $$F.html $$F.pdf $$F.ps site/spec; done |
|---|
| 70 | |
|---|
| 71 | site.tgz: site |
|---|
| 72 | cd site && tar cvzf ../site.tgz * |
|---|
| 73 | |
|---|
| 74 | html: $(HTML) |
|---|
| 75 | |
|---|
| 76 | pdf: $(PDF) |
|---|
| 77 | |
|---|
| 78 | clean: |
|---|
| 79 | rm -f $(HTML) $(PDF) $(PS) |
|---|
| 80 | |
|---|
| 81 | $(PDF): single_fo.xsl ebnf_fo.xsl preprocess_fo.xsl |
|---|
| 82 | |
|---|
| 83 | $(HTML): single_html.xsl preprocess_html.xsl |
|---|
| 84 | |
|---|
| 85 | .dbk.html: single_html.xsl catalog docbook_xslt |
|---|
| 86 | $(XSLTPROC) single_html.xsl $*.dbk > $*.html |
|---|
| 87 | |
|---|
| 88 | .dbk.pdf: single_fo.xsl Render-X-license.txt catalog docbook_xslt |
|---|
| 89 | $(XSLTPROC) --param generate.toc "''" single_fo.xsl $*.dbk > tmp.xml |
|---|
| 90 | $(XEP) tmp.xml -ps $*.ps |
|---|
| 91 | ps2pdf $*.ps |
|---|
| 92 | rm tmp.xml |
|---|
| 93 | |
|---|
| 94 | .dia.eps: |
|---|
| 95 | @echo "Export $*.eps using Pango fonts" |
|---|
| 96 | dia $*.dia |
|---|
| 97 | # Dia 0.93 crashes for some reason: |
|---|
| 98 | # dia --export-to-format eps-pango $*.dia |
|---|
| 99 | |
|---|
| 100 | .dia.png: |
|---|
| 101 | @echo "Export $*.png using dia (scale pixels by x2.5)" |
|---|
| 102 | dia $*.dia |
|---|
| 103 | # Dia 0.93 offers no control over resolution: |
|---|
| 104 | # dia --export-to-format eps-pango $*.dia |
|---|
| 105 | |
|---|
| 106 | changes.pdf: changes.dbk Render-X-license.txt catalog docbook_xslt |
|---|
| 107 | $(XSLTPROC) single_fo.xsl changes.dbk > tmp1.xml |
|---|
| 108 | sed 's/Chapter.//g' < tmp1.xml > tmp2.xml |
|---|
| 109 | $(XEP) tmp2.xml -ps changes.ps |
|---|
| 110 | ps2pdf changes.ps |
|---|
| 111 | rm tmp1.xml tmp2.xml |
|---|
| 112 | |
|---|
| 113 | type.pdf: type.dbk Render-X-license.txt catalog docbook_xslt |
|---|
| 114 | $(XSLTPROC) single_fo.xsl type.dbk > tmp1.xml |
|---|
| 115 | sed 's/11em/24em/g' < tmp1.xml > tmp2.xml |
|---|
| 116 | $(XEP) tmp2.xml -ps type.ps |
|---|
| 117 | ps2pdf type.ps |
|---|
| 118 | rm tmp1.xml tmp2.xml |
|---|
| 119 | |
|---|
| 120 | spec.pdf: spec.dbk \ |
|---|
| 121 | preprocess_fo.pl preprocess_ps.pl catalog docbook_xslt \ |
|---|
| 122 | $(EPS_IMAGES) Render-X-license.txt |
|---|
| 123 | $(XSLTPROC) preprocess_fo.xsl spec.dbk > tmp1.xml |
|---|
| 124 | $(XSLTPROC) single_fo.xsl tmp1.xml > tmp2.xml |
|---|
| 125 | perl preprocess_fo.pl tmp2.xml > tmp3.xml |
|---|
| 126 | $(XEP) tmp3.xml -ps tmp3.ps |
|---|
| 127 | perl preprocess_ps.pl tmp3.ps > spec.ps |
|---|
| 128 | ps2pdf spec.ps |
|---|
| 129 | rm tmp1.xml tmp2.xml tmp3.xml tmp3.ps |
|---|
| 130 | |
|---|
| 131 | spec.html: spec.dbk \ |
|---|
| 132 | preprocess_png.sed preprocess_html.pl catalog docbook_xslt \ |
|---|
| 133 | $(PNG_IMAGES) |
|---|
| 134 | perl verify_lhs.pl < spec.dbk |
|---|
| 135 | perl verify_terms.pl |
|---|
| 136 | sed -f preprocess_png.sed spec.dbk > tmp1.xml |
|---|
| 137 | $(XSLTPROC) preprocess_html.xsl tmp1.xml > tmp2.xml |
|---|
| 138 | $(XSLTPROC) single_html.xsl tmp2.xml > tmp3.xml |
|---|
| 139 | perl preprocess_html.pl tmp3.xml > spec.html |
|---|
| 140 | rm tmp1.xml tmp2.xml tmp3.xml |
|---|
| 141 | |
|---|
| 142 | docbook_xslt: |
|---|
| 143 | ln -s $(DOCBOOK_XSLT) docbook_xslt |
|---|