Cc.hs 1.27 KB
Newer Older
1
module Settings.Builders.Cc (ccBuilderArgs) where
2

3
import Base
4
import Oracles.Config.Setting
Andrey Mokhov's avatar
Andrey Mokhov committed
5
import Oracles.PackageData
6
import Predicate
7
import Settings.Builders.Common
Andrey Mokhov's avatar
Andrey Mokhov committed
8
import Settings
9

10
-- TODO: handle custom $1_$2_MKDEPENDC_OPTS and
Andrey Mokhov's avatar
Andrey Mokhov committed
11
ccBuilderArgs :: Args
12
ccBuilderArgs = mconcat
13
    [ builder (Cc CompileC) ?
14 15 16
        mconcat [ commonCcArgs
                , arg "-c", arg =<< getInput
                , arg "-o", arg =<< getOutput ]
17

18
    , builder (Cc FindCDependencies) ? do
19 20 21 22 23 24 25 26 27 28
        output <- getOutput
        mconcat [ arg "-E"
                , arg "-MM"
                , commonCcArgs
                , arg "-MF"
                , arg output
                , arg "-MT"
                , arg $ dropExtension output -<.> "o"
                , arg "-x"
                , arg "c"
29 30 31 32 33 34 35 36 37 38 39 40
                , arg =<< getInput ]

    , builder (Cc FindMissingInclude) ? do
        mconcat [ arg "-E"
                , arg "-MM"
                , arg "-MG"
                , commonCcArgs
                , arg "-MF"
                , arg =<< getOutput
                , arg =<< getInput
                ]
    ]
41

Andrey Mokhov's avatar
Andrey Mokhov committed
42 43 44 45
commonCcArgs :: Args
commonCcArgs = mconcat [ append =<< getPkgDataList CcArgs
                       , append =<< getSettingList . ConfCcArgs =<< getStage
                       , cIncludeArgs ]