-----------------------------------------------------------------------------
--- $Id: DriverPipeline.hs,v 1.9 2000/10/27 11:48:55 sewardj Exp $
+-- $Id: DriverPipeline.hs,v 1.12 2000/10/30 13:46:24 sewardj Exp $
--
-- GHC Driver
--
import CmdLineOpts
import Config
import Util
-import MkIface ( pprIface )
-import Posix
import Directory
import System
import IOExts
--- import Posix commented out temp by SLPJ to get going on windows
import Exception
import IO
-- only do this if we're eventually going to generate a .o file.
-- (ToDo: do when generating .hc files too?)
--
- -- Setting source_unchanged to "-fsource_unchanged" means that M.o seems
+ -- Setting source_unchanged to "-fsource-unchanged" means that M.o seems
-- to be up to date wrt M.hs; so no need to recompile unless imports have
-- changed (which the compiler itself figures out).
-- Setting source_unchanged to "" tells the compiler that M.o is out of
then return "-fsource-unchanged"
else return ""
- -- build a bogus ModSummary to pass to hscMain.
- let summary = ModSummary {
- ms_mod = (mkModuleInThisPackage . mkModuleName)
- {-ToDo: modname!!-}basename,
- ms_location = error "no loc",
- ms_ppsource = Just (input_fn, error "no fingerprint"),
- ms_imports = error "no imports"
- }
+ -- build a bogus ModuleLocation to pass to hscMain.
+ let location = ModuleLocation {
+ hs_preprocd_file = input_fn,
+ hi_file = hifile,
+ obj_file = o_file
+ }
-- get the DynFlags
dyn_flags <- readIORef v_DynFlags
-- run the compiler!
pcs <- initPersistentCompilerState
result <- hscMain dyn_flags{ hscOutName = output_fn }
- summary
+ (source_unchanged == "-fsource-unchanged")
+ location
Nothing -- no iface
emptyModuleEnv -- HomeSymbolTable
emptyModuleEnv -- HomeIfaceTable
-- this is the prefix used for the split .s files
tmp_pfx <- readIORef v_TmpDir
- x <- getProcessID
+ x <- myGetProcessID
let split_s_prefix = tmp_pfx ++ "/ghc" ++ show x
writeIORef v_Split_prefix split_s_prefix
addFilesToClean [split_s_prefix ++ "__*"] -- d:-)
let input_fn = case ms_ppsource summary of
Just (ppsource, fingerprint) -> ppsource
- Nothing -> hs_file (ms_location summary)
+ Nothing -> hs_preprocd_file (ms_location summary)
when verb (hPutStrLn stderr ("compile: input file " ++ input_fn))
-- run the compiler
hsc_result <- hscMain dyn_flags{ hscOutName = output_fn }
- summary old_iface hst hit pcs
+ (panic "compile:source_unchanged")
+ (ms_location summary) old_iface hst hit pcs
case hsc_result of {
HscFail pcs -> return (CompErrs pcs);
Nothing -> return (CompOK details Nothing pcs);
Just iface -> do
- let (basename, _) = splitFilename (hs_file (ms_location summary))
+ let (basename, _) = splitFilename (hs_preprocd_file (ms_location summary))
maybe_stub_o <- dealWithStubs basename maybe_stub_h maybe_stub_c
let stub_unlinked = case maybe_stub_o of
Nothing -> []