diff options
Diffstat (limited to 'hadrian/src/Hadrian/Target.hs')
-rw-r--r-- | hadrian/src/Hadrian/Target.hs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/hadrian/src/Hadrian/Target.hs b/hadrian/src/Hadrian/Target.hs new file mode 100644 index 0000000000..88489776c0 --- /dev/null +++ b/hadrian/src/Hadrian/Target.hs @@ -0,0 +1,29 @@ +module Hadrian.Target (Target, target, context, builder, inputs, outputs) where + +import Development.Shake.Classes +import GHC.Generics + +-- | Each invocation of a builder is fully described by a 'Target', which +-- comprises a build context (type variable @c@), a builder (type variable @b@), +-- a list of input files and a list of output files. For example: +-- +-- @ +-- preludeTarget = Target (GHC.Context) (GHC.Builder) +-- { context = Context Stage1 base profiling +-- , builder = Ghc Stage1 +-- , inputs = ["libraries/base/Prelude.hs"] +-- , outputs = ["build/stage1/libraries/base/Prelude.p_o"] } +-- @ +data Target c b = Target + { context :: c -- ^ Current build context + , builder :: b -- ^ Builder to be invoked + , inputs :: [FilePath] -- ^ Input files for the builder + , outputs :: [FilePath] -- ^ Files to be produced + } deriving (Eq, Generic, Show) + +target :: c -> b -> [FilePath] -> [FilePath] -> Target c b +target = Target + +instance (Binary c, Binary b) => Binary (Target c b) +instance (Hashable c, Hashable b) => Hashable (Target c b) +instance (NFData c, NFData b) => NFData (Target c b) |