diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-11-13 05:32:55 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2023-01-02 02:55:22 -0500 |
commit | e5be71a2f99891e63afb203ed1f14303c3815ea5 (patch) | |
tree | a8c958a94e40e57c6a181e54f45ac2b76cf94c56 /hadrian/src/Rules/Generate.hs | |
parent | ec6d3c89ca73bf13cc8d9ec9600f003dfc33ebf5 (diff) | |
download | haskell-wip/rts-configure.tar.gz |
Generate ghcplatform.h from RTS configurewip/rts-configure
Diffstat (limited to 'hadrian/src/Rules/Generate.hs')
-rw-r--r-- | hadrian/src/Rules/Generate.hs | 57 |
1 files changed, 2 insertions, 55 deletions
diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs index b156c9dfdf..c72002eb56 100644 --- a/hadrian/src/Rules/Generate.hs +++ b/hadrian/src/Rules/Generate.hs @@ -146,10 +146,10 @@ generatePackageCode context@(Context stage pkg _ _) = do when (pkg == rts) $ do root -/- "**" -/- dir -/- "cmm/AutoApply.cmm" %> \file -> build $ target context GenApply [] [file] - let go gen file = generate file (semiEmptyTarget stage) gen root -/- "**" -/- dir -/- "include/ghcautoconf.h" %> \_ -> need . pure =<< pkgSetupConfigFile context - root -/- "**" -/- dir -/- "include/ghcplatform.h" %> go generateGhcPlatformH + root -/- "**" -/- dir -/- "include/ghcplatform.h" %> \_ -> + need . pure =<< pkgSetupConfigFile context root -/- "**" -/- dir -/- "include/DerivedConstants.h" %> genPlatformConstantsHeader context root -/- "**" -/- dir -/- "include/rts/EventLogConstants.h" %> genEventTypes "--event-types-defines" root -/- "**" -/- dir -/- "include/rts/EventTypes.h" %> genEventTypes "--event-types-array" @@ -320,59 +320,6 @@ ghcWrapper stage = do else []) ++ [ "$@" ] --- | Given a 'String' replace characters '.' and '-' by underscores ('_') so that --- the resulting 'String' is a valid C preprocessor identifier. -cppify :: String -> String -cppify = replaceEq '-' '_' . replaceEq '.' '_' - --- | Generate @ghcplatform.h@ header. -generateGhcPlatformH :: Expr String -generateGhcPlatformH = do - trackGenerateHs - stage <- getStage - let chooseSetting x y = getSetting $ case stage of { Stage0 {} -> x; _ -> y } - buildPlatform <- chooseSetting BuildPlatform HostPlatform - buildArch <- chooseSetting BuildArch HostArch - buildOs <- chooseSetting BuildOs HostOs - buildVendor <- chooseSetting BuildVendor HostVendor - hostPlatform <- chooseSetting HostPlatform TargetPlatform - hostArch <- chooseSetting HostArch TargetArch - hostOs <- chooseSetting HostOs TargetOs - hostVendor <- chooseSetting HostVendor TargetVendor - ghcUnreg <- getFlag GhcUnregisterised - return . unlines $ - [ "#if !defined(__GHCPLATFORM_H__)" - , "#define __GHCPLATFORM_H__" - , "" - , "#define BuildPlatform_TYPE " ++ cppify buildPlatform - , "#define HostPlatform_TYPE " ++ cppify hostPlatform - , "" - , "#define " ++ cppify buildPlatform ++ "_BUILD 1" - , "#define " ++ cppify hostPlatform ++ "_HOST 1" - , "" - , "#define " ++ buildArch ++ "_BUILD_ARCH 1" - , "#define " ++ hostArch ++ "_HOST_ARCH 1" - , "#define BUILD_ARCH " ++ show buildArch - , "#define HOST_ARCH " ++ show hostArch - , "" - , "#define " ++ buildOs ++ "_BUILD_OS 1" - , "#define " ++ hostOs ++ "_HOST_OS 1" - , "#define BUILD_OS " ++ show buildOs - , "#define HOST_OS " ++ show hostOs - , "" - , "#define " ++ buildVendor ++ "_BUILD_VENDOR 1" - , "#define " ++ hostVendor ++ "_HOST_VENDOR 1" - , "#define BUILD_VENDOR " ++ show buildVendor - , "#define HOST_VENDOR " ++ show hostVendor - , "" - ] - ++ - [ "#define UnregisterisedCompiler 1" | ghcUnreg ] - ++ - [ "" - , "#endif /* __GHCPLATFORM_H__ */" - ] - -- See Note [tooldir: How GHC finds mingw on Windows] generateSettings :: Expr String generateSettings = do |