Refactor builder path manipulation
[hadrian.git] / src / Rules / Generators / GhcSplit.hs
1 module Rules.Generators.GhcSplit (generateGhcSplit) where
2
3 import Base
4 import Expression
5 import Oracles.Config.Setting
6 import Rules.Generators.Common
7 import Settings.Paths
8
9 ghcSplitSource :: FilePath
10 ghcSplitSource = "driver/split/ghc-split.prl"
11
12 generateGhcSplit :: Expr String
13 generateGhcSplit = do
14 trackSource "Rules/Generators/GhcSplit.hs"
15 targetPlatform <- getSetting TargetPlatform
16 ghcEnableTNC <- yesNo ghcEnableTablesNextToCode
17 perlPath <- getBuilderPath Perl
18 contents <- lift $ readFileLines ghcSplitSource
19 return . unlines $
20 [ "#!" ++ perlPath
21 , "$TARGETPLATFORM = " ++ show targetPlatform ++ ";"
22 -- I don't see where the ghc-split tool uses TNC, but
23 -- it's in the build-perl macro.
24 , "$TABLES_NEXT_TO_CODE = " ++ show ghcEnableTNC ++ ";"
25 ] ++ contents