88489776c08e1d89b7e8bf37379caf5f4003618a
[ghc.git] / hadrian / src / Hadrian / Target.hs
1 module Hadrian.Target (Target, target, context, builder, inputs, outputs) where
2
3 import Development.Shake.Classes
4 import GHC.Generics
5
6 -- | Each invocation of a builder is fully described by a 'Target', which
7 -- comprises a build context (type variable @c@), a builder (type variable @b@),
8 -- a list of input files and a list of output files. For example:
9 --
10 -- @
11 -- preludeTarget = Target (GHC.Context) (GHC.Builder)
12 -- { context = Context Stage1 base profiling
13 -- , builder = Ghc Stage1
14 -- , inputs = ["libraries/base/Prelude.hs"]
15 -- , outputs = ["build/stage1/libraries/base/Prelude.p_o"] }
16 -- @
17 data Target c b = Target
18 { context :: c -- ^ Current build context
19 , builder :: b -- ^ Builder to be invoked
20 , inputs :: [FilePath] -- ^ Input files for the builder
21 , outputs :: [FilePath] -- ^ Files to be produced
22 } deriving (Eq, Generic, Show)
23
24 target :: c -> b -> [FilePath] -> [FilePath] -> Target c b
25 target = Target
26
27 instance (Binary c, Binary b) => Binary (Target c b)
28 instance (Hashable c, Hashable b) => Hashable (Target c b)
29 instance (NFData c, NFData b) => NFData (Target c b)