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