From: simonmar Date: Mon, 22 Oct 2001 10:33:50 +0000 (+0000) Subject: [project @ 2001-10-22 10:33:50 by simonmar] X-Git-Tag: Approximately_9120_patches~766 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=d45e90d32431680206dcb51e0e055679b3d0745c;p=ghc-hetmet.git [project @ 2001-10-22 10:33:50 by simonmar] Changes to the finder algorithm: in non-compilation-manager modes (eg. ghc -c) we now search for .hi files only, because a source file is no good to us. In compilation manager modes, we now don't search for .hi files in the home package at all. --- diff --git a/ghc/compiler/main/DriverState.hs b/ghc/compiler/main/DriverState.hs index 93c581a..fdda888 100644 --- a/ghc/compiler/main/DriverState.hs +++ b/ghc/compiler/main/DriverState.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverState.hs,v 1.59 2001/10/01 14:28:37 rrt Exp $ +-- $Id: DriverState.hs,v 1.60 2001/10/22 10:33:50 simonmar Exp $ -- -- Settings for the driver -- @@ -48,6 +48,10 @@ data GhcMode GLOBAL_VAR(v_GhcMode, error "mode not set", GhcMode) +isCompManagerMode DoMake = True +isCompManagerMode DoInteractive = True +isCompManagerMode _ = False + ----------------------------------------------------------------------------- -- Global compilation flags diff --git a/ghc/compiler/main/Finder.lhs b/ghc/compiler/main/Finder.lhs index 83cf28c..c90bb0f 100644 --- a/ghc/compiler/main/Finder.lhs +++ b/ghc/compiler/main/Finder.lhs @@ -64,17 +64,21 @@ maybeHomeModule :: ModuleName -> Bool -> IO (Maybe (Module, ModuleLocation)) maybeHomeModule mod_name is_source = do home_path <- readIORef v_Import_paths hisuf <- readIORef v_Hi_suf + mode <- readIORef v_GhcMode let mod_str = moduleNameUserString mod_name basename = map (\c -> if c == '.' then '/' else c) mod_str - std_exts = - [ ("hs", \ _ fName path -> mkHomeModuleLocn mod_name path fName) - , ("lhs", \ _ fName path -> mkHomeModuleLocn mod_name path fName) - , (hisuf, \ _ fName path -> mkHiOnlyModuleLocn mod_name fName) - ] - -- look for the .hi file last, because if there's a source file about - -- we want to find it. + -- In compilation manager modes, we look for source files in the home + -- package because we can compile these automatically. In one-shot + -- compilation mode we look for .hi files only. + std_exts + | isCompManagerMode mode = + [ ("hs", \ _ fName path -> mkHomeModuleLocn mod_name path fName) + , ("lhs", \ _ fName path -> mkHomeModuleLocn mod_name path fName) + ] + | otherwise = + [ (hisuf, \ _ fName path -> mkHiOnlyModuleLocn mod_name fName) ] -- last chance: .hi-boot- and .hi-boot hi_boot_ver = "hi-boot-" ++ cHscIfaceFileVersion