summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hadrian/README.md3
-rw-r--r--hadrian/src/Rules/SimpleTargets.hs5
2 files changed, 8 insertions, 0 deletions
diff --git a/hadrian/README.md b/hadrian/README.md
index a815039e7f..5378ee973b 100644
--- a/hadrian/README.md
+++ b/hadrian/README.md
@@ -256,6 +256,9 @@ To build all GHC documentation, run `build docs`. This includes
In order to only build haddock document there is the `build docs-haddock` target.
+In order to build the haddock documentation for just one package use the `docs:<pkg>` command,
+for example `docs:base` will just build the documentation for `base`.
+
Alternatively,
you can use the `--docs` CLI flag to selectively disable some or
all of the documentation targets:
diff --git a/hadrian/src/Rules/SimpleTargets.hs b/hadrian/src/Rules/SimpleTargets.hs
index f89575fccb..4e461dc946 100644
--- a/hadrian/src/Rules/SimpleTargets.hs
+++ b/hadrian/src/Rules/SimpleTargets.hs
@@ -39,6 +39,11 @@ simpleTarget (stage, target) = do
if target == Packages.ghc
then need [ root -/- ("ghc-" <> stagestr) ]
else pure ()
+ when (stage == Stage1 && isLibrary target && target /= rts) $ do
+ let doc_tgt = intercalate ":" ["docs", pkgname]
+ doc_tgt ~> do
+ need . (:[]) =<< (pkgHaddockFile $ vanillaContext Stage1 target)
+
where typ = if isLibrary target then "lib" else "exe"
stagestr = stageString stage