-----------------------------------------------------------------------------
--- $Id: DriverPipeline.hs,v 1.90 2001/07/17 14:48:04 rrt Exp $
+-- $Id: DriverPipeline.hs,v 1.95 2001/08/03 07:44:47 sof Exp $
--
-- GHC Driver
--
cmdline_include_paths <- readIORef v_Include_paths
pkg_include_dirs <- getPackageIncludePath
- let include_paths = map (\p -> "-I"++p) (cmdline_include_paths
- ++ pkg_include_dirs)
+ let include_paths = foldr (\ x xs -> "-I" : x : xs) []
+ (cmdline_include_paths ++ pkg_include_dirs)
verb <- getVerbFlag
(md_c_flags, _) <- machdepCCOpts
(srcimps,imps,mod_name) <- getImportsFromFile input_fn
-- build a ModuleLocation to pass to hscMain.
- Just (mod, location')
+ (mod, location')
<- mkHomeModuleLocn mod_name basename (Just (basename ++ '.':suff))
-- take -ohi into account if present
run_phase cc_phase basename suff input_fn output_fn
| cc_phase == Cc || cc_phase == HCc
= do cc_opts <- getOpts opt_c
- cmdline_include_dirs <- readIORef v_Include_paths
+ cmdline_include_paths <- readIORef v_Include_paths
let hcc = cc_phase == HCc
-- .c files; this is the Value Add(TM) that using
-- ghc instead of gcc gives you :)
pkg_include_dirs <- getPackageIncludePath
- let include_paths = map (\p -> "-I"++p) (cmdline_include_dirs
- ++ pkg_include_dirs)
+ let include_paths = foldr (\ x xs -> "-I" : x : xs) []
+ (cmdline_include_paths ++ pkg_include_dirs)
mangle <- readIORef v_Do_asm_mangling
(md_c_flags, md_regd_c_flags) <- machdepCCOpts
[ "-u", "_PrelMain_mainIO_closure" ,
"-u", "___init_PrelMain"]
#else
- [ "-u", "PrelMain_mainIO_closure" ,
- "-u", "__init_PrelMain"]
+ [ "-u", prefixUnderscore "PrelMain_mainIO_closure" ,
+ "-u", prefixUnderscore "__init_PrelMain"]
#endif
else [])
let hsc_lang = hscLang dyn_flags
(basename, _) = splitFilename input_fn
- output_fn <- case hsc_lang of
- HscAsm -> newTempName (phaseInputExt As)
- HscC -> newTempName (phaseInputExt HCc)
- HscJava -> newTempName "java" -- ToDo
- HscILX -> return (basename ++ ".ilx") -- newTempName "ilx" -- ToDo
- HscInterpreted -> return (error "no output file")
+ keep_hc <- readIORef v_Keep_hc_files
+ keep_s <- readIORef v_Keep_s_files
+
+ output_fn <-
+ case hsc_lang of
+ HscAsm | keep_s -> return (basename ++ '.':phaseInputExt As)
+ | otherwise -> newTempName (phaseInputExt As)
+ HscC | keep_hc -> return (basename ++ '.':phaseInputExt HCc)
+ | otherwise -> newTempName (phaseInputExt HCc)
+ HscJava -> newTempName "java" -- ToDo
+ HscILX -> return (basename ++ ".ilx")
+ -- newTempName "ilx" -- ToDo
+ HscInterpreted -> return (error "no output file")
let dyn_flags' = dyn_flags { hscOutName = output_fn,
hscStubCOutName = basename ++ "_stub.c",
-- as our "unlinked" object.
HscInterpreted ->
case maybe_interpreted_code of
+#ifdef GHCI
Just (bcos,itbl_env) -> do tm <- getClockTime
return ([BCOs bcos itbl_env], tm)
+#endif
Nothing -> panic "compile: no interpreted code"
-- we're in batch mode: finish the compilation pipeline.