summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2015-11-12 11:15:34 +0100
committerBen Gamari <ben@smart-cactus.org>2015-11-12 11:15:35 +0100
commit8755719462733dee52190e298436e8e8e8f12bea (patch)
tree053c1eca8631c6bb04464448115eee5c4951f3ed /rules
parente090f1bc14b5bf1deeef1c753c1145c162c0d27f (diff)
downloadhaskell-8755719462733dee52190e298436e8e8e8f12bea.tar.gz
rules/haddock: Set __HADDOCK_VERSION__
Test Plan: Validate Reviewers: austin, thomie Reviewed By: thomie Subscribers: kgardas, thomie Differential Revision: https://phabricator.haskell.org/D1467
Diffstat (limited to 'rules')
-rw-r--r--rules/haddock.mk7
1 files changed, 7 insertions, 0 deletions
diff --git a/rules/haddock.mk b/rules/haddock.mk
index 988e25484b..499adad85b 100644
--- a/rules/haddock.mk
+++ b/rules/haddock.mk
@@ -10,6 +10,11 @@
#
# -----------------------------------------------------------------------------
+HADDOCK_VER := $(shell grep "^version:" utils/haddock/haddock.cabal | sed "s/^version: \+//")
+HADDOCK_MAJOR_VER := $(shell echo $(HADDOCK_VER) | sed 's/\([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1/')
+HADDOCK_MINOR_VER := $(shell echo $(HADDOCK_VER) | sed 's/\([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\2/')
+HADDOCK_PATCH_VER := $(shell echo $(HADDOCK_VER) | sed 's/\([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\3/')
+HADDOCK_VERSION_STRING := $(shell echo $$(($(HADDOCK_MAJOR_VER) * 1000 + $(HADDOCK_MINOR_VER) * 10 + $(HADDOCK_PATCH_VER))))
define haddock # args: $1 = dir, $2 = distdir
$(call trace, haddock($1,$2))
@@ -40,6 +45,7 @@ $1_$2_HADDOCK_FLAGS += --source-module=src/%{MODULE/./-}.html --source-entity=sr
endif
ifneq "$$(BINDIST)" "YES"
+
# We need the quadruple dollars for the dependencies, as it isn't
# guaranteed that we are processing the packages in dependency order,
# so we don't want to expand it yet.
@@ -56,6 +62,7 @@ endif
--hoogle \
--title="$$($1_PACKAGE)-$$($1_$2_VERSION)$$(if $$(strip $$($1_$2_SYNOPSIS)),: $$(strip $$($1_$2_SYNOPSIS)),)" \
--prologue="$1/$2/haddock-prologue.txt" \
+ --optghc="-D__HADDOCK_VERSION__=$$(HADDOCK_VERSION_STRING)" \
$$(foreach mod,$$($1_$2_HIDDEN_MODULES),--hide=$$(mod)) \
$$(foreach pkg,$$($1_$2_DEPS),$$(if $$($$(pkg)_HADDOCK_FILE),--read-interface=../$$(pkg)$$(comma)../$$(pkg)/src/%{MODULE/./-}.html\#%{NAME}$$(comma)$$($$(pkg)_HADDOCK_FILE))) \
$$(foreach opt,$$($1_$2_$$(HADDOCK_WAY)_ALL_HC_OPTS),--optghc=$$(opt)) \