+build_primitive_sources :: Hook a -> Hook a
+build_primitive_sources f pd lbi uhs x
+ = do when (compilerFlavor (compiler lbi) == GHC) $ do
+ let genprimopcode = joinPath ["..", "..", "utils",
+ "genprimopcode", "genprimopcode"]
+ primops = joinPath ["..", "..", "compiler", "prelude",
+ "primops.txt"]
+ primhs = joinPath ["GHC", "Prim.hs"]
+ primopwrappers = joinPath ["GHC", "PrimopWrappers.hs"]
+ maybeExit $ system (genprimopcode ++ " --make-haskell-source < "
+ ++ primops ++ " > " ++ primhs)
+ maybeExit $ system (genprimopcode ++ " --make-haskell-wrappers < "
+ ++ primops ++ " > " ++ primopwrappers)
+ f pd lbi uhs x
+