Fix installation of ghc-split (#8760)
[ghc.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://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
9 # http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
10 #
11 # -----------------------------------------------------------------------------
12
13
14 # Build docbook docs
15
16 define docbook
17 $(call trace, docbook($1,$2))
18 $(call profStart, docbook($1,$2))
19 # $1 = dir
20 # $2 = docname
21
22 $(call clean-target,$1,docbook,$1/$2 $1/$2.pdf $1/$2.ps)
23
24 # empty "all_$1" target just in case we're not building docs at all
25 $(call all-target,$1,)
26
27 .PHONY: html_$1
28
29 ifeq "$$(phase)" "final"
30 ifeq "$$(BUILD_DOCBOOK_HTML)" "YES"
31 $(call all-target,$1,html_$1)
32 INSTALL_HTML_DOC_DIRS += $1/$2
33 endif
34 endif
35
36 html_$1 : $1/$2/index.html
37
38 ifneq "$$(BINDIST)" "YES"
39 $1/$2/index.html: $$($1_DOCBOOK_SOURCES)
40 $$(call removeTrees,$$(dir $$@))
41 "$$(XSLTPROC)" --stringparam base.dir $$(dir $$@) \
42 --stringparam use.id.as.filename 1 \
43 --stringparam html.stylesheet fptools.css \
44 --nonet \
45 $$(XSLTPROC_LABEL_OPTS) $$(XSLTPROC_OPTS) \
46 $$(XSLTPROC_HTML_STYLESHEET) \
47 $1/$2.xml
48 cp mk/fptools.css $$(dir $$@)
49 endif
50
51
52 .PHONY: ps_$1
53 ifeq "$$(phase)" "final"
54 ifeq "$$(BUILD_DOCBOOK_PS)" "YES"
55 $(call all-target,$1,ps_$1)
56 INSTALL_DOCS += $1/$2.ps
57 endif
58 endif
59
60 ps_$1 : $1/$2.ps
61
62 ifneq "$$(BINDIST)" "YES"
63 $1/$2.ps: $$($1_DOCBOOK_SOURCES)
64 "$$(DBLATEX)" $$(DBLATEX_OPTS) $1/$2.xml --ps -o $$@
65 [ -f $$@ ]
66 endif
67
68 ifeq "$$(phase)" "final"
69 ifeq "$$(BUILD_DOCBOOK_PDF)" "YES"
70 $(call all-target,$1,pdf_$1)
71 INSTALL_DOCS += $1/$2.pdf
72 endif
73 endif
74
75 .PHONY: pdf_$1
76 pdf_$1 : $1/$2.pdf
77
78 ifneq "$$(BINDIST)" "YES"
79 $1/$2.pdf: $$($1_DOCBOOK_SOURCES)
80 "$$(DBLATEX)" $$(DBLATEX_OPTS) $1/$2.xml --pdf -o $$@
81 [ -f $$@ ]
82 endif
83
84 $(call profEnd, docbook($1,$2))
85 endef
86