summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings/Flavours
diff options
context:
space:
mode:
Diffstat (limited to 'hadrian/src/Settings/Flavours')
-rw-r--r--hadrian/src/Settings/Flavours/Common.hs11
-rw-r--r--hadrian/src/Settings/Flavours/Development.hs20
-rw-r--r--hadrian/src/Settings/Flavours/Performance.hs18
-rw-r--r--hadrian/src/Settings/Flavours/Profiled.hs23
-rw-r--r--hadrian/src/Settings/Flavours/Quick.hs34
-rw-r--r--hadrian/src/Settings/Flavours/QuickCross.hs37
-rw-r--r--hadrian/src/Settings/Flavours/Quickest.hs24
7 files changed, 167 insertions, 0 deletions
diff --git a/hadrian/src/Settings/Flavours/Common.hs b/hadrian/src/Settings/Flavours/Common.hs
new file mode 100644
index 0000000000..a1eb2fbba9
--- /dev/null
+++ b/hadrian/src/Settings/Flavours/Common.hs
@@ -0,0 +1,11 @@
+module Settings.Flavours.Common where
+
+import Expression
+
+-- See https://ghc.haskell.org/trac/ghc/ticket/15286 and
+-- https://phabricator.haskell.org/D4880
+naturalInBaseFixArgs :: Args
+naturalInBaseFixArgs = mconcat
+ [ input "//Natural.hs" ? pure ["-fno-omit-interface-pragmas"]
+ , input "//Num.hs" ? pure ["-fno-ignore-interface-pragmas"]
+ ]
diff --git a/hadrian/src/Settings/Flavours/Development.hs b/hadrian/src/Settings/Flavours/Development.hs
new file mode 100644
index 0000000000..5919026cb0
--- /dev/null
+++ b/hadrian/src/Settings/Flavours/Development.hs
@@ -0,0 +1,20 @@
+module Settings.Flavours.Development (developmentFlavour) where
+
+import Expression
+import Flavour
+import {-# SOURCE #-} Settings.Default
+
+-- Please update doc/flavours.md when changing this file.
+developmentFlavour :: Stage -> Flavour
+developmentFlavour ghcStage = defaultFlavour
+ { name = "devel" ++ show (fromEnum ghcStage)
+ , args = defaultBuilderArgs <> developmentArgs ghcStage <> defaultPackageArgs }
+
+developmentArgs :: Stage -> Args
+developmentArgs ghcStage = do
+ stage <- getStage
+ sourceArgs SourceArgs
+ { hsDefault = pure ["-O", "-H64m"]
+ , hsLibrary = notStage0 ? arg "-dcore-lint"
+ , hsCompiler = succ stage == ghcStage ? pure ["-O0", "-DDEBUG"]
+ , hsGhc = succ stage == ghcStage ? pure ["-O0", "-DDEBUG"] }
diff --git a/hadrian/src/Settings/Flavours/Performance.hs b/hadrian/src/Settings/Flavours/Performance.hs
new file mode 100644
index 0000000000..64ab4bce9d
--- /dev/null
+++ b/hadrian/src/Settings/Flavours/Performance.hs
@@ -0,0 +1,18 @@
+module Settings.Flavours.Performance (performanceFlavour) where
+
+import Expression
+import Flavour
+import {-# SOURCE #-} Settings.Default
+
+-- Please update doc/flavours.md when changing this file.
+performanceFlavour :: Flavour
+performanceFlavour = defaultFlavour
+ { name = "perf"
+ , args = defaultBuilderArgs <> performanceArgs <> defaultPackageArgs }
+
+performanceArgs :: Args
+performanceArgs = sourceArgs SourceArgs
+ { hsDefault = pure ["-O", "-H64m"]
+ , hsLibrary = notStage0 ? arg "-O2"
+ , hsCompiler = mconcat [stage0 ? arg "-O", notStage0 ? arg "-O2"]
+ , hsGhc = mconcat [stage0 ? arg "-O", notStage0 ? arg "-O2"] }
diff --git a/hadrian/src/Settings/Flavours/Profiled.hs b/hadrian/src/Settings/Flavours/Profiled.hs
new file mode 100644
index 0000000000..91b7f3b188
--- /dev/null
+++ b/hadrian/src/Settings/Flavours/Profiled.hs
@@ -0,0 +1,23 @@
+module Settings.Flavours.Profiled (profiledFlavour) where
+
+import Expression
+import Flavour
+import {-# SOURCE #-} Settings.Default
+import Settings.Flavours.Common (naturalInBaseFixArgs)
+
+-- Please update doc/flavours.md when changing this file.
+profiledFlavour :: Flavour
+profiledFlavour = defaultFlavour
+ { name = "prof"
+ , args = defaultBuilderArgs <> profiledArgs <> defaultPackageArgs
+ , ghcProfiled = True }
+
+profiledArgs :: Args
+profiledArgs = sourceArgs SourceArgs
+ { hsDefault = mconcat
+ [ pure ["-O0", "-H64m"]
+ , naturalInBaseFixArgs
+ ]
+ , hsLibrary = notStage0 ? arg "-O"
+ , hsCompiler = arg "-O"
+ , hsGhc = arg "-O" }
diff --git a/hadrian/src/Settings/Flavours/Quick.hs b/hadrian/src/Settings/Flavours/Quick.hs
new file mode 100644
index 0000000000..59b58eb413
--- /dev/null
+++ b/hadrian/src/Settings/Flavours/Quick.hs
@@ -0,0 +1,34 @@
+module Settings.Flavours.Quick (quickFlavour) where
+
+import Expression
+import Flavour
+import Oracles.Flag
+import {-# SOURCE #-} Settings.Default
+import Settings.Flavours.Common
+
+-- Please update doc/flavours.md when changing this file.
+quickFlavour :: Flavour
+quickFlavour = defaultFlavour
+ { name = "quick"
+ , args = defaultBuilderArgs <> quickArgs <> defaultPackageArgs
+ , libraryWays = mconcat
+ [ pure [vanilla]
+ , notStage0 ? platformSupportsSharedLibs ? pure [dynamic] ]
+ , rtsWays = mconcat
+ [ pure
+ [ vanilla, threaded, logging, debug
+ , threadedDebug, threadedLogging, threaded ]
+ , notStage0 ? platformSupportsSharedLibs ? pure
+ [ dynamic, debugDynamic, threadedDynamic, loggingDynamic
+ , threadedDebugDynamic, threadedLoggingDynamic ]
+ ] }
+
+quickArgs :: Args
+quickArgs = sourceArgs SourceArgs
+ { hsDefault = mconcat $
+ [ pure ["-O0", "-H64m"]
+ , naturalInBaseFixArgs
+ ]
+ , hsLibrary = notStage0 ? arg "-O"
+ , hsCompiler = stage0 ? arg "-O"
+ , hsGhc = stage0 ? arg "-O" }
diff --git a/hadrian/src/Settings/Flavours/QuickCross.hs b/hadrian/src/Settings/Flavours/QuickCross.hs
new file mode 100644
index 0000000000..7572be27d1
--- /dev/null
+++ b/hadrian/src/Settings/Flavours/QuickCross.hs
@@ -0,0 +1,37 @@
+module Settings.Flavours.QuickCross (quickCrossFlavour) where
+
+import Expression
+import Flavour
+import Oracles.Flag
+import {-# SOURCE #-} Settings.Default
+import Settings.Flavours.Common
+
+-- Please update doc/flavours.md when changing this file.
+quickCrossFlavour :: Flavour
+quickCrossFlavour = defaultFlavour
+ { name = "quick-cross"
+ , args = defaultBuilderArgs <> quickCrossArgs <> defaultPackageArgs
+ , dynamicGhcPrograms = pure False
+ , libraryWays = mconcat
+ [ pure [vanilla]
+ , notStage0 ? platformSupportsSharedLibs ? pure [dynamic] ]
+ , rtsWays = mconcat
+ [ pure
+ [ vanilla, threaded, logging, debug
+ , threadedDebug, threadedLogging, threaded ]
+ , notStage0 ? platformSupportsSharedLibs ? pure
+ [ dynamic, debugDynamic, threadedDynamic, loggingDynamic
+ , threadedDebugDynamic, threadedLoggingDynamic ]
+ ] }
+
+quickCrossArgs :: Args
+quickCrossArgs = sourceArgs SourceArgs
+ { hsDefault = mconcat $
+ [ pure ["-O0", "-H64m"]
+ , naturalInBaseFixArgs
+ ]
+ , hsLibrary = notStage0 ? mconcat [ arg "-O", arg "-fllvm" ]
+ , hsCompiler = stage0 ? arg "-O"
+ , hsGhc = mconcat
+ [ stage0 ? arg "-O"
+ , stage1 ? mconcat [ arg "-O0", arg "-fllvm" ] ] }
diff --git a/hadrian/src/Settings/Flavours/Quickest.hs b/hadrian/src/Settings/Flavours/Quickest.hs
new file mode 100644
index 0000000000..3c5f944e7e
--- /dev/null
+++ b/hadrian/src/Settings/Flavours/Quickest.hs
@@ -0,0 +1,24 @@
+module Settings.Flavours.Quickest (quickestFlavour) where
+
+import Expression
+import Flavour
+import {-# SOURCE #-} Settings.Default
+import Settings.Flavours.Common
+
+-- Please update doc/flavours.md when changing this file.
+quickestFlavour :: Flavour
+quickestFlavour = defaultFlavour
+ { name = "quickest"
+ , args = defaultBuilderArgs <> quickestArgs <> defaultPackageArgs
+ , libraryWays = pure [vanilla]
+ , rtsWays = pure [vanilla, threaded] }
+
+quickestArgs :: Args
+quickestArgs = sourceArgs SourceArgs
+ { hsDefault = mconcat $
+ [ pure ["-O0", "-H64m"]
+ , naturalInBaseFixArgs
+ ]
+ , hsLibrary = mempty
+ , hsCompiler = stage0 ? arg "-O"
+ , hsGhc = stage0 ? arg "-O" }