Cc.hs 1.03 KB
Newer Older
Andrey Mokhov's avatar
Andrey Mokhov committed
1
module Settings.Builders.Cc (ccBuilderArgs, ccMBuilderArgs) where
2

Ben Gamari's avatar
Ben Gamari committed
3
import Development.Shake.FilePath
4
import Expression
5
import Oracles.Config.Setting
Andrey Mokhov's avatar
Andrey Mokhov committed
6
import Oracles.PackageData
7
import Predicates (stagedBuilder)
Andrey Mokhov's avatar
Andrey Mokhov committed
8
import Settings
9
import Settings.Builders.Common (cIncludeArgs)
10

Andrey Mokhov's avatar
Andrey Mokhov committed
11 12 13
ccBuilderArgs :: Args
ccBuilderArgs = stagedBuilder Cc ?
    mconcat [ commonCcArgs
14 15
            , arg "-c", arg =<< getInput
            , arg "-o", arg =<< getOutput ]
16

17
-- TODO: handle custom $1_$2_MKDEPENDC_OPTS and
Andrey Mokhov's avatar
Andrey Mokhov committed
18 19
ccMBuilderArgs :: Args
ccMBuilderArgs = stagedBuilder CcM ? do
20
    output <- getOutput
Andrey Mokhov's avatar
Andrey Mokhov committed
21 22
    mconcat [ arg "-E"
            , arg "-MM"
Andrey Mokhov's avatar
Andrey Mokhov committed
23
            , commonCcArgs
Andrey Mokhov's avatar
Andrey Mokhov committed
24
            , arg "-MF"
25
            , arg output
Andrey Mokhov's avatar
Andrey Mokhov committed
26
            , arg "-MT"
27
            , arg $ dropExtension output -<.> "o"
Andrey Mokhov's avatar
Andrey Mokhov committed
28 29
            , arg "-x"
            , arg "c"
30
            , arg =<< getInput ]
31

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