Re-export Expression from Predicates
[ghc.git] / src / Settings / Builders / Haddock.hs
1 module Settings.Builders.Haddock (haddockBuilderArgs) where
2
3 import Base
4 import GHC
5 import Oracles.PackageData
6 import Package
7 import Predicates
8 import Settings
9 import Settings.Builders.Ghc
10
11 haddockBuilderArgs :: Args
12 haddockBuilderArgs = builder Haddock ? do
13 output <- getOutput
14 pkg <- getPackage
15 path <- getBuildPath
16 version <- getPkgData Version
17 synopsis <- getPkgData Synopsis
18 hidden <- getPkgDataList HiddenModules
19 deps <- getPkgDataList Deps
20 depNames <- getPkgDataList DepNames
21 hVersion <- lift . pkgData . Version $ buildPath (vanillaContext Stage2 haddock)
22 ghcOpts <- fromDiffExpr commonGhcArgs
23 mconcat
24 [ arg $ "--odir=" ++ takeDirectory output
25 , arg "--verbosity=0"
26 , arg "--no-tmp-comp-dir"
27 , arg $ "--dump-interface=" ++ output
28 , arg "--html"
29 , arg "--hoogle"
30 , arg $ "--title=" ++ pkgNameString pkg ++ "-" ++ version ++ ": " ++ synopsis
31 , arg $ "--prologue=" ++ path -/- "haddock-prologue.txt"
32 , arg $ "--optghc=-D__HADDOCK_VERSION__=" ++ show (versionToInt hVersion)
33 , append $ map ("--hide=" ++) hidden
34 , append $ [ "--read-interface=../" ++ dep
35 ++ ",../" ++ dep ++ "/src/%{MODULE/./-}.html\\#%{NAME},"
36 ++ pkgHaddockFile (vanillaContext Stage1 depPkg)
37 | (dep, depName) <- zip deps depNames
38 , Just depPkg <- [findKnownPackage $ PackageName depName]
39 , depPkg /= rts ]
40 , append [ "--optghc=" ++ opt | opt <- ghcOpts ]
41 , specified HsColour ?
42 arg "--source-module=src/%{MODULE/./-}.html"
43 , specified HsColour ?
44 arg "--source-entity=src/%{MODULE/./-}.html\\#%{NAME}"
45 , append =<< getInputs
46 , arg "+RTS"
47 , arg $ "-t" ++ path -/- "haddock.t"
48 , arg "--machine-readable"
49 , arg "-RTS" ]
50
51 -- From ghc.mk:
52 -- # -----------------------------------------------
53 -- # Haddock-related bits
54
55 -- # Build the Haddock contents and index
56 -- ifeq "$(HADDOCK_DOCS)" "YES"
57 -- libraries/dist-haddock/index.html: $(haddock_INPLACE) $(ALL_HADDOCK_FILES)
58 -- cd libraries && sh gen_contents_index --intree
59 -- ifeq "$(phase)" "final"
60 -- $(eval $(call all-target,library_doc_index,libraries/dist-haddock/index.html))
61 -- endif
62 -- INSTALL_LIBRARY_DOCS += libraries/dist-haddock/*
63 -- endif