summaryrefslogtreecommitdiff
path: root/ecos/packages/pkgconf/rules.doc
blob: 85e77119106c2b514c2a0a284a2ea7b514df0aa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#=============================================================================
#
#    rules.doc
#
#    Additional rules for processing documentation written in DocBook/SGML
#
#=============================================================================
## ####ECOSGPLCOPYRIGHTBEGIN####                                            
## -------------------------------------------                              
## This file is part of eCos, the Embedded Configurable Operating System.   
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under    
## the terms of the GNU General Public License as published by the Free     
## Software Foundation; either version 2 or (at your option) any later      
## version.                                                                 
##
## eCos is distributed in the hope that it will be useful, but WITHOUT      
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
## for more details.                                                        
##
## You should have received a copy of the GNU General Public License        
## along with eCos; if not, write to the Free Software Foundation, Inc.,    
## 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
##
## As a special exception, if other files instantiate templates or use      
## macros or inline functions from this file, or you compile this file      
## and link it with other works to produce a work based on this file,       
## this file does not by itself cause the resulting work to be covered by   
## the GNU General Public License. However the source code for this file    
## must still be made available in accordance with section (3) of the GNU   
## General Public License v2.                                               
##
## This exception does not invalidate any other reasons why a work based    
## on this file might be covered by the GNU General Public License.         
## -------------------------------------------                              
## ####ECOSGPLCOPYRIGHTEND####                                              
#=============================================================================
#####DESCRIPTIONBEGIN####
#
# Author(s):     bartv
# Date:          2001-01-11
# Purpose:       Rules for processing documentation
# Description:
#     Each package's doc directory's makefile should define the
#     following variables:
#       TOPLEVEL   - of the component repository
#       MAIN_SGML  - documentation entry point
#       OTHER_SGML - any other .sgml files accessed from main
#       PICTURES   - referenced by the SGML files
#####DESCRIPTIONEND####
#=============================================================================

.PHONY: default check html pdf clean copyfiles

# Locations of the stylesheets and other SGML support files. These
# have moved around in various releases of the tools.
ifneq (,$(wildcard /usr/share/sgml/docbook))
  CATALOG	:= /etc/sgml/catalog
  ifneq (,$(wildcard /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/catalog))
    DSSSL_CATALOG  := /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/catalog
  else
    DSSSL_CATALOG := $(firstword $(wildcard /usr/share/sgml/docbook/dsssl-stylesheets-*/catalog))
  endif
else
  ifneq (,$(wildcard /usr/lib/sgml/stylesheets/nwalsh-modular/catalog))
    CATALOG          := /usr/lib/sgml/CATALOG
    DSSSL_CATALOG    := /usr/lib/sgml/stylesheets/nwalsh-modular/catalog
  else
    ifneq (,$(wildcard /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/sgml.catalog))
      CATALOG        := /usr/lib/sgml/catalog
      DSSSL_CATALOG  := /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/sgml.catalog
    endif
  endif
endif

A4_STYLESHEET  := $(TOPLEVEL)/pkgconf/ssa4.dsl
LETTER_STYLESHEET  := $(TOPLEVEL)/pkgconf/ssletter.dsl
HTML_STYLESHEET  := $(TOPLEVEL)/pkgconf/stylesheet.dsl
FIXHTML          := $(TOPLEVEL)/pkgconf/fixhtml.tcl

ifneq (,$(CATALOG))
 CATALOG_OPT := -c $(CATALOG)
endif

ifneq (,$(DSSL_CATALOG))
 DSSL_CATALOG_OPT := -c $(DSSL_CATALOG)
endif

# The files that will be generated:
ifeq (,$(MAIN_HTML))
 MAIN_HTML        := $(subst .sgml,.html,$(MAIN_SGML))
endif
ifeq (,$(MAIN_PDF))
 MAIN_PDF         := $(subst .sgml,.pdf,$(MAIN_SGML))
endif

MAIN_PDFA4        := $(subst .pdf,-a4.pdf,$(MAIN_PDF))
MAIN_PDFLETTER    := $(subst .pdf,-letter.pdf,$(MAIN_PDF))

# Rules for generating pictures
GIFS := $(foreach x,$(PICTURES),$(x).gif)
EPS  := $(foreach x,$(PICTURES),$(x).eps)
PNGS :=$(foreach x,$(PICTURES),$(x).png)

%.gif: %.fig
	convert -crop 0x0 $< $@

%.png: %.fig
	fig2dev -L png $< $@

%.eps: %.fig
	convert -crop 0x0 $< $@

# This is a little grotty. In some cases we want to just copy files from
# their source location to the destination's current dir and nothing
# more.
copyfiles:
ifneq (,$(COPYFILES))
	cp $(COPYFILES) .
endif

default: check

# Validating an sgml document can be achieved with
check: $(MAIN_SGML) $(OTHER_SGML) $(GIFS) $(EPS)
	nsgmls -vs $(CATALOG_OPT) $<

# Generating HTML from the SGML. In practice multiple .html files may
# be generated, but for the purposes of dependency analysis the others
# can be ignored.
html: copyfiles $(MAIN_HTML)

$(MAIN_HTML): $(MAIN_SGML) $(OTHER_SGML) $(PNGS) $(HTML_STYLESHEET) $(FIXHTML)
	jade -t sgml -i html $(DSSSL_CATALOG_OPT) -d $(HTML_STYLESHEET)#html $<
	tclsh $(FIXHTML)

# PDF files can be generated in a similar fashion.
pdfa4: copyfiles $(MAIN_PDFA4)

$(MAIN_PDFA4):  $(MAIN_SGML) $(OTHER_SGML) $(PNGS) $(A4_STYLESHEET)
	jade -o $(subst .pdf,.tex,$(MAIN_PDFA4)) -t tex -V tex-backend $(DSSSL_CATALOG_OPT) -d $(A4_STYLESHEET)#print $<
	pdfjadetex $(subst .pdf,.tex,$(MAIN_PDFA4))
	pdfjadetex $(subst .pdf,.tex,$(MAIN_PDFA4))
	pdfjadetex $(subst .pdf,.tex,$(MAIN_PDFA4))

pdfletter: copyfiles $(MAIN_PDFLETTER)

$(MAIN_PDFLETTER):  $(MAIN_SGML) $(OTHER_SGML) $(PNGS) $(LETTER_STYLESHEET)
	jade -o $(subst .pdf,.tex,$(MAIN_PDFLETTER)) -t tex -V tex-backend $(DSSSL_CATALOG_OPT) -d $(LETTER_STYLESHEET)#print $<
	pdfjadetex $(subst .pdf,.tex,$(MAIN_PDFLETTER))
	pdfjadetex $(subst .pdf,.tex,$(MAIN_PDFLETTER))
	pdfjadetex $(subst .pdf,.tex,$(MAIN_PDFLETTER))

#$(MAIN_PDF):  $(MAIN_SGML) $(OTHER_SGML) $(EPS) $(ECOS_STYLESHEET)
#	jade -o $(subst .sgml,.tex,$(MAIN_SGML)) -t tex -V tex-backend -d $(ECOS_STYLESHEET)#print $<
#	jadetex $(subst .sgml,.tex,$(MAIN_SGML))
#	jadetex $(subst .sgml,.tex,$(MAIN_SGML))
#	jadetex $(subst .sgml,.tex,$(MAIN_SGML))
#	dvips -o $(subst .sgml,.ps,$(MAIN_SGML)) $(subst .sgml,.dvi,$(MAIN_SGML))
#	ps2pdf $(subst .sgml,.ps,$(MAIN_SGML)) $(subst .sgml,.pdf,$(MAIN_SGML))

# Clean. For now assume that all .html, .gif etc files are generated
clean:
	rm -rf *.html *.tex *.dvi *.aux *.log *.out *.ps *.pdf *.gif *.eps *.png