make it so that 'make html', 'make pdf', and 'make ps' work for docs
[ghc-hetmet.git] / rules / docbook.mk
1 # -----------------------------------------------------------------------------
2 #
3 # (c) 2009 The University of Glasgow
4 #
5 # This file is part of the GHC build system.
6 #
7 # To understand how the build system works and how to modify it, see
8 #      http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
9 #      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
10 #
11 # -----------------------------------------------------------------------------
12
13
14 # Build docbook docs
15
16 define docbook
17 # $1 = dir
18 # $2 = docname
19
20 $(call clean-target,$1,docbook,$1/$2 $1/$2.pdf $1/$2.ps)
21
22 ifeq "$$(BUILD_DOCBOOK_HTML)" "YES"
23 $(call all-target,$1,html_$1)
24
25 .PHONY: html_$1
26 html_$1 : $1/$2/index.html
27
28 $1/$2/index.html: $$($1_DOCBOOK_SOURCES)
29         $$(RM) -r $$(dir $$@)
30         $$(XSLTPROC) --stringparam base.dir $$(dir $$@) \
31                      --stringparam use.id.as.filename 1 \
32                      --stringparam html.stylesheet fptools.css \
33                      $$(XSLTPROC_LABEL_OPTS) $$(XSLTPROC_OPTS) \
34                      $$(DIR_DOCBOOK_XSL)/html/chunk.xsl $1/$2.xml
35         cp mk/fptools.css $$(dir $$@)
36 endif
37
38 ifeq "$$(BUILD_DOCBOOK_PS)" "YES"
39 $(call all-target,$1,ps_$1)
40
41 .PHONY: ps_$1
42 ps_$1 : $1/$2.ps
43
44 $1/$2.ps: $$($1_DOCBOOK_SOURCES)
45         $$(DBLATEX) $$(DBLATEX_OPTS) $1/$2.xml --ps -o $$@
46 endif
47
48 ifeq "$$(BUILD_DOCBOOK_PDF)" "YES"
49 $(call all-target,$1,pdf_$1)
50
51 .PHONY: pdf_$1
52 pdf_$1 : $1/$2.pdf
53
54 $1/$2.pdf: $$($1_DOCBOOK_SOURCES)
55         $$(DBLATEX) $$(DBLATEX_OPTS) $1/$2.xml --pdf -o $$@
56 endif
57
58 endef
59