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