Occurrrence analysis improvements for NOINLINE functions
[ghc.git] / hadrian / src / Settings / Builders / Common.hs
1 module Settings.Builders.Common (
2 module Base,
3 module Expression,
4 module Oracles.Flag,
5 module Oracles.PackageData,
6 module Oracles.Setting,
7 module Settings,
8 module UserSettings,
9 cIncludeArgs, ldArgs, cArgs, cWarnings, bootPackageDatabaseArgs
10 ) where
11
12 import Base
13 import Expression
14 import Oracles.Flag
15 import Oracles.PackageData
16 import Oracles.Setting
17 import Settings
18 import UserSettings
19
20 cIncludeArgs :: Args
21 cIncludeArgs = do
22 pkg <- getPackage
23 root <- getBuildRoot
24 path <- getBuildPath
25 incDirs <- getPkgDataList IncludeDirs
26 depDirs <- getPkgDataList DepIncludeDirs
27 cross <- expr crossCompiling
28 compilerOrGhc <- package compiler ||^ package ghc
29 mconcat [ not (cross && compilerOrGhc) ? arg "-Iincludes"
30 , arg $ "-I" ++ root -/- generatedDir
31 , arg $ "-I" ++ path
32 , pure [ "-I" ++ pkgPath pkg -/- dir | dir <- incDirs ]
33 , pure [ "-I" ++ unifyPath dir | dir <- depDirs ] ]
34
35 ldArgs :: Args
36 ldArgs = mempty
37
38 cArgs :: Args
39 cArgs = mempty
40
41 -- TODO: should be in a different file
42 cWarnings :: Args
43 cWarnings =
44 mconcat [ arg "-Wall"
45 , flag GccIsClang ? arg "-Wno-unknown-pragmas"
46 , notM (flag GccIsClang) ? notM windowsHost ? arg "-Werror=unused-but-set-variable"
47 , notM (flag GccIsClang) ? arg "-Wno-error=inline" ]
48
49 bootPackageDatabaseArgs :: Args
50 bootPackageDatabaseArgs = do
51 stage <- getStage
52 dbPath <- expr $ packageDbPath stage
53 expr $ need [dbPath -/- packageDbStamp]
54 stage0 ? do
55 top <- expr topDirectory
56 root <- getBuildRoot
57 prefix <- ifM (builder Ghc) (return "-package-db ") (return "--package-db=")
58 arg $ prefix ++ top -/- root -/- stage0PackageDbDir