summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-06-27 16:32:25 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-07-04 17:56:30 -0400
commit74f3867dbc77cad216444ed1e12d095feb1ced92 (patch)
treee8fa55339f1f1535920644b5794e94fb41230a92 /hadrian
parentaba482ea941bb0b06f041be950712ed71e047e81 (diff)
downloadhaskell-74f3867dbc77cad216444ed1e12d095feb1ced92.tar.gz
Add docs:<pkg> command to hadrian to build docs for just one package
Diffstat (limited to 'hadrian')
-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 6db6073551..1a3335d535 100644
--- a/hadrian/README.md
+++ b/hadrian/README.md
@@ -268,6 +268,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