1 # -*- Mode: makefile; -*-
2 # arch-tag: Primary sgml-common top-level Makefile
3 # Common Makefile for SGML documents
5 # Copyright (C) 2002, 2003 John Goerzen
6 # <jgoerzen@complete.org>
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.
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.
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
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.
28 MASTER := $(MASTERBASE).sgml
29 FIGUREDIRS := $(wildcard figures/*)
32 ######################################################################
34 ######################################################################
36 ifeq ($(DOINDEX), yes)
38 INDEXSGMLFILE := index/index.sgml
39 INDEXDATAFILE := index/HTML.index
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
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"
51 collateindex.pl -i ch.index -N -o index/index.sgml
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
59 ######################################################################
61 ######################################################################
62 $(MASTERBASE).txt: $(MASTER) $(BASICDEPS) $(INDEXSGMLFILE)
63 @echo " *** Generating text output"
66 ######################################################################
67 # PostScript generation
68 ######################################################################
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)
75 ######################################################################
77 ######################################################################
130 @echo " *** Generating PNG image for $<"
131 gs -q -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r90 -dBATCH -dNOPAUSE \
132 -dSAFER -sOutputFile=$@ -sDEVICE=png16m $< -c showpage
137 ######################################################################
139 ######################################################################
141 define copy-figures-worker
143 for DIRECTORY in $(FIGUREDIRS); do mkdir html/$$DIRECTORY; cp -v $$DIRECTORY/*.png html/$$DIRECTORY/; done
147 $(if $(FIGUREDIRS),$(copy-figures-worker))
150 html/index.html: $(MASTER) $(BASICDEPS) $(INDEXSGMLFILE) $(PNGFILES)
151 @echo " *** Generating HTML output"
154 #docbook2html --output html $(MASTER)
155 docbook-2-html $(HTMLARGS) $(MASTER)
156 mv $(MASTERBASE)-html/* html/
157 rmdir $(MASTERBASE)-html
159 # tidy -m html/*.html
160 ln -s $(TOPNODE).html html/index.html
161 -cp -v /usr/share/gtk-doc/data/*.png html/
163 ######################################################################
165 ######################################################################
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
173 -rm `find . -name ".ps"` `find . -name "*.epi"` *.pdf
174 -rm `find . -name "*.png"`
176 ######################################################################
178 ######################################################################
180 GETPAGE=$(shell echo $(1) | sed -e "s/^.*_\([0-9]*\).epi/\\1/g")
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 $@
189 GETPAGEL=$(shell echo $(1) | sed -e "s/^.*_\([0-9]*\)_l.epi/\\1/g")
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 $@
199 pdf: $(MASTERBASE).pdf
201 $(MASTERBASE).pdf: $(MASTERBASE).ps
202 ps2pdf14 $(MASTERBASE).ps
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 . \
212 ###########################################################################
213 # These are obsolete but should still work.
214 ###########################################################################
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
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 \