docbook.mk 1.81 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
# -----------------------------------------------------------------------------
#
# (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
#
# -----------------------------------------------------------------------------

Ian Lynagh's avatar
Ian Lynagh committed
13 14 15 16 17 18 19

# Build docbook docs

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

20
$(call clean-target,$1,docbook,$1/$2 $1/$2.pdf $1/$2.ps)
Ian Lynagh's avatar
Ian Lynagh committed
21

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

25 26
.PHONY: html_$1

27
ifeq "$$(BUILD_DOCBOOK_HTML)" "YES"
28 29 30
$(call all-target,$1,html_$1)

html_$1 : $1/$2/index.html
Ian Lynagh's avatar
Ian Lynagh committed
31 32

$1/$2/index.html: $$($1_DOCBOOK_SOURCES)
33 34 35 36 37 38
	"$$(RM)" $$(RM_OPTS) -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
Ian Lynagh's avatar
Ian Lynagh committed
39
	cp mk/fptools.css $$(dir $$@)
40 41 42 43
else
html_$1 :
	@echo "*** HTML documentation is disabled; BUILD_DOCBOOK_HTML = NO"
	@exit 1
Ian Lynagh's avatar
Ian Lynagh committed
44 45
endif

46
.PHONY: ps_$1
47
ifeq "$$(BUILD_DOCBOOK_PS)" "YES"
48 49 50
$(call all-target,$1,ps_$1)

ps_$1 : $1/$2.ps
51 52

$1/$2.ps: $$($1_DOCBOOK_SOURCES)
53
	"$$(DBLATEX)" $$(DBLATEX_OPTS) $1/$2.xml --ps -o $$@
54 55 56 57
else
ps_$1 :
	@echo "*** PS documentation is disabled; BUILD_DOCBOOK_PS = NO"
	@exit 1
58 59 60
endif

ifeq "$$(BUILD_DOCBOOK_PDF)" "YES"
61 62 63 64
$(call all-target,$1,pdf_$1)

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

$1/$2.pdf: $$($1_DOCBOOK_SOURCES)
67
	"$$(DBLATEX)" $$(DBLATEX_OPTS) $1/$2.xml --pdf -o $$@
68 69 70 71
else
pdf_$1 :
	@echo "*** PDF documentation is disabled; BUILD_DOCBOOK_PDF = NO"
	@exit 1
72 73
endif

Ian Lynagh's avatar
Ian Lynagh committed
74 75
endef