diff options
author | Simon Marlow <marlowsd@gmail.com> | 2010-01-12 22:55:48 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2010-01-12 22:55:48 +0000 |
commit | a4bef988fe1fcc2f6e59d9f8ccb54bcbc893958e (patch) | |
tree | dcadfb4255dbc9c549f9b419aa14c6813e086b6c /rules/haddock.mk | |
parent | a21998556af1e827b9462d2cdc46005e90fb7fd2 (diff) | |
download | haskell-a4bef988fe1fcc2f6e59d9f8ccb54bcbc893958e.tar.gz |
Invoke Haddock directly from the build system, instead of via Cabal
Partly this is cleaner as we only have to preprocess the source files
once, but also it is necessary to avoid Haddock recompiling source
files when Template Haskell is in use, saving some time in validate
and fixing a problem whereby when HADDOCK_DOCS=YES, make always
re-haddocks the DPH packages. This also needs an additional fix to
GHC.
HsColour support still uses Cabal, and hence preprocesses the source
files again. We could move this into the build system too, but there
is a version dependency that would mean adding extra autoconf stuff.
Diffstat (limited to 'rules/haddock.mk')
-rw-r--r-- | rules/haddock.mk | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/rules/haddock.mk b/rules/haddock.mk index 98838c969b..f0d0aff7aa 100644 --- a/rules/haddock.mk +++ b/rules/haddock.mk @@ -15,31 +15,42 @@ define haddock # args: $1 = dir, $2 = distdir ifneq "$$($1_$2_DO_HADDOCK)" "NO" -ifeq "$$($$($1_PACKAGE)_HADDOCK_FILE)" "" -$$($1_PACKAGE)_HADDOCK_FILE = $1/$2/doc/html/$$($1_PACKAGE)/$$($1_PACKAGE).haddock -ALL_HADDOCK_FILES += $$($$($1_PACKAGE)_HADDOCK_FILE) +ifeq "$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE)" "" +$$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE = $1/$2/doc/html/$$($1_PACKAGE)/$$($1_PACKAGE).haddock +ALL_HADDOCK_FILES += $$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) else $$(error Already got a haddock file for $$($1_PACKAGE)) endif -haddock: $$($$($1_PACKAGE)_HADDOCK_FILE) +haddock: $$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) ifeq "$$(HADDOCK_DOCS)" "YES" $(call all-target,$1_$2_haddock,html_$1) endif .PHONY: html_$1 -html_$1 : $$($$($1_PACKAGE)_HADDOCK_FILE) +html_$1 : $$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) -$$($1_PACKAGE)_HADDOCK_DEPS = $$(foreach n,$$($1_$2_DEP_NAMES),$$($$n_HADDOCK_FILE)) +$$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_DEPS = $$(foreach n,$$($1_$2_DEPS),$$($$n_HADDOCK_FILE)) ifeq "$$(HSCOLOUR_SRCS)" "YES" -$1_$2_HADDOCK_FLAGS += --hyperlink-source +$1_$2_HADDOCK_FLAGS += --source-module=src/%{MODULE/./-}.html --source-entity=src/%{MODULE/./-}.html#%{NAME} endif ifneq "$$(BINDIST)" "YES" -$$($$($1_PACKAGE)_HADDOCK_FILE) : $$(INPLACE_BIN)/haddock$$(exeext) $$(GHC_CABAL_INPLACE) $$($1_$2_HS_SRCS) $$($$($1_PACKAGE)_HADDOCK_DEPS) | $$$$(dir $$$$@)/. - "$$(GHC_CABAL_INPLACE)" haddock $2 $1 --with-haddock=$$(TOP)/$$(INPLACE_BIN)/haddock --with-ghc=$$(TOP)/$$(INPLACE_BIN)/ghc-stage2 $$($1_$2_HADDOCK_FLAGS) $$($1_$2_HADDOCK_OPTS) +$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) : $$(INPLACE_BIN)/haddock$$(exeext) $$(GHC_CABAL_INPLACE) $$($1_$2_HS_SRCS) $$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_DEPS) | $$$$(dir $$$$@)/. + "$$(GHC_CABAL_INPLACE)" hscolour $2 $1 + "$$(TOP)/$$(INPLACE_BIN)/haddock" \ + --odir="$1/$2/doc/html/$$($1_PACKAGE)" \ + --dump-interface=$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) \ + --html \ + --title="$$($1_PACKAGE)-$$($1_$2_VERSION)$$(if $$(strip $$($1_$2_SYNOPSIS)),: $$(strip $$($1_$2_SYNOPSIS)),)" \ + --prologue="$1/$2/haddock-prologue.txt" \ + $$(foreach pkg,$$($1_$2_DEPS),$$(if $$($$(pkg)_HADDOCK_FILE),--read-interface=../$$(pkg)$$(comma)$$($$(pkg)_HADDOCK_FILE))) \ + $$(foreach opt,$$($1_$2_v_ALL_HC_OPTS),--optghc=$$(opt)) \ + $$($1_$2_HADDOCK_FLAGS) $$($1_$2_HADDOCK_OPTS) \ + $$($1_$2_HS_SRCS) \ + $$($1_$2_EXTRA_HADDOCK_SRCS) # Make the haddocking depend on the library .a file, to ensure # that we wait until the library is fully build before we haddock it |