Cc.hs 1018 Bytes
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 Predicates
Andrey Mokhov's avatar
Andrey Mokhov committed
7
import Settings
8
import Settings.Builders.Common
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 Compile) ?
14 15 16
        mconcat [ commonCcArgs
                , arg "-c", arg =<< getInput
                , arg "-o", arg =<< getOutput ]
17

18
    , builder (Cc FindDependencies) ? do
19 20 21 22 23 24 25 26 27 28 29
        output <- getOutput
        mconcat [ arg "-E"
                , arg "-MM"
                , commonCcArgs
                , arg "-MF"
                , arg output
                , arg "-MT"
                , arg $ dropExtension output -<.> "o"
                , arg "-x"
                , arg "c"
                , arg =<< getInput ] ]
30

Andrey Mokhov's avatar
Andrey Mokhov committed
31 32 33 34
commonCcArgs :: Args
commonCcArgs = mconcat [ append =<< getPkgDataList CcArgs
                       , append =<< getSettingList . ConfCcArgs =<< getStage
                       , cIncludeArgs ]