This repository has been archived by the owner on Aug 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47529e5
commit 8c32f2c
Showing
4 changed files
with
67 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
src/Rules/Generators/PlatformH.hs → src/Rules/Generators/GhcBootPlatformH.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
module Rules.Generators.GhcPlatformH (generateGhcPlatformH) where | ||
|
||
import Expression | ||
import Oracles | ||
|
||
generateGhcPlatformH :: Expr String | ||
generateGhcPlatformH = do | ||
lift $ need [sourcePath -/- "Rules/Generators/GhcPlatformH.hs"] | ||
let cppify = replaceEq '-' '_' . replaceEq '.' '_' | ||
hostPlatform <- getSetting HostPlatform | ||
hostArch <- getSetting HostArch | ||
hostOs <- getSetting HostOs | ||
hostVendor <- getSetting HostVendor | ||
targetPlatform <- getSetting TargetPlatform | ||
targetArch <- getSetting TargetArch | ||
targetOs <- getSetting TargetOs | ||
targetVendor <- getSetting TargetVendor | ||
ghcUnreg <- getFlag GhcUnregisterised | ||
return . unlines $ | ||
[ "#ifndef __GHCPLATFORM_H__" | ||
, "#define __GHCPLATFORM_H__" | ||
, "" | ||
, "#define BuildPlatform_TYPE " ++ cppify hostPlatform | ||
, "#define HostPlatform_TYPE " ++ cppify targetPlatform | ||
, "" | ||
, "#define " ++ cppify hostPlatform ++ "_BUILD 1" | ||
, "#define " ++ cppify targetPlatform ++ "_HOST 1" | ||
, "" | ||
, "#define " ++ hostArch ++ "_BUILD_ARCH 1" | ||
, "#define " ++ targetArch ++ "_HOST_ARCH 1" | ||
, "#define BUILD_ARCH " ++ quote hostArch | ||
, "#define HOST_ARCH " ++ quote targetArch | ||
, "" | ||
, "#define " ++ hostOs ++ "_BUILD_OS 1" | ||
, "#define " ++ targetOs ++ "_HOST_OS 1" | ||
, "#define BUILD_OS " ++ quote hostOs | ||
, "#define HOST_OS " ++ quote targetOs | ||
, "" | ||
, "#define " ++ hostVendor ++ "_BUILD_VENDOR 1" | ||
, "#define " ++ targetVendor ++ "_HOST_VENDOR 1" | ||
, "#define BUILD_VENDOR " ++ quote hostVendor | ||
, "#define HOST_VENDOR " ++ quote targetVendor | ||
, "" | ||
, "/* These TARGET macros are for backwards compatibility... DO NOT USE! */" | ||
, "#define TargetPlatform_TYPE " ++ cppify targetPlatform | ||
, "#define " ++ cppify targetPlatform ++ "_TARGET 1" | ||
, "#define " ++ targetArch ++ "_TARGET_ARCH 1" | ||
, "#define TARGET_ARCH " ++ quote targetArch | ||
, "#define " ++ targetOs ++ "_TARGET_OS 1" | ||
, "#define TARGET_OS " ++ quote targetOs | ||
, "#define " ++ targetVendor ++ "_TARGET_VENDOR 1" ] | ||
++ | ||
[ "#define UnregisterisedCompiler 1" | ghcUnreg ] | ||
++ | ||
[ "\n#endif /* __GHCPLATFORM_H__ */" ] |