c3a117bdd71397e90a5d900fc77d281e08a2e34f
[ghc.git] / src / Target.hs
1 module Target (
2 Target, target, context, builder, inputs, outputs, trackArgument
3 ) where
4
5 import Data.Char
6 import Data.List.Extra
7
8 import qualified Hadrian.Target as H
9 import Hadrian.Target hiding (Target)
10
11 import Builder
12 import Context
13
14 type Target = H.Target Context Builder
15
16 -- | Some arguments do not affect build results and therefore do not need to be
17 -- tracked by the build system. A notable example is "-jN" that controls Make's
18 -- parallelism. Given a 'Target' and an argument, this function should return
19 -- 'True' only if the argument needs to be tracked.
20 trackArgument :: Target -> String -> Bool
21 trackArgument target arg = case builder target of
22 (Make _) -> not $ threadArg arg
23 _ -> True
24 where
25 threadArg s = dropWhileEnd isDigit s `elem` ["-j", "MAKEFLAGS=-j", "THREADS="]