summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2015-10-01 01:08:41 +0200
committerBen Gamari <ben@smart-cactus.org>2015-10-03 09:44:48 +0200
commit4fd6207ec6960c429e6a1bcbe0282f625010f52a (patch)
tree26e1f43199fbde80f26225f7409b5c00ce8792a9 /rules
parent9ed700bb4128b1cbf59d99d725c44d7a0bfb1de6 (diff)
downloadhaskell-4fd6207ec6960c429e6a1bcbe0282f625010f52a.tar.gz
Move user's guide to ReStructuredText
Diffstat (limited to 'rules')
-rw-r--r--rules/docbook.mk86
-rw-r--r--rules/sphinx.mk65
2 files changed, 65 insertions, 86 deletions
diff --git a/rules/docbook.mk b/rules/docbook.mk
deleted file mode 100644
index c7c7991cb7..0000000000
--- a/rules/docbook.mk
+++ /dev/null
@@ -1,86 +0,0 @@
-# -----------------------------------------------------------------------------
-#
-# (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://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
-# http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
-#
-# -----------------------------------------------------------------------------
-
-
-# Build docbook docs
-
-define docbook
-$(call trace, docbook($1,$2))
-$(call profStart, docbook($1,$2))
-# $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,)
-
-.PHONY: html_$1
-
-ifeq "$$(phase)" "final"
-ifeq "$$(BUILD_DOCBOOK_HTML)" "YES"
-$(call all-target,$1,html_$1)
-INSTALL_HTML_DOC_DIRS += $1/$2
-endif
-endif
-
-html_$1 : $1/$2/index.html
-
-ifneq "$$(BINDIST)" "YES"
-$1/$2/index.html: $$($1_DOCBOOK_SOURCES)
- $$(call removeTrees,$$(dir $$@))
- "$$(XSLTPROC)" --stringparam base.dir $$(dir $$@) \
- --stringparam use.id.as.filename 1 \
- --stringparam html.stylesheet fptools.css \
- --nonet \
- $$(XSLTPROC_LABEL_OPTS) $$(XSLTPROC_OPTS) \
- $$(XSLTPROC_HTML_STYLESHEET) \
- $1/$2.xml
- cp mk/fptools.css $$(dir $$@)
-endif
-
-
-.PHONY: ps_$1
-ifeq "$$(phase)" "final"
-ifeq "$$(BUILD_DOCBOOK_PS)" "YES"
-$(call all-target,$1,ps_$1)
-INSTALL_DOCS += $1/$2.ps
-endif
-endif
-
-ps_$1 : $1/$2.ps
-
-ifneq "$$(BINDIST)" "YES"
-$1/$2.ps: $$($1_DOCBOOK_SOURCES)
- "$$(DBLATEX)" $$(DBLATEX_OPTS) $1/$2.xml --ps -o $$@
- [ -f $$@ ]
-endif
-
-ifeq "$$(phase)" "final"
-ifeq "$$(BUILD_DOCBOOK_PDF)" "YES"
-$(call all-target,$1,pdf_$1)
-INSTALL_DOCS += $1/$2.pdf
-endif
-endif
-
-.PHONY: pdf_$1
-pdf_$1 : $1/$2.pdf
-
-ifneq "$$(BINDIST)" "YES"
-$1/$2.pdf: $$($1_DOCBOOK_SOURCES)
- "$$(DBLATEX)" $$(DBLATEX_OPTS) $1/$2.xml --pdf -o $$@
- [ -f $$@ ]
-endif
-
-$(call profEnd, docbook($1,$2))
-endef
-
diff --git a/rules/sphinx.mk b/rules/sphinx.mk
new file mode 100644
index 0000000000..87b57d6e07
--- /dev/null
+++ b/rules/sphinx.mk
@@ -0,0 +1,65 @@
+# -----------------------------------------------------------------------------
+#
+# (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://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
+# http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
+#
+# -----------------------------------------------------------------------------
+
+
+# Build Sphinx documentation
+
+define sphinx
+$(call trace, sphinx($1,$2))
+$(call profStart, sphinx($1,$2))
+# $1 = dir
+# $2 = docname
+
+$(call clean-target,$1,sphinx,$1/.doctrees $1/build-html/ $1/build-pdf $1/$2.pdf)
+
+# empty "all_$1" target just in case we're not building docs at all
+$(call all-target,$1,)
+
+.PHONY: html_$1
+ifeq "$$(phase)" "final"
+ifeq "$$(BUILD_SPHINX_HTML)" "YES"
+$(call all-target,$1,html_$1)
+INSTALL_HTML_DOC_DIRS += $1/build-html/$2 $1/build-html/$2/_static $1/build-html/$2/_sources
+endif
+endif
+
+html_$1 : $1/build-html/$2/index.html
+html : html_$1
+
+ifneq "$$(BINDIST)" "YES"
+$1/build-html/$2/index.html: $1/conf.py $$($1_RST_SOURCES)
+ $(SPHINXBUILD) -b html -d $1/.doctrees $(SPHINXOPTS) $1 $1/build-html/$2
+endif
+
+
+.PHONY: pdf_$1
+ifeq "$$(phase)" "final"
+ifeq "$$(BUILD_SPHINX_PDF)" "YES"
+$(call all-target,$1,pdf_$1)
+INSTALL_DOCS += $1/$2.pdf
+endif
+endif
+
+pdf_$1 : $1/$2.pdf
+pdf : pdf_$1
+
+ifneq "$$(BINDIST)" "YES"
+$1/$2.pdf: $$($1_RST_SOURCES)
+ $(SPHINXBUILD) -b latex -d $1/.doctrees $(SPHINXOPTS) $1 $1/build-pdf/$2
+ cd $1/build-pdf/$2 ; xelatex $2.tex
+ cd $1/build-pdf/$2 ; xelatex $2.tex
+ cp $1/build-pdf/$2/$2.pdf $1/$2.pdf
+endif
+
+
+$(call profEnd, sphinx($1,$2))
+endef