Handle deciding what docs to build better
[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/$2/index.html)
24
25 $1/$2/index.html: $$($1_DOCBOOK_SOURCES)
26         $$(RM) -r $$(dir $$@)
27         $$(XSLTPROC) --stringparam base.dir $$(dir $$@) \
28                      --stringparam use.id.as.filename 1 \
29                      --stringparam html.stylesheet fptools.css \
30                      $$(XSLTPROC_LABEL_OPTS) $$(XSLTPROC_OPTS) \
31                      $$(DIR_DOCBOOK_XSL)/html/chunk.xsl $1/$2.xml
32         cp mk/fptools.css $$(dir $$@)
33 endif
34
35 ifeq "$$(BUILD_DOCBOOK_PS)" "YES"
36 $(call all-target,$1_ps,$1/$2.ps)
37
38 $1/$2.ps: $$($1_DOCBOOK_SOURCES)
39         $$(DBLATEX) $$(DBLATEX_OPTS) $1/$2.xml --ps -o $$@
40 endif
41
42 ifeq "$$(BUILD_DOCBOOK_PDF)" "YES"
43 $(call all-target,$1_pdf,$1/$2.pdf)
44
45 $1/$2.pdf: $$($1_DOCBOOK_SOURCES)
46         $$(DBLATEX) $$(DBLATEX_OPTS) $1/$2.xml --pdf -o $$@
47 endif
48
49 endef
50