From 8bac0130e76221e5b20481d9e63b705d8c29b0de Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Fri, 8 Sep 2006 11:27:25 +0000 Subject: [PATCH] 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... --- mk/config.mk.in | 9 +++++++++ mk/package.mk | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/mk/config.mk.in b/mk/config.mk.in index 806908b..be48d99 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -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 diff --git a/mk/package.mk b/mk/package.mk index ce90aec..22bfdd0 100644 --- a/mk/package.mk +++ b/mk/package.mk @@ -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) -- 1.7.10.4