1 #=============================================================================
5 # Additional rules for processing documentation written in DocBook/SGML
7 #=============================================================================
8 #####ECOSGPLCOPYRIGHTBEGIN####
9 ## -------------------------------------------
10 ## This file is part of eCos, the Embedded Configurable Operating System.
11 ## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
13 ## eCos is free software; you can redistribute it and/or modify it under
14 ## the terms of the GNU General Public License as published by the Free
15 ## Software Foundation; either version 2 or (at your option) any later version.
17 ## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 ## You should have received a copy of the GNU General Public License along
23 ## with eCos; if not, write to the Free Software Foundation, Inc.,
24 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 ## As a special exception, if other files instantiate templates or use macros
27 ## or inline functions from this file, or you compile this file and link it
28 ## with other works to produce a work based on this file, this file does not
29 ## by itself cause the resulting work to be covered by the GNU General Public
30 ## License. However the source code for this file must still be made available
31 ## in accordance with section (3) of the GNU General Public License.
33 ## This exception does not invalidate any other reasons why a work based on
34 ## this file might be covered by the GNU General Public License.
36 ## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37 ## at http://sources.redhat.com/ecos/ecos-license/
38 ## -------------------------------------------
39 #####ECOSGPLCOPYRIGHTEND####
40 #=============================================================================
41 #####DESCRIPTIONBEGIN####
45 # Purpose: Rules for processing documentation
47 # Each package's doc directory's makefile should define the
48 # following variables:
49 # TOPLEVEL - of the component repository
50 # MAIN_SGML - documentation entry point
51 # OTHER_SGML - any other .sgml files accessed from main
52 # PICTURES - referenced by the SGML files
53 #####DESCRIPTIONEND####
54 #=============================================================================
56 .PHONY: default check html pdf clean copyfiles
58 # Locations of the stylesheets and other SGML support files. These
59 # have moved around in various releases of the tools.
60 ifneq (,$(wildcard /usr/share/sgml/docbook))
61 CATALOG := /etc/sgml/catalog
62 ifneq (,$(wildcard /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/catalog))
63 DSSSL_CATALOG := /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/catalog
65 DSSSL_CATALOG := $(firstword $(wildcard /usr/share/sgml/docbook/dsssl-stylesheets-*/catalog))
68 ifneq (,$(wildcard /usr/lib/sgml/stylesheets/nwalsh-modular/catalog))
69 CATALOG := /usr/lib/sgml/CATALOG
70 DSSSL_CATALOG := /usr/lib/sgml/stylesheets/nwalsh-modular/catalog
72 ifneq (,$(wildcard /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/sgml.catalog))
73 CATALOG := /usr/lib/sgml/catalog
74 DSSSL_CATALOG := /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/sgml.catalog
79 A4_STYLESHEET := $(TOPLEVEL)/pkgconf/ssa4.dsl
80 LETTER_STYLESHEET := $(TOPLEVEL)/pkgconf/ssletter.dsl
81 HTML_STYLESHEET := $(TOPLEVEL)/pkgconf/stylesheet.dsl
82 FIXHTML := $(TOPLEVEL)/pkgconf/fixhtml.tcl
85 CATALOG_OPT := -c $(CATALOG)
88 ifneq (,$(DSSL_CATALOG))
89 DSSL_CATALOG_OPT := -c $(DSSL_CATALOG)
92 # The files that will be generated:
94 MAIN_HTML := $(subst .sgml,.html,$(MAIN_SGML))
97 MAIN_PDF := $(subst .sgml,.pdf,$(MAIN_SGML))
100 MAIN_PDFA4 := $(subst .pdf,-a4.pdf,$(MAIN_PDF))
101 MAIN_PDFLETTER := $(subst .pdf,-letter.pdf,$(MAIN_PDF))
103 # Rules for generating pictures
104 GIFS := $(foreach x,$(PICTURES),$(x).gif)
105 EPS := $(foreach x,$(PICTURES),$(x).eps)
106 PNGS :=$(foreach x,$(PICTURES),$(x).png)
109 convert -crop 0x0 $< $@
115 convert -crop 0x0 $< $@
117 # This is a little grotty. In some cases we want to just copy files from
118 # their source location to the destination's current dir and nothing
121 ifneq (,$(COPYFILES))
127 # Validating an sgml document can be achieved with
128 check: $(MAIN_SGML) $(OTHER_SGML) $(GIFS) $(EPS)
129 nsgmls -vs $(CATALOG_OPT) $<
131 # Generating HTML from the SGML. In practice multiple .html files may
132 # be generated, but for the purposes of dependency analysis the others
134 html: copyfiles $(MAIN_HTML)
136 $(MAIN_HTML): $(MAIN_SGML) $(OTHER_SGML) $(PNGS) $(HTML_STYLESHEET) $(FIXHTML)
137 jade -t sgml -i html $(DSSSL_CATALOG_OPT) -d $(HTML_STYLESHEET)#html $<
140 # PDF files can be generated in a similar fashion.
141 pdfa4: copyfiles $(MAIN_PDFA4)
143 $(MAIN_PDFA4): $(MAIN_SGML) $(OTHER_SGML) $(PNGS) $(A4_STYLESHEET)
144 jade -o $(subst .pdf,.tex,$(MAIN_PDFA4)) -t tex -V tex-backend $(DSSSL_CATALOG_OPT) -d $(A4_STYLESHEET)#print $<
145 pdfjadetex $(subst .pdf,.tex,$(MAIN_PDFA4))
146 pdfjadetex $(subst .pdf,.tex,$(MAIN_PDFA4))
147 pdfjadetex $(subst .pdf,.tex,$(MAIN_PDFA4))
149 pdfletter: copyfiles $(MAIN_PDFLETTER)
151 $(MAIN_PDFLETTER): $(MAIN_SGML) $(OTHER_SGML) $(PNGS) $(LETTER_STYLESHEET)
152 jade -o $(subst .pdf,.tex,$(MAIN_PDFLETTER)) -t tex -V tex-backend $(DSSSL_CATALOG_OPT) -d $(LETTER_STYLESHEET)#print $<
153 pdfjadetex $(subst .pdf,.tex,$(MAIN_PDFLETTER))
154 pdfjadetex $(subst .pdf,.tex,$(MAIN_PDFLETTER))
155 pdfjadetex $(subst .pdf,.tex,$(MAIN_PDFLETTER))
157 #$(MAIN_PDF): $(MAIN_SGML) $(OTHER_SGML) $(EPS) $(ECOS_STYLESHEET)
158 # jade -o $(subst .sgml,.tex,$(MAIN_SGML)) -t tex -V tex-backend -d $(ECOS_STYLESHEET)#print $<
159 # jadetex $(subst .sgml,.tex,$(MAIN_SGML))
160 # jadetex $(subst .sgml,.tex,$(MAIN_SGML))
161 # jadetex $(subst .sgml,.tex,$(MAIN_SGML))
162 # dvips -o $(subst .sgml,.ps,$(MAIN_SGML)) $(subst .sgml,.dvi,$(MAIN_SGML))
163 # ps2pdf $(subst .sgml,.ps,$(MAIN_SGML)) $(subst .sgml,.pdf,$(MAIN_SGML))
165 # Clean. For now assume that all .html, .gif etc files are generated
167 rm -rf *.html *.tex *.dvi *.aux *.log *.out *.ps *.pdf *.gif *.eps *.png