Commit 44fbccd6 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Make ghc less keen to pass -v to gcc and friends

Also a small refactoring in how the verbosity flag is handled.
parent ee16dc77
...@@ -1031,7 +1031,7 @@ runPhase cc_phase input_fn dflags ...@@ -1031,7 +1031,7 @@ runPhase cc_phase input_fn dflags
gcc_extra_viac_flags <- io $ getExtraViaCOpts dflags gcc_extra_viac_flags <- io $ getExtraViaCOpts dflags
let pic_c_flags = picCCOpts dflags let pic_c_flags = picCCOpts dflags
let verb = getVerbFlag dflags let verbFlags = getVerbFlags dflags
-- cc-options are not passed when compiling .hc files. Our -- cc-options are not passed when compiling .hc files. Our
-- hc code doesn't not #include any header files anyway, so these -- hc code doesn't not #include any header files anyway, so these
...@@ -1118,7 +1118,8 @@ runPhase cc_phase input_fn dflags ...@@ -1118,7 +1118,8 @@ runPhase cc_phase input_fn dflags
++ (if hcc ++ (if hcc
then gcc_extra_viac_flags ++ more_hcc_opts then gcc_extra_viac_flags ++ more_hcc_opts
else []) else [])
++ [ verb, "-S", "-Wimplicit", cc_opt ] ++ verbFlags
++ [ "-S", "-Wimplicit", cc_opt ]
++ [ "-D__GLASGOW_HASKELL__="++cProjectVersionInt ] ++ [ "-D__GLASGOW_HASKELL__="++cProjectVersionInt ]
#ifdef darwin_TARGET_OS #ifdef darwin_TARGET_OS
++ framework_paths ++ framework_paths
...@@ -1577,7 +1578,7 @@ getHCFilePackages filename = ...@@ -1577,7 +1578,7 @@ getHCFilePackages filename =
linkBinary :: DynFlags -> [FilePath] -> [PackageId] -> IO () linkBinary :: DynFlags -> [FilePath] -> [PackageId] -> IO ()
linkBinary dflags o_files dep_packages = do linkBinary dflags o_files dep_packages = do
let verb = getVerbFlag dflags let verbFlags = getVerbFlags dflags
output_fn = exeFileName dflags output_fn = exeFileName dflags
-- get the full list of packages to link with, by combining the -- get the full list of packages to link with, by combining the
...@@ -1655,10 +1656,10 @@ linkBinary dflags o_files dep_packages = do ...@@ -1655,10 +1656,10 @@ linkBinary dflags o_files dep_packages = do
let md_c_flags = machdepCCOpts dflags let md_c_flags = machdepCCOpts dflags
SysTools.runLink dflags ( SysTools.runLink dflags (
[ SysTools.Option verb map SysTools.Option verbFlags
, SysTools.Option "-o" ++ [ SysTools.Option "-o"
, SysTools.FileOption "" output_fn , SysTools.FileOption "" output_fn
] ]
++ map SysTools.Option ( ++ map SysTools.Option (
md_c_flags md_c_flags
...@@ -1771,7 +1772,7 @@ maybeCreateManifest dflags exe_filename = do ...@@ -1771,7 +1772,7 @@ maybeCreateManifest dflags exe_filename = do
linkDynLib :: DynFlags -> [String] -> [PackageId] -> IO () linkDynLib :: DynFlags -> [String] -> [PackageId] -> IO ()
linkDynLib dflags o_files dep_packages = do linkDynLib dflags o_files dep_packages = do
let verb = getVerbFlag dflags let verbFlags = getVerbFlags dflags
let o_file = outputFile dflags let o_file = outputFile dflags
pkgs <- getPreloadPackagesAnd dflags dep_packages pkgs <- getPreloadPackagesAnd dflags dep_packages
...@@ -1816,15 +1817,15 @@ linkDynLib dflags o_files dep_packages = do ...@@ -1816,15 +1817,15 @@ linkDynLib dflags o_files dep_packages = do
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
let output_fn = case o_file of { Just s -> s; Nothing -> "HSdll.dll"; } let output_fn = case o_file of { Just s -> s; Nothing -> "HSdll.dll"; }
SysTools.runLink dflags SysTools.runLink dflags (
([ SysTools.Option verb map SysTools.Option verbFlags
, SysTools.Option "-o" ++ [ SysTools.Option "-o"
, SysTools.FileOption "" output_fn , SysTools.FileOption "" output_fn
, SysTools.Option "-shared" , SysTools.Option "-shared"
] ++ ] ++
[ SysTools.FileOption "-Wl,--out-implib=" (output_fn ++ ".a") [ SysTools.FileOption "-Wl,--out-implib=" (output_fn ++ ".a")
| dopt Opt_SharedImplib dflags | dopt Opt_SharedImplib dflags
] ]
++ map (SysTools.FileOption "") o_files ++ map (SysTools.FileOption "") o_files
++ map SysTools.Option ( ++ map SysTools.Option (
md_c_flags md_c_flags
...@@ -1876,12 +1877,12 @@ linkDynLib dflags o_files dep_packages = do ...@@ -1876,12 +1877,12 @@ linkDynLib dflags o_files dep_packages = do
Nothing -> do Nothing -> do
pwd <- getCurrentDirectory pwd <- getCurrentDirectory
return $ pwd `combine` output_fn return $ pwd `combine` output_fn
SysTools.runLink dflags SysTools.runLink dflags (
([ SysTools.Option verb map SysTools.Option verbFlags
, SysTools.Option "-dynamiclib" ++ [ SysTools.Option "-dynamiclib"
, SysTools.Option "-o" , SysTools.Option "-o"
, SysTools.FileOption "" output_fn , SysTools.FileOption "" output_fn
] ]
++ map SysTools.Option ( ++ map SysTools.Option (
md_c_flags md_c_flags
++ o_files ++ o_files
...@@ -1912,11 +1913,11 @@ linkDynLib dflags o_files dep_packages = do ...@@ -1912,11 +1913,11 @@ linkDynLib dflags o_files dep_packages = do
-- non-PIC intra-package-relocations -- non-PIC intra-package-relocations
["-Wl,-Bsymbolic"] ["-Wl,-Bsymbolic"]
SysTools.runLink dflags SysTools.runLink dflags (
([ SysTools.Option verb map SysTools.Option verbFlags
, SysTools.Option "-o" ++ [ SysTools.Option "-o"
, SysTools.FileOption "" output_fn , SysTools.FileOption "" output_fn
] ]
++ map SysTools.Option ( ++ map SysTools.Option (
md_c_flags md_c_flags
++ o_files ++ o_files
...@@ -1945,7 +1946,7 @@ doCpp dflags raw include_cc_opts input_fn output_fn = do ...@@ -1945,7 +1946,7 @@ doCpp dflags raw include_cc_opts input_fn output_fn = do
let include_paths = foldr (\ x xs -> "-I" : x : xs) [] let include_paths = foldr (\ x xs -> "-I" : x : xs) []
(cmdline_include_paths ++ pkg_include_dirs) (cmdline_include_paths ++ pkg_include_dirs)
let verb = getVerbFlag dflags let verbFlags = getVerbFlags dflags
let cc_opts let cc_opts
| not include_cc_opts = [] | not include_cc_opts = []
...@@ -1965,7 +1966,7 @@ doCpp dflags raw include_cc_opts input_fn output_fn = do ...@@ -1965,7 +1966,7 @@ doCpp dflags raw include_cc_opts input_fn output_fn = do
-- remember, in code we *compile*, the HOST is the same our TARGET, -- remember, in code we *compile*, the HOST is the same our TARGET,
-- and BUILD is the same as our HOST. -- and BUILD is the same as our HOST.
cpp_prog ([SysTools.Option verb] cpp_prog ( map SysTools.Option verbFlags
++ map SysTools.Option include_paths ++ map SysTools.Option include_paths
++ map SysTools.Option hsSourceCppOpts ++ map SysTools.Option hsSourceCppOpts
++ map SysTools.Option target_defs ++ map SysTools.Option target_defs
......
...@@ -40,7 +40,7 @@ module DynFlags ( ...@@ -40,7 +40,7 @@ module DynFlags (
initDynFlags, -- DynFlags -> IO DynFlags initDynFlags, -- DynFlags -> IO DynFlags
getOpts, -- DynFlags -> (DynFlags -> [a]) -> [a] getOpts, -- DynFlags -> (DynFlags -> [a]) -> [a]
getVerbFlag, getVerbFlags,
updOptLevel, updOptLevel,
setTmpDir, setTmpDir,
setPackageName, setPackageName,
...@@ -873,10 +873,10 @@ getOpts dflags opts = reverse (opts dflags) ...@@ -873,10 +873,10 @@ getOpts dflags opts = reverse (opts dflags)
-- | Gets the verbosity flag for the current verbosity level. This is fed to -- | Gets the verbosity flag for the current verbosity level. This is fed to
-- other tools, so GHC-specific verbosity flags like @-ddump-most@ are not included -- other tools, so GHC-specific verbosity flags like @-ddump-most@ are not included
getVerbFlag :: DynFlags -> String getVerbFlags :: DynFlags -> [String]
getVerbFlag dflags getVerbFlags dflags
| verbosity dflags >= 3 = "-v" | verbosity dflags >= 4 = ["-v"]
| otherwise = "" | otherwise = []
setObjectDir, setHiDir, setStubDir, setOutputDir, setDylibInstallName, setObjectDir, setHiDir, setStubDir, setOutputDir, setDylibInstallName,
setObjectSuf, setHiSuf, setHcSuf, parseDynLibLoaderMode, setObjectSuf, setHiSuf, setHcSuf, parseDynLibLoaderMode,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment