[project @ 2000-10-30 17:18:26 by simonpj]
[ghc-hetmet.git] / ghc / compiler / main / DriverPipeline.hs
index 06735fe..cbf1fce 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $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
 --
@@ -37,13 +37,10 @@ import Module
 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
@@ -415,7 +412,7 @@ run_phase Hsc basename suff input_fn output_fn
   -- 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
@@ -435,14 +432,12 @@ run_phase Hsc basename suff input_fn output_fn
                                  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
@@ -450,7 +445,8 @@ run_phase Hsc basename suff input_fn output_fn
   -- 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
@@ -574,7 +570,7 @@ run_phase SplitMangle _basename _suff input_fn _output_fn
 
        -- 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:-)
@@ -734,7 +730,7 @@ compile summary old_iface hst hit pcs = do
    
    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))
 
@@ -751,7 +747,8 @@ compile summary old_iface hst hit pcs = do
 
    -- 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);
@@ -764,7 +761,7 @@ compile summary old_iface hst hit pcs = do
                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 -> []