@@ -19,6 +19,7 @@ module Distribution.Simple.GHC.Internal (
19
19
targetPlatform ,
20
20
getGhcInfo ,
21
21
componentCcGhcOptions ,
22
+ componentCmmGhcOptions ,
22
23
componentCxxGhcOptions ,
23
24
componentAsmGhcOptions ,
24
25
componentGhcOptions ,
@@ -433,15 +434,50 @@ componentGhcOptions verbosity implInfo lbi bi clbi odir =
433
434
ghcOptExtensionMap = Map. fromList . compilerExtensions $ (compiler lbi)
434
435
}
435
436
where
436
- toGhcOptimisation NoOptimisation = mempty -- TODO perhaps override?
437
- toGhcOptimisation NormalOptimisation = toFlag GhcNormalOptimisation
438
- toGhcOptimisation MaximumOptimisation = toFlag GhcMaximumOptimisation
439
-
440
437
exe_paths = [ componentBuildDir lbi (targetCLBI exe_tgt)
441
438
| uid <- componentExeDeps clbi
442
439
-- TODO: Ugh, localPkgDescr
443
440
, Just exe_tgt <- [unitIdTarget' (localPkgDescr lbi) lbi uid] ]
444
441
442
+ toGhcOptimisation :: OptimisationLevel -> Flag GhcOptimisation
443
+ toGhcOptimisation NoOptimisation = mempty -- TODO perhaps override?
444
+ toGhcOptimisation NormalOptimisation = toFlag GhcNormalOptimisation
445
+ toGhcOptimisation MaximumOptimisation = toFlag GhcMaximumOptimisation
446
+
447
+
448
+ componentCmmGhcOptions :: Verbosity -> GhcImplInfo -> LocalBuildInfo
449
+ -> BuildInfo -> ComponentLocalBuildInfo
450
+ -> FilePath -> FilePath
451
+ -> GhcOptions
452
+ componentCmmGhcOptions verbosity _implInfo lbi bi clbi odir filename =
453
+ mempty {
454
+ -- Respect -v0, but don't crank up verbosity on GHC if
455
+ -- Cabal verbosity is requested. For that, use --ghc-option=-v instead!
456
+ ghcOptVerbosity = toFlag (min verbosity normal),
457
+ ghcOptMode = toFlag GhcModeCompile ,
458
+ ghcOptInputFiles = toNubListR [filename],
459
+
460
+ ghcOptCppIncludePath = toNubListR $ [autogenComponentModulesDir lbi clbi
461
+ ,autogenPackageModulesDir lbi
462
+ ,odir]
463
+ -- includes relative to the package
464
+ ++ PD. includeDirs bi
465
+ -- potential includes generated by `configure'
466
+ -- in the build directory
467
+ ++ [buildDir lbi </> dir | dir <- PD. includeDirs bi],
468
+ ghcOptCppOptions = cppOptions bi,
469
+ ghcOptCppIncludes = toNubListR $
470
+ [autogenComponentModulesDir lbi clbi </> cppHeaderName],
471
+ ghcOptHideAllPackages= toFlag True ,
472
+ ghcOptPackageDBs = withPackageDB lbi,
473
+ ghcOptPackages = toNubListR $ mkGhcOptPackages clbi,
474
+ ghcOptOptimisation = toGhcOptimisation (withOptimization lbi),
475
+ ghcOptDebugInfo = toFlag (withDebugInfo lbi),
476
+ ghcOptExtra = cmmOptions bi,
477
+ ghcOptObjDir = toFlag odir
478
+ }
479
+
480
+
445
481
-- | Strip out flags that are not supported in ghci
446
482
filterGhciFlags :: [String ] -> [String ]
447
483
filterGhciFlags = filter supported
0 commit comments