Fix build on cygwin: Normalise slashes in .depend files to be /
[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 # empty "all_$1" target just in case we're not building docs at all
23 $(call all-target,$1,)
24
25 .PHONY: html_$1
26
27 ifeq "$$(BUILD_DOCBOOK_HTML)" "YES"
28 $(call all-target,$1,html_$1)
29 INSTALL_HTML_DOC_DIRS += $1/$2
30 endif
31
32 html_$1 : $1/$2/index.html
33
34 ifneq "$$(BINDIST)" "YES"
35 $1/$2/index.html: $$($1_DOCBOOK_SOURCES)
36         "$$(RM)" $$(RM_OPTS_REC) $$(dir $$@)
37         "$$(XSLTPROC)" --stringparam base.dir $$(dir $$@) \
38                        --stringparam use.id.as.filename 1 \
39                        --stringparam html.stylesheet fptools.css \
40                        --nonet \
41                        $$(XSLTPROC_LABEL_OPTS) $$(XSLTPROC_OPTS) \
42                        $$(XSLTPROC_HTML_STYLESHEET) \
43                        $1/$2.xml
44         cp mk/fptools.css $$(dir $$@)
45 endif
46
47
48 .PHONY: ps_$1
49 ifeq "$$(BUILD_DOCBOOK_PS)" "YES"
50 $(call all-target,$1,ps_$1)
51 INSTALL_DOCS += $1/$2.ps
52 endif
53
54 ps_$1 : $1/$2.ps
55
56 ifneq "$$(BINDIST)" "YES"
57 $1/$2.ps: $$($1_DOCBOOK_SOURCES)
58         "$$(DBLATEX)" $$(DBLATEX_OPTS) $1/$2.xml --ps -o $$@
59         [ -f $$@ ]
60 endif
61
62 ifeq "$$(BUILD_DOCBOOK_PDF)" "YES"
63 $(call all-target,$1,pdf_$1)
64 INSTALL_DOCS += $1/$2.pdf
65 endif
66
67 .PHONY: pdf_$1
68 pdf_$1 : $1/$2.pdf
69
70 ifneq "$$(BINDIST)" "YES"
71 $1/$2.pdf: $$($1_DOCBOOK_SOURCES)
72         "$$(DBLATEX)" $$(DBLATEX_OPTS) $1/$2.xml --pdf -o $$@
73         [ -f $$@ ]
74 endif
75
76 endef
77