Cc.hs 1.06 KB
Newer Older
1
module Settings.Builders.Cc (ccBuilderArgs) 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 (builder)
Andrey Mokhov's avatar
Andrey Mokhov committed
8
import Settings
9
import Settings.Builders.Common (cIncludeArgs)
10

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

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