docbook.mk 1.83 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
	"$$(RM)" $$(RM_OPTS) -r $$(dir $$@)
	"$$(XSLTPROC)" --stringparam base.dir $$(dir $$@) \
	               --stringparam use.id.as.filename 1 \
	               --stringparam html.stylesheet fptools.css \
37
		       --nonet \
38
	               $$(XSLTPROC_LABEL_OPTS) $$(XSLTPROC_OPTS) \
39 40
		       $$(XSLTPROC_HTML_STYLESHEET) \
	               $1/$2.xml
Ian Lynagh's avatar
Ian Lynagh committed
41
	cp mk/fptools.css $$(dir $$@)
42 43 44 45
else
html_$1 :
	@echo "*** HTML documentation is disabled; BUILD_DOCBOOK_HTML = NO"
	@exit 1
Ian Lynagh's avatar
Ian Lynagh committed
46 47
endif

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

ps_$1 : $1/$2.ps
53 54

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

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

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

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

Ian Lynagh's avatar
Ian Lynagh committed
76 77
endef