Expression: Don't re-export Base
[hadrian.git] / src / Settings / TargetDirectory.hs
1 module Settings.TargetDirectory (
2 targetDirectory, targetPath, pkgDataFile, pkgHaddockFile, pkgLibraryFile,
3 pkgGhciLibraryFile
4 ) where
5
6 import Base
7 import Expression
8 import Settings.User
9
10 -- TODO: move to Settings.hs?
11
12 -- User can override the default target directory settings given below
13 targetDirectory :: Stage -> Package -> FilePath
14 targetDirectory = userTargetDirectory
15
16 -- Path to the target directory from GHC source root
17 targetPath :: Stage -> Package -> FilePath
18 targetPath stage pkg = pkgPath pkg -/- targetDirectory stage pkg
19
20 pkgDataFile :: Stage -> Package -> FilePath
21 pkgDataFile stage pkg = targetPath stage pkg -/- "package-data.mk"
22
23 -- Relative path to a package haddock file, e.g.:
24 -- "libraries/array/dist-install/doc/html/array/array.haddock"
25 pkgHaddockFile :: Package -> FilePath
26 pkgHaddockFile pkg =
27 targetPath Stage1 pkg -/- "doc/html" -/- name -/- name <.> "haddock"
28 where name = pkgNameString pkg
29
30 -- Relative path to a package library file, e.g.:
31 -- "libraries/array/dist-install/build/libHSarray-0.5.1.0.a"
32 -- TODO: remove code duplication for computing buildPath
33 pkgLibraryFile :: Stage -> Package -> String -> Way -> Action FilePath
34 pkgLibraryFile stage pkg componentId way = do
35 extension <- libsuf way
36 let buildPath = targetPath stage pkg -/- "build"
37 return $ buildPath -/- "libHS" ++ componentId <.> extension
38
39 -- Relative path to a package ghci library file, e.g.:
40 -- "libraries/array/dist-install/build/HSarray-0.5.1.0.o"
41 pkgGhciLibraryFile :: Stage -> Package -> String -> FilePath
42 pkgGhciLibraryFile stage pkg componentId =
43 targetPath stage pkg -/- "build" -/- "HS" ++ componentId <.> "o"