[commit: ghc] master: rules/haddock: Set __HADDOCK_VERSION__ (8755719)

git at git.haskell.org git at git.haskell.org
Thu Nov 12 14:54:53 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8755719462733dee52190e298436e8e8e8f12bea/ghc

>---------------------------------------------------------------

commit 8755719462733dee52190e298436e8e8e8f12bea
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Thu Nov 12 11:15:34 2015 +0100

    rules/haddock: Set __HADDOCK_VERSION__
    
    Test Plan: Validate
    
    Reviewers: austin, thomie
    
    Reviewed By: thomie
    
    Subscribers: kgardas, thomie
    
    Differential Revision: https://phabricator.haskell.org/D1467


>---------------------------------------------------------------

8755719462733dee52190e298436e8e8e8f12bea
 rules/haddock.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/rules/haddock.mk b/rules/haddock.mk
index 988e254..499adad 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)) \



More information about the ghc-commits mailing list