Make ghc -dynamic imply -fPIC for C code
[ghc-hetmet.git] / rules / docbook.mk
index 2f86363..ce014c8 100644 (file)
@@ -1,3 +1,15 @@
+# -----------------------------------------------------------------------------
+#
+# (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
 
@@ -5,10 +17,13 @@ define docbook
 # $1 = dir
 # $2 = docname
 
-$(call clean-target,$1,docbook,$1/$2)
+$(call clean-target,$1,docbook,$1/$2 $1/$2.pdf $1/$2.ps)
+
+ifeq "$$(BUILD_DOCBOOK_HTML)" "YES"
+$(call all-target,$1,html_$1)
 
-ifneq "$$(XSLTPROC)" ""
-$(call all-target,$1,$1/$2/index.html)
+.PHONY: html_$1
+html_$1 : $1/$2/index.html
 
 $1/$2/index.html: $$($1_DOCBOOK_SOURCES)
        $$(RM) -r $$(dir $$@)
@@ -20,5 +35,25 @@ $1/$2/index.html: $$($1_DOCBOOK_SOURCES)
        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