Move integerLibrary to flavour
[hadrian.git] / src / Rules / Generators / ConfigHs.hs
1 module Rules.Generators.ConfigHs (generateConfigHs) where
2
3 import Base
4 import Expression
5 import Flavour
6 import GHC
7 import Oracles.Config.Flag
8 import Oracles.Config.Setting
9 import Rules.Generators.Common
10 import Settings
11
12 generateConfigHs :: Expr String
13 generateConfigHs = do
14 trackSource "Rules/Generators/ConfigHs.hs"
15 cProjectName <- getSetting ProjectName
16 cProjectGitCommitId <- getSetting ProjectGitCommitId
17 cProjectVersion <- getSetting ProjectVersion
18 cProjectVersionInt <- getSetting ProjectVersionInt
19 cProjectPatchLevel <- getSetting ProjectPatchLevel
20 cProjectPatchLevel1 <- getSetting ProjectPatchLevel1
21 cProjectPatchLevel2 <- getSetting ProjectPatchLevel2
22 cBooterVersion <- getSetting GhcVersion
23 let cIntegerLibraryType
24 | integerLibrary flavour == integerGmp = "IntegerGMP"
25 | integerLibrary flavour == integerSimple = "IntegerSimple"
26 | otherwise = error $ "Unknown integer library: " ++ integerLibraryName
27 cSupportsSplitObjs <- yesNo supportsSplitObjects
28 cGhcWithInterpreter <- yesNo ghcWithInterpreter
29 cGhcWithNativeCodeGen <- yesNo ghcWithNativeCodeGen
30 cGhcWithSMP <- yesNo ghcWithSMP
31 cGhcEnableTablesNextToCode <- yesNo ghcEnableTablesNextToCode
32 cLeadingUnderscore <- yesNo $ flag LeadingUnderscore
33 cGHC_UNLIT_PGM <- fmap takeFileName $ getBuilderPath Unlit
34 cLibFFI <- lift useLibFFIForAdjustors
35 rtsWays <- getRtsWays
36 cGhcRtsWithLibdw <- getFlag WithLibdw
37 let cGhcRTSWays = unwords $ map show rtsWays
38 return $ unlines
39 [ "{-# LANGUAGE CPP #-}"
40 , "module Config where"
41 , ""
42 , "#include \"ghc_boot_platform.h\""
43 , ""
44 , "data IntegerLibrary = IntegerGMP"
45 , " | IntegerSimple"
46 , " deriving Eq"
47 , ""
48 , "cBuildPlatformString :: String"
49 , "cBuildPlatformString = BuildPlatform_NAME"
50 , "cHostPlatformString :: String"
51 , "cHostPlatformString = HostPlatform_NAME"
52 , "cTargetPlatformString :: String"
53 , "cTargetPlatformString = TargetPlatform_NAME"
54 , ""
55 , "cProjectName :: String"
56 , "cProjectName = " ++ show cProjectName
57 , "cProjectGitCommitId :: String"
58 , "cProjectGitCommitId = " ++ show cProjectGitCommitId
59 , "cProjectVersion :: String"
60 , "cProjectVersion = " ++ show cProjectVersion
61 , "cProjectVersionInt :: String"
62 , "cProjectVersionInt = " ++ show cProjectVersionInt
63 , "cProjectPatchLevel :: String"
64 , "cProjectPatchLevel = " ++ show cProjectPatchLevel
65 , "cProjectPatchLevel1 :: String"
66 , "cProjectPatchLevel1 = " ++ show cProjectPatchLevel1
67 , "cProjectPatchLevel2 :: String"
68 , "cProjectPatchLevel2 = " ++ show cProjectPatchLevel2
69 , "cBooterVersion :: String"
70 , "cBooterVersion = " ++ show cBooterVersion
71 , "cStage :: String"
72 , "cStage = show (STAGE :: Int)"
73 , "cIntegerLibrary :: String"
74 , "cIntegerLibrary = " ++ show integerLibraryName
75 , "cIntegerLibraryType :: IntegerLibrary"
76 , "cIntegerLibraryType = " ++ cIntegerLibraryType
77 , "cSupportsSplitObjs :: String"
78 , "cSupportsSplitObjs = " ++ show cSupportsSplitObjs
79 , "cGhcWithInterpreter :: String"
80 , "cGhcWithInterpreter = " ++ show cGhcWithInterpreter
81 , "cGhcWithNativeCodeGen :: String"
82 , "cGhcWithNativeCodeGen = " ++ show cGhcWithNativeCodeGen
83 , "cGhcWithSMP :: String"
84 , "cGhcWithSMP = " ++ show cGhcWithSMP
85 , "cGhcRTSWays :: String"
86 , "cGhcRTSWays = " ++ show cGhcRTSWays
87 , "cGhcEnableTablesNextToCode :: String"
88 , "cGhcEnableTablesNextToCode = " ++ show cGhcEnableTablesNextToCode
89 , "cLeadingUnderscore :: String"
90 , "cLeadingUnderscore = " ++ show cLeadingUnderscore
91 , "cGHC_UNLIT_PGM :: String"
92 , "cGHC_UNLIT_PGM = " ++ show cGHC_UNLIT_PGM
93 , "cGHC_SPLIT_PGM :: String"
94 , "cGHC_SPLIT_PGM = " ++ show "ghc-split"
95 , "cLibFFI :: Bool"
96 , "cLibFFI = " ++ show cLibFFI
97 , "cGhcThreaded :: Bool"
98 , "cGhcThreaded = " ++ show (threaded `elem` rtsWays)
99 , "cGhcDebugged :: Bool"
100 , "cGhcDebugged = " ++ show (ghcDebugged flavour)
101 , "cGhcRtsWithLibdw :: Bool"
102 , "cGhcRtsWithLibdw = " ++ show cGhcRtsWithLibdw ]