Skip to content
Snippets Groups Projects
Commit 2a093d82 authored by alistair@abayley.org's avatar alistair@abayley.org
Browse files

haddock: run unlit before cpp, like ghc does.

parent eccb210c
No related branches found
No related tags found
No related merge requests found
...@@ -274,15 +274,19 @@ haddock pkg_descr lbi suffixes flags = do ...@@ -274,15 +274,19 @@ haddock pkg_descr lbi suffixes flags = do
let targetDir = pref </> filePref let targetDir = pref </> filePref
let targetFile = targetDir </> fileName let targetFile = targetDir </> fileName
let (targetFileNoext, targetFileExt) = splitExtension targetFile let (targetFileNoext, targetFileExt) = splitExtension targetFile
let cppOutput = targetFileNoext <.> "hspp"
let hsFile = targetFileNoext <.> "hs"
createDirectoryIfMissingVerbose verbosity True targetDir createDirectoryIfMissingVerbose verbosity True targetDir
if needsCpp bi -- Run unlit first, then CPP
then runSimplePreProcessor (ppCpp' inputArgs bi lbi) if (targetFileExt == ".lhs")
file targetFile verbosity then runSimplePreProcessor ppUnlit file hsFile verbosity
else copyFile file targetFile else copyFile file hsFile
when (targetFileExt == ".lhs") $ do when (needsCpp bi) $ do
runSimplePreProcessor ppUnlit runSimplePreProcessor (ppCpp' inputArgs bi lbi)
targetFile (targetFileNoext <.> "hs") verbosity hsFile cppOutput verbosity
return () removeFile hsFile
copyFile cppOutput hsFile
removeFile cppOutput
needsCpp :: BuildInfo -> Bool needsCpp :: BuildInfo -> Bool
needsCpp bi = CPP `elem` extensions bi needsCpp bi = CPP `elem` extensions bi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment