Use Cabal directly in place of ghc-cabal + make build root configurable (#531)
[hadrian.git] / src / Settings / Builders / Cc.hs
1 module Settings.Builders.Cc (ccBuilderArgs) where
2
3 import Hadrian.Haskell.Cabal.PackageData as PD
4 import Settings.Builders.Common
5
6 ccBuilderArgs :: Args
7 ccBuilderArgs = do
8 way <- getWay
9 builder Cc ? mconcat
10 [ getPackageData PD.ccOpts
11 , getStagedSettingList ConfCcArgs
12
13 , builder (Cc CompileC) ? mconcat
14 [ arg "-Wall"
15 , cIncludeArgs
16 , Dynamic `wayUnit` way ? pure [ "-fPIC", "-DDYNAMIC" ]
17 , arg "-c", arg =<< getInput
18 , arg "-o", arg =<< getOutput ]
19
20 , builder (Cc FindCDependencies) ? do
21 output <- getOutput
22 mconcat [ arg "-E"
23 , arg "-MM", arg "-MG"
24 , arg "-MF", arg output
25 , arg "-MT", arg $ dropExtension output -<.> "o"
26 , cIncludeArgs
27 , arg "-x", arg "c"
28 , arg =<< getInput ] ]