Commit 8bac0130 authored by Simon Marlow's avatar Simon Marlow

Add source code links to Haddock docs

Right now we can only manage to add a source code link for the module,
but that's better than nothing.

I had to put the list of core packages in a Makefile variable,
$(CorePackages), so we'll have to be careful to keep this up to date.
(I could have slurped it out of libraries/core-packages with $(shell),
but that's ugly and really slow on Windows).

There are a couple of new tweakables: CorePackageSourceURL and
ExtraPackageSourceURL in config.mk.in, set these to the appropriate
patterns for generating source links.

(when we merge this patch onto the HEAD we'll have to tweak these
settings).

Unfortunately it still doesn't work for all the modules, because
modules compiled without -cpp don't get any #line directives.  More
hackery required...
parent 1a0edd6c
......@@ -355,6 +355,15 @@ DLLized=@EnableWin32DLLs@
#
StripLibraries=NO
# These are the URL patterns that Haddock uses to generate the "Source
# File" links on each page.
CorePackageSourceURL = http://darcs.haskell.org/ghc-6.6/packages/$(PACKAGE)/%{FILE}
ExtraPackageSourceURL = http://darcs.haskell.org/packages/$(PACKAGE)/%{FILE}
# These are the packages required to be present in order to bootstrap GHC
# NB. must be synced with libraries/core-packages
CorePackages = base Cabal haskell98 readline regex-base regex-compat \
regex-posix parsec stm template-haskell unix Win32
# ----------------------------------------------------------------------------
# Object-file splitting
......
......@@ -375,12 +375,19 @@ html :: $(HTML_DOC)
extraclean ::
$(RM) -rf $(HTML_DIR)
ifneq "$(findstring $(PACKAGE), $(CorePackages))" ""
HaddockSourceURL = $(CorePackageSourceURL)
else
HaddockSourceURL = $(ExtraPackageSourceURL)
endif
$(HTML_DOC) : $(HS_PPS)
@$(INSTALL_DIR) $(HTML_DIR)
$(HADDOCK) $(HADDOCK_OPTS) -h -o $(HTML_DIR) $(HS_PPS) \
--package=$(PACKAGE) \
--dump-interface=$(PACKAGE).haddock \
--use-index=../doc-index.html --use-contents=../index.html \
--source-module=$(HaddockSourceURL) \
$(foreach pkg, $(PACKAGE_DEPS), \
--read-interface=../$(pkg),../$(pkg)/$(pkg).haddock)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment