compile :: HscEnv
-> ModSummary
- -> Bool -- True <=> source unchanged
- -> Bool -- True <=> have object
+ -> Maybe Linkable -- Just linkable <=> source unchanged
-> Maybe ModIface -- Old interface, if available
-> IO CompResult
data CompResult
- = CompOK ModDetails -- New details
- ModIface -- New iface
- (Maybe Linkable) -- New code; Nothing => compilation was not reqd
- -- (old code is still valid)
+ = CompOK ModDetails -- New details
+ ModIface -- New iface
+ (Maybe Linkable) -- a Maybe, for the same reasons as hm_linkable
| CompErrs
-compile hsc_env mod_summary
- source_unchanged have_object old_iface = do
+compile hsc_env mod_summary maybe_old_linkable old_iface = do
let dflags0 = hsc_dflags hsc_env
this_mod = ms_mod mod_summary
src_flavour = ms_hsc_src mod_summary
+ have_object
+ | Just l <- maybe_old_linkable, isObjectLinkable l = True
+ | otherwise = False
+
showPass dflags0 ("Compiling " ++ showModMsg have_object mod_summary)
let verb = verbosity dflags0
-- -no-recomp should also work with --make
let do_recomp = dopt Opt_RecompChecking dflags
- source_unchanged' = source_unchanged && do_recomp
+ source_unchanged = isJust maybe_old_linkable && do_recomp
hsc_env' = hsc_env { hsc_dflags = dflags' }
-- run the compiler
hsc_result <- hscMain hsc_env' printErrorsAndWarnings mod_summary
- source_unchanged' have_object old_iface
+ source_unchanged have_object old_iface
case hsc_result of
HscFail -> return CompErrs
- HscNoRecomp details iface -> return (CompOK details iface Nothing)
+ HscNoRecomp details iface ->
+ ASSERT(isJust maybe_old_linkable)
+ return (CompOK details iface maybe_old_linkable)
HscRecomp details iface
stub_h_exists stub_c_exists maybe_interpreted_code
pkg_deps = concatMap (dep_pkgs . mi_deps . hm_iface) home_mod_infos
-- the linkables to link
- linkables = map hm_linkable home_mod_infos
+ linkables = map (fromJust.hm_linkable) home_mod_infos
when (verb >= 3) $ do
hPutStrLn stderr "link: linkables are ..."
pkg_framework_paths <- getPackageFrameworkPath dflags dep_packages
let pkg_framework_path_opts = map ("-F"++) pkg_framework_paths
- framework_paths <- readIORef v_Framework_paths
- let framework_path_opts = map ("-F"++) framework_paths
+ let framework_paths = frameworkPaths dflags
+ framework_path_opts = map ("-F"++) framework_paths
pkg_frameworks <- getPackageFrameworks dflags dep_packages
let pkg_framework_opts = concat [ ["-framework", fw] | fw <- pkg_frameworks ]
- frameworks <- readIORef v_Cmdline_frameworks
- let framework_opts = concat [ ["-framework", fw] | fw <- reverse frameworks ]
+
+ let frameworks = cmdlineFrameworks dflags
+ framework_opts = concat [ ["-framework", fw] | fw <- reverse frameworks ]
-- reverse because they're added in reverse order from the cmd line
#endif