summaryrefslogtreecommitdiff
path: root/rules/docbook.mk
blob: 75a69076ce88d59087fb65059244cf3086e0e938 (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
# -----------------------------------------------------------------------------
#
# (c) 2009 The University of Glasgow
#
# This file is part of the GHC build system.
#
# To understand how the build system works and how to modify it, see
#      http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
#      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
#
# -----------------------------------------------------------------------------


# Build docbook docs

define docbook
# $1 = dir
# $2 = docname

$(call clean-target,$1,docbook,$1/$2 $1/$2.pdf $1/$2.ps)

# empty "all_$1" target just in case we're not building docs at all
$(call all-target,$1,)

ifeq "$$(BUILD_DOCBOOK_HTML)" "YES"
$(call all-target,$1,html_$1)

.PHONY: html_$1
html_$1 : $1/$2/index.html

$1/$2/index.html: $$($1_DOCBOOK_SOURCES)
	$$(RM) -r $$(dir $$@)
	$$(XSLTPROC) --stringparam base.dir $$(dir $$@) \
	             --stringparam use.id.as.filename 1 \
	             --stringparam html.stylesheet fptools.css \
	             $$(XSLTPROC_LABEL_OPTS) $$(XSLTPROC_OPTS) \
	             $$(DIR_DOCBOOK_XSL)/html/chunk.xsl $1/$2.xml
	cp mk/fptools.css $$(dir $$@)
endif

ifeq "$$(BUILD_DOCBOOK_PS)" "YES"
$(call all-target,$1,ps_$1)

.PHONY: ps_$1
ps_$1 : $1/$2.ps

$1/$2.ps: $$($1_DOCBOOK_SOURCES)
	$$(DBLATEX) $$(DBLATEX_OPTS) $1/$2.xml --ps -o $$@
endif

ifeq "$$(BUILD_DOCBOOK_PDF)" "YES"
$(call all-target,$1,pdf_$1)

.PHONY: pdf_$1
pdf_$1 : $1/$2.pdf

$1/$2.pdf: $$($1_DOCBOOK_SOURCES)
	$$(DBLATEX) $$(DBLATEX_OPTS) $1/$2.xml --pdf -o $$@
endif

endef