]> code.delx.au - offlineimap/blob - head/docs/sgml-common/Makefile.common
6f6d16e0801a0171b64cd0ff970d37a6db9340fa
[offlineimap] / head / docs / sgml-common / Makefile.common
1 # -*- Mode: makefile; -*-
2 #
3 # Common Makefile for SGML documents
4 #
5 # Copyright (C) 2002, 2003 John Goerzen
6 # <jgoerzen@complete.org>
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22 # The following variables should be set:
23 # MASTERBASE -- basename of master file -- example: linux-guide
24 # BASICDEPS -- various dependencies of the master file. For instance,
25 # this might include files included in the SGML. It could also be empty.
26 # TOPNODE -- Basename of top id for HTML link.
27
28 MASTER := $(MASTERBASE).sgml
29 FIGUREDIRS := $(wildcard figures/*)
30 DOINDEX ?= yes
31
32 ######################################################################
33 # Index generation
34 ######################################################################
35
36 ifeq ($(DOINDEX), yes)
37
38 INDEXSGMLFILE := index/index.sgml
39 INDEXDATAFILE := index/HTML.index
40
41 $(INDEXSGMLFILE): $(INDEXDATAFILE)
42 @echo " *** Generating SGML index from index list"
43 collateindex.pl -i ch.index -g -o index/index.sgml index/HTML.index
44
45 $(INDEXDATAFILE): $(MASTER) $(BASICDEPS)
46 # jade -t sgml -d docbook.dsl -V html-index $(MASTER)
47 # jade -t sgml -V html-index $(MASTER)
48 @echo " *** Generating index list from document"
49 -rm -r index
50 mkdir index
51 collateindex.pl -i ch.index -N -o index/index.sgml
52 #mkdir html-temp
53 #docbook2html --output html-temp -V html-index $(MASTER)
54 docbook-2-html -O -V -O html-index $(HTMLARGS) $(MASTER)
55 mv $(MASTERBASE)-html/HTML.index index/
56 rm -r $(MASTERBASE)-html
57 endif # DOINDEX
58
59 ######################################################################
60 # PostScript generation
61 ######################################################################
62
63 $(MASTERBASE).ps: $(MASTER) $(BASICDEPS) $(INDEXSGMLFILE) $(EPSFILES)
64 @echo " *** Generating PostScript output"
65 # This works too: docbook2ps -V paper-size=Letter $(MASTER)
66 docbook-2-ps -q -O -V -O paper-size=Letter $(PSARGS) $(MASTER)
67
68 ######################################################################
69 # Figure generation
70 ######################################################################
71
72 %_1.epi: %.ps
73 $(get-epi)
74 %_2.epi: %.ps
75 $(get-epi)
76 %_3.epi: %.ps
77 $(get-epi)
78 %_4.epi: %.ps
79 $(get-epi)
80 %_5.epi: %.ps
81 $(get-epi)
82 %_6.epi: %.ps
83 $(get-epi)
84 %_7.epi: %.ps
85 $(get-epi)
86 %_8.epi: %.ps
87 $(get-epi)
88 %_9.epi: %.ps
89 $(get-epi)
90 %_10.epi: %.ps
91 $(get-epi)
92 %_11.epi: %.ps
93 $(get-epi)
94 %_12.epi: %.ps
95 $(get-epi)
96
97 %.png: %.epi
98 @echo " *** Generating PNG image for $<"
99 gs -q -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r90 -dBATCH -dNOPAUSE \
100 -dSAFER -sOutputFile=$@ -sDEVICE=png16m $< -c showpage
101
102 %.ps: %.pdf
103 pdftops $<
104
105 ######################################################################
106 # HTML generation
107 ######################################################################
108
109 define copy-figures-worker
110 mkdir html/figures
111 for DIRECTORY in $(FIGUREDIRS); do mkdir html/$$DIRECTORY; cp -v $$DIRECTORY/*.png html/$$DIRECTORY/; done
112 endef
113
114 define copy-figures
115 $(if $(FIGUREDIRS),$(copy-figures-worker))
116 endef
117
118 html/index.html: $(MASTER) $(BASICDEPS) $(INDEXSGMLFILE) $(PNGFILES)
119 @echo " *** Generating HTML output"
120 -rm -r html
121 mkdir html
122 #docbook2html --output html $(MASTER)
123 docbook-2-html $(HTMLARGS) $(MASTER)
124 mv $(MASTERBASE)-html/* html/
125 rmdir $(MASTERBASE)-html
126 $(copy-figures)
127 # tidy -m html/*.html
128 ln -s $(TOPNODE).html html/index.html
129 -cp -v /usr/share/gtk-doc/*.png html/
130
131 ######################################################################
132 # Cleaning
133 ######################################################################
134
135 clean:
136 -rm -f `find . -name "*~"` `find . -name "*.png"` `find . -name "*.epi"`
137 -rm -r html-temp linux-guide-html html index
138 -rm *.aux *.log *.dvi *.tex *.jtex *.ps *.html *.log *.out jadetex.cfg
139 -rm *.ps html/*.html figures/topology/*.epi figures/topology/*.png
140 -rm *.log *.pdb
141 -rm `find . -name ".ps"` `find . -name "*.epi"` *.pdf
142 -rm `find . -name "*.png"`
143
144 ######################################################################
145 # Utility functions
146 ######################################################################
147
148 GETPAGE=$(shell echo $(1) | sed -e "s/^.*_\([0-9]*\).epi/\\1/g")
149 define get-epi
150 @echo " *** Generating EPI image for $<"
151 psselect -q $(call GETPAGE,$@) $< temp.ps
152 psresize -w 6.375in -h 8.25in temp.ps temp2.ps
153 ../sgml-common/ps2epsi temp2.ps $@
154 rm temp.ps temp2.ps
155 endef
156
157 pdf: $(MASTERBASE).pdf
158
159 $(MASTERBASE).pdf: $(MASTERBASE).ps
160 ps2pdf14 $(MASTERBASE).ps
161
162 plucker: $(MASTERBASE).pdb
163 $(MASTERBASE).pdb: html
164 plucker-build --bpp=4 --compression=zlib --doc-name="$(MASTERBASE)" \
165 -H file:`pwd`/html/index.html -M 5 \
166 --maxheight=320 --maxwidth=310 \
167 --staybelow=file:`pwd`/html --title="$(MASTERBASE)" -p . \
168 -f $(MASTERBASE)
169
170 ###########################################################################
171 # These are obsolete but should still work.
172 ###########################################################################
173
174
175 $(MASTERBASE).dvi: $(MASTERBASE).tex
176 @echo " *** Generating DVI file."
177 jadetex unix-guide.tex
178 jadetex unix-guide.tex
179 jadetex unix-guide.tex
180
181 $(MASTERBASE).tex: $(MASTER) $(BASICDEPS) $(INDEXSGMLFILE)
182 @echo " *** Generating TeX files."
183 docbook2tex -V paper-size=Letter $(MASTER)
184 # jade -t tex -V tex-backend -d \
185 # /usr/share/sgml/docbook/stylesheet/dsssl/modular/print/docbook.dsl \
186 # $(MASTER)
187