fdd9fc53930b5a4c8282d28e1927bca3cedbb747
[hadrian.git] / src / Settings / Builders / Cc.hs
1 module Settings.Builders.Cc (ccBuilderArgs) where
2
3 import Settings.Builders.Common
4
5 ccBuilderArgs :: Args
6 ccBuilderArgs = do
7 way <- getWay
8 builder Cc ? mconcat
9 [ getPkgDataList CcArgs
10 , getStagedSettingList ConfCcArgs
11 , cIncludeArgs
12
13 , builder (Cc CompileC) ? mconcat
14 [ arg "-Wall"
15 , Dynamic `wayUnit` way ? pure [ "-fPIC", "-DDYNAMIC" ]
16 , arg "-c", arg =<< getInput
17 , arg "-o", arg =<< getOutput ]
18
19 , builder (Cc FindCDependencies) ? do
20 output <- getOutput
21 mconcat [ arg "-E"
22 , arg "-MM", arg "-MG"
23 , arg "-MF", arg output
24 , arg "-MT", arg $ dropExtension output -<.> "o"
25 , arg "-x", arg "c"
26 , arg =<< getInput ] ]