mkHomeModLocation, -- :: ModuleName -> String -> FilePath
-- -> IO ModLocation
+ findLinkable, -- :: ModuleName -> ModLocation -> IO (Maybe Linkable)
+
hiBootExt, -- :: String
hiBootVerExt, -- :: String
import Module
import UniqFM ( filterUFM )
import Packages ( PackageConfig(..) )
+import HscTypes ( Linkable(..), Unlinked(..) )
import DriverState
-import DriverUtil ( split_longest_prefix )
+import DriverUtil ( split_longest_prefix, splitFilename3 )
import FastString
import Config
import Util
addToFinderCache mod_name result
return result
+
+-- -----------------------------------------------------------------------------
+-- findLinkable isn't related to the other stuff in here,
+-- but there' no other obvious place for it
+
+findLinkable :: ModuleName -> ModLocation -> IO (Maybe Linkable)
+findLinkable mod locn
+ | Just obj_fn <- ml_obj_file locn
+ = do obj_exist <- doesFileExist obj_fn
+ if not obj_exist
+ then return Nothing
+ else
+ do let stub_fn = case splitFilename3 obj_fn of
+ (dir, base, ext) -> dir ++ "/" ++ base ++ "_stub.o"
+ stub_exist <- doesFileExist stub_fn
+ obj_time <- getModificationTime obj_fn
+ if stub_exist
+ then return (Just (LM obj_time mod [DotO obj_fn, DotO stub_fn]))
+ else return (Just (LM obj_time mod [DotO obj_fn]))
+ | otherwise
+ = return Nothing
\end{code}