summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings/Builders/Cc.hs
blob: fdd9fc53930b5a4c8282d28e1927bca3cedbb747 (plain)
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
module Settings.Builders.Cc (ccBuilderArgs) where

import Settings.Builders.Common

ccBuilderArgs :: Args
ccBuilderArgs = do
    way <- getWay
    builder Cc ? mconcat
        [ getPkgDataList CcArgs
        , getStagedSettingList ConfCcArgs
        , cIncludeArgs

        , builder (Cc CompileC) ? mconcat
            [ arg "-Wall"
            , Dynamic `wayUnit` way ? pure [ "-fPIC", "-DDYNAMIC" ]
            , arg "-c", arg =<< getInput
            , arg "-o", arg =<< getOutput ]

        , builder (Cc FindCDependencies) ? do
            output <- getOutput
            mconcat [ arg "-E"
                    , arg "-MM", arg "-MG"
                    , arg "-MF", arg output
                    , arg "-MT", arg $ dropExtension output -<.> "o"
                    , arg "-x", arg "c"
                    , arg =<< getInput ] ]