1 # -*- Mode: 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: 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.
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 ######################################################################
60 # PostScript generation
61 ######################################################################
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)
68 ######################################################################
70 ######################################################################
98 @echo " *** Generating PNG image for $<"
99 gs -q -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r90 -dBATCH -dNOPAUSE \
100 -dSAFER -sOutputFile=$@ -sDEVICE=png16m $< -c showpage
105 ######################################################################
107 ######################################################################
109 define copy-figures-worker
111 for DIRECTORY in $(FIGUREDIRS); do mkdir html/$$DIRECTORY; cp -v $$DIRECTORY/*.png html/$$DIRECTORY/; done
115 $(if $(FIGUREDIRS),$(copy-figures-worker))
118 html/index.html: $(MASTER) $(BASICDEPS) $(INDEXSGMLFILE) $(PNGFILES)
119 @echo " *** Generating HTML output"
122 #docbook2html --output html $(MASTER)
123 docbook-2-html $(HTMLARGS) $(MASTER)
124 mv $(MASTERBASE)-html/* html/
125 rmdir $(MASTERBASE)-html
127 # tidy -m html/*.html
128 ln -s $(TOPNODE).html html/index.html
129 -cp -v /usr/share/gtk-doc/*.png html/
131 ######################################################################
133 ######################################################################
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
141 -rm `find . -name ".ps"` `find . -name "*.epi"` *.pdf
142 -rm `find . -name "*.png"`
144 ######################################################################
146 ######################################################################
148 GETPAGE=$(shell echo $(1) | sed -e "s/^.*_\([0-9]*\).epi/\\1/g")
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 $@
157 pdf: $(MASTERBASE).pdf
159 $(MASTERBASE).pdf: $(MASTERBASE).ps
160 ps2pdf14 $(MASTERBASE).ps
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 . \
170 ###########################################################################
171 # These are obsolete but should still work.
172 ###########################################################################
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
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 \