-----------------------------------------------------------------------------
--- $Id: DriverPipeline.hs,v 1.33 2000/11/20 17:42:00 sewardj Exp $
+-- $Id: DriverPipeline.hs,v 1.34 2000/11/21 14:34:50 simonmar Exp $
--
-- GHC Driver
--
import HscTypes
import Outputable
import Module
+import ErrUtils
import CmdLineOpts
import Config
import Util
run_phase Unlit _basename _suff input_fn output_fn
= do unlit <- readIORef v_Pgm_L
unlit_flags <- getOpts opt_L
- run_something "Literate pre-processor"
+ runSomething "Literate pre-processor"
("echo '# 1 \"" ++input_fn++"\"' > "++output_fn++" && "
++ unlit ++ ' ':input_fn ++ " - >> " ++ output_fn)
return True
let include_paths = map (\p -> "-I"++p) (cmdline_include_paths
++ pkg_include_dirs)
- verb <- is_verbose
- run_something "C pre-processor"
+ verb <- getVerbFlag
+
+ runSomething "C pre-processor"
(unwords
(["echo '{-# LINE 1 \"" ++ input_fn ++ "\" -}'", ">", output_fn, "&&",
cpp, verb]
++ [ "-x", "c", input_fn, ">>", output_fn ]
))
else do
- run_something "Ineffective C pre-processor"
+ runSomething "Ineffective C pre-processor"
("echo '{-# LINE 1 \"" ++ input_fn ++ "\" -}' > "
++ output_fn ++ " && cat " ++ input_fn
++ " >> " ++ output_fn)
mangle <- readIORef v_Do_asm_mangling
(md_c_flags, md_regd_c_flags) <- machdepCCOpts
- verb <- is_verbose
+ verb <- getVerbFlag
o2 <- readIORef v_minus_o2_for_C
let opt_flag | o2 = "-O2"
excessPrecision <- readIORef v_Excess_precision
- run_something "C Compiler"
+ runSomething "C Compiler"
(unwords ([ cc, "-x", "c", cc_help, "-o", output_fn ]
++ md_c_flags
++ (if cc_phase == HCc && mangle
then do n_regs <- readState stolen_x86_regs
return [ show n_regs ]
else return []
- run_something "Assembly Mangler"
+ runSomething "Assembly Mangler"
(unwords (mangler :
mangler_opts
++ [ input_fn, output_fn ]
-- allocate a tmp file to put the no. of split .s files in (sigh)
n_files <- newTempName "n_files"
- run_something "Split Assembly File"
+ runSomething "Split Assembly File"
(unwords [ splitter
, input_fn
, split_s_prefix
cmdline_include_paths <- readIORef v_Include_paths
let cmdline_include_flags = map (\p -> "-I"++p) cmdline_include_paths
- run_something "Assembler"
+ runSomething "Assembler"
(unwords (as : as_opts
++ cmdline_include_flags
++ [ "-c", input_fn, "-o", output_fn ]
let output_o = newdir real_odir
(basename ++ "__" ++ show n ++ ".o")
real_o <- osuf_ify output_o
- run_something "Assembler"
+ runSomething "Assembler"
(unwords (as : as_opts
++ [ "-c", "-o", real_o, input_s ]
))
doLink :: [String] -> IO ()
doLink o_files = do
ln <- readIORef v_Pgm_l
- verb <- is_verbose
+ verb <- getVerbFlag
static <- readIORef v_Static
let imp = if static then "" else "_imp"
no_hs_main <- readIORef v_NoHsMain
else []
#endif
(md_c_flags, _) <- machdepCCOpts
- run_something "Linker"
+ runSomething "Linker"
(unwords
([ ln, verb, "-o", output_fn ]
++ md_c_flags
compile ghci_mode summary source_unchanged old_iface hst hit pcs = do
- verb <- readIORef v_Verbose
- when verb (hPutStrLn stderr
- (showSDoc (text "compile: compiling"
- <+> ppr (name_of_summary summary))))
-
init_dyn_flags <- readIORef v_InitDynFlags
writeIORef v_DynFlags init_dyn_flags
init_driver_state <- readIORef v_InitDriverState
writeIORef v_Driver_state init_driver_state
+ showPass init_dyn_flags (showSDoc (text "*** Compiling: "
+ <+> ppr (name_of_summary summary)))
+
+ let verb = verbosity init_dyn_flags
let location = ms_location summary
let input_fn = unJust "compile:hs" (ml_hs_file location)
let input_fnpp = unJust "compile:hspp" (ml_hspp_file location)
- when verb (hPutStrLn stderr ("compile: input file " ++ input_fnpp))
+ when (verb >= 2) (hPutStrLn stderr ("compile: input file " ++ input_fnpp))
opts <- getOptionsFromSource input_fnpp
processArgs dynamic_flags opts []
case maybe_stub_h of
Nothing -> return ()
Just tmp_stub_h -> do
- run_something "Copy stub .h file"
+ runSomething "Copy stub .h file"
("cp " ++ tmp_stub_h ++ ' ':stub_h)
-- #include <..._stub.h> in .hc file
case maybe_stub_c of
Nothing -> return Nothing
Just tmp_stub_c -> do -- copy the _stub.c file into the current dir
- run_something "Copy stub .c file"
+ runSomething "Copy stub .c file"
(unwords [
"rm -f", stub_c, "&&",
"echo \'#include \""++stub_h++"\"\' >"++stub_c, " &&",