|
1 # -*- Mode: makefile; -*- |
|
2 # arch-tag: Primary sgml-common top-level Makefile |
|
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: my-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 # Text generation |
|
61 ###################################################################### |
|
62 $(MASTERBASE).txt: $(MASTER) $(BASICDEPS) $(INDEXSGMLFILE) |
|
63 @echo " *** Generating text output" |
|
64 docbook2txt $(MASTER) |
|
65 |
|
66 ###################################################################### |
|
67 # PostScript generation |
|
68 ###################################################################### |
|
69 |
|
70 $(MASTERBASE).ps: $(MASTER) $(BASICDEPS) $(INDEXSGMLFILE) $(EPSFILES) |
|
71 @echo " *** Generating PostScript output" |
|
72 # This works too: docbook2ps -V paper-size=Letter $(MASTER) |
|
73 docbook-2-ps -q -O -V -O paper-size=Letter $(PSARGS) $(MASTER) |
|
74 |
|
75 ###################################################################### |
|
76 # Figure generation |
|
77 ###################################################################### |
|
78 |
|
79 %_1.epi: %.ps |
|
80 $(get-epi) |
|
81 %_2.epi: %.ps |
|
82 $(get-epi) |
|
83 %_3.epi: %.ps |
|
84 $(get-epi) |
|
85 %_4.epi: %.ps |
|
86 $(get-epi) |
|
87 %_5.epi: %.ps |
|
88 $(get-epi) |
|
89 %_6.epi: %.ps |
|
90 $(get-epi) |
|
91 %_7.epi: %.ps |
|
92 $(get-epi) |
|
93 %_8.epi: %.ps |
|
94 $(get-epi) |
|
95 %_9.epi: %.ps |
|
96 $(get-epi) |
|
97 %_10.epi: %.ps |
|
98 $(get-epi) |
|
99 %_11.epi: %.ps |
|
100 $(get-epi) |
|
101 %_12.epi: %.ps |
|
102 $(get-epi) |
|
103 |
|
104 %_1_l.epi: %.ps |
|
105 $(get-epil) |
|
106 %_2_l.epi: %.ps |
|
107 $(get-epil) |
|
108 %_3_l.epi: %.ps |
|
109 $(get-epil) |
|
110 %_4_l.epi: %.ps |
|
111 $(get-epil) |
|
112 %_5_l.epi: %.ps |
|
113 $(get-epil) |
|
114 %_6_l.epi: %.ps |
|
115 $(get-epil) |
|
116 %_7_l.epi: %.ps |
|
117 $(get-epil) |
|
118 %_8_l.epi: %.ps |
|
119 $(get-epil) |
|
120 %_9_l.epi: %.ps |
|
121 $(get-epil) |
|
122 %_10_l.epi: %.ps |
|
123 $(get-epil) |
|
124 %_11_l.epi: %.ps |
|
125 $(get-epil) |
|
126 %_12_l.epi: %.ps |
|
127 $(get-epil) |
|
128 |
|
129 %.png: %_l.epi |
|
130 @echo " *** Generating PNG image for $<" |
|
131 gs -q -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r90 -dBATCH -dNOPAUSE \ |
|
132 -dSAFER -sOutputFile=$@ -sDEVICE=png16m $< -c showpage |
|
133 |
|
134 %.ps: %.pdf |
|
135 pdftops $< |
|
136 |
|
137 ###################################################################### |
|
138 # HTML generation |
|
139 ###################################################################### |
|
140 |
|
141 define copy-figures-worker |
|
142 mkdir html/figures |
|
143 for DIRECTORY in $(FIGUREDIRS); do mkdir html/$$DIRECTORY; cp -v $$DIRECTORY/*.png html/$$DIRECTORY/; done |
|
144 endef |
|
145 |
|
146 define copy-figures |
|
147 $(if $(FIGUREDIRS),$(copy-figures-worker)) |
|
148 endef |
|
149 |
|
150 html/index.html: $(MASTER) $(BASICDEPS) $(INDEXSGMLFILE) $(PNGFILES) |
|
151 @echo " *** Generating HTML output" |
|
152 -rm -r html |
|
153 mkdir html |
|
154 #docbook2html --output html $(MASTER) |
|
155 docbook-2-html $(HTMLARGS) $(MASTER) |
|
156 mv $(MASTERBASE)-html/* html/ |
|
157 rmdir $(MASTERBASE)-html |
|
158 $(copy-figures) |
|
159 # tidy -m html/*.html |
|
160 ln -s $(TOPNODE).html html/index.html |
|
161 -cp -v /usr/share/gtk-doc/data/*.png html/ |
|
162 |
|
163 ###################################################################### |
|
164 # Cleaning |
|
165 ###################################################################### |
|
166 |
|
167 clean: |
|
168 -rm -f `find . -name "*~"` `find . -name "*.png"` `find . -name "*.epi"` |
|
169 -rm -r html-temp html index $(MASTERBASE).txt |
|
170 -rm *.aux *.log *.dvi *.tex *.jtex *.ps *.html *.log *.out jadetex.cfg |
|
171 -rm *.ps html/*.html figures/topology/*.epi figures/topology/*.png |
|
172 -rm *.log *.pdb |
|
173 -rm `find . -name ".ps"` `find . -name "*.epi"` *.pdf |
|
174 -rm `find . -name "*.png"` |
|
175 |
|
176 ###################################################################### |
|
177 # Utility functions |
|
178 ###################################################################### |
|
179 |
|
180 GETPAGE=$(shell echo $(1) | sed -e "s/^.*_\([0-9]*\).epi/\\1/g") |
|
181 define get-epi |
|
182 @echo " *** Generating EPI image for $<" |
|
183 psselect -q $(call GETPAGE,$@) $< temp.ps |
|
184 psresize -w 6.375in -h 8.25in temp.ps temp2.ps |
|
185 ../sgml-common/ps2epsi temp2.ps $@ |
|
186 rm temp.ps temp2.ps |
|
187 endef |
|
188 |
|
189 GETPAGEL=$(shell echo $(1) | sed -e "s/^.*_\([0-9]*\)_l.epi/\\1/g") |
|
190 define get-epil |
|
191 @echo " *** Generating large EPI image for $<" |
|
192 psselect -q $(call GETPAGEL,$@) $< temp.ps |
|
193 psresize -w 8.5in -h 11in temp.ps temp2.ps |
|
194 ../sgml-common/ps2epsi temp2.ps $@ |
|
195 rm temp.ps temp2.ps |
|
196 endef |
|
197 |
|
198 |
|
199 pdf: $(MASTERBASE).pdf |
|
200 |
|
201 $(MASTERBASE).pdf: $(MASTERBASE).ps |
|
202 ps2pdf14 $(MASTERBASE).ps |
|
203 |
|
204 plucker: $(MASTERBASE).pdb |
|
205 $(MASTERBASE).pdb: html |
|
206 plucker-build --bpp=4 --compression=zlib --doc-name="$(MASTERBASE)" \ |
|
207 -H file:`pwd`/html/index.html -M 5 \ |
|
208 --maxheight=320 --maxwidth=310 \ |
|
209 --staybelow=file:`pwd`/html --title="$(MASTERBASE)" -p . \ |
|
210 -f $(MASTERBASE) |
|
211 |
|
212 ########################################################################### |
|
213 # These are obsolete but should still work. |
|
214 ########################################################################### |
|
215 |
|
216 |
|
217 $(MASTERBASE).dvi: $(MASTERBASE).tex |
|
218 @echo " *** Generating DVI file." |
|
219 jadetex unix-guide.tex |
|
220 jadetex unix-guide.tex |
|
221 jadetex unix-guide.tex |
|
222 |
|
223 $(MASTERBASE).tex: $(MASTER) $(BASICDEPS) $(INDEXSGMLFILE) |
|
224 @echo " *** Generating TeX files." |
|
225 docbook2tex -V paper-size=Letter $(MASTER) |
|
226 # jade -t tex -V tex-backend -d \ |
|
227 # /usr/share/sgml/docbook/stylesheet/dsssl/modular/print/docbook.dsl \ |
|
228 # $(MASTER) |
|
229 |