[project @ 2000-12-07 08:22:53 by simonpj]
[ghc-hetmet.git] / ghc / compiler / main / DriverMkDepend.hs
index 525d70e..453dda1 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverMkDepend.hs,v 1.3 2000/10/26 16:21:02 sewardj Exp $
+-- $Id: DriverMkDepend.hs,v 1.6 2000/11/21 14:34:47 simonmar Exp $
 --
 -- GHC Driver
 --
@@ -11,7 +11,6 @@ module DriverMkDepend where
 
 #include "HsVersions.h"
 
-import CmSummarise -- for mkdependHS stuff
 import DriverState
 import DriverUtil
 import DriverFlags
@@ -156,31 +155,27 @@ endMkDependHS = do
 
        -- create a backup of the original makefile
   when (isJust makefile_hdl) $
-     run_something ("Backing up " ++ makefile)
+     runSomething ("Backing up " ++ makefile)
        (unwords [ "cp", makefile, makefile++".bak" ])
 
        -- copy the new makefile in place
-  run_something "Installing new makefile"
+  runSomething "Installing new makefile"
        (unwords [ "cp", tmp_file, makefile ])
 
 
-findDependency :: String -> ModImport -> IO (Maybe (String, Bool))
-findDependency mod imp = do
+findDependency :: Bool -> String -> ModuleName -> IO (Maybe (String, Bool))
+findDependency is_source mod imp = do
    dir_contents <- readIORef v_Dep_dir_contents
    ignore_dirs  <- readIORef v_Dep_ignore_dirs
    hisuf <- readIORef v_Hi_suf
 
    let
-     (imp_mod, is_source) = 
-       case imp of
-          MINormal str -> (moduleNameString str, False)
-          MISource str -> (moduleNameString str, True )        
-
-     imp_hi = imp_mod ++ '.':hisuf
-     imp_hiboot = imp_mod ++ ".hi-boot"
+     imp_mod      = moduleNameUserString imp
+     imp_hi       = imp_mod ++ '.':hisuf
+     imp_hiboot   = imp_mod ++ ".hi-boot"
      imp_hiboot_v = imp_mod ++ ".hi-boot-" ++ cHscIfaceFileVersion
-     imp_hs = imp_mod ++ ".hs"
-     imp_lhs = imp_mod ++ ".lhs"
+     imp_hs       = imp_mod ++ ".hs"
+     imp_lhs      = imp_mod ++ ".lhs"
 
      deps | is_source = [ imp_hiboot_v, imp_hiboot, imp_hs, imp_lhs ]
          | otherwise = [ imp_hi, imp_hs, imp_lhs ]