import qualified GHC
import GHC ( Session, ModSummary(..) )
import DynFlags ( DynFlags( verbosity, opt_dep ), getOpts )
-import Util ( escapeSpaces, splitFilename )
+import Util ( escapeSpaces, splitFilename, joinFileExt )
import HscTypes ( HscEnv, IsBootInterface, msObjFilePath, msHsFilePath )
import Packages ( PackageIdH(..) )
import SysTools ( newTempName )
import Util ( global, consIORef )
import Outputable
import Panic
+import SrcLoc ( unLoc )
import CmdLineParser
import DATA_IOREF ( IORef, readIORef, writeIORef )
#if __GLASGOW_HASKELL__ <= 408
import Panic ( catchJust, ioErrors )
#endif
+import ErrUtils ( debugTraceMsg )
-----------------------------------------------------------------
--
; files <- beginMkDependHS dflags
-- Do the downsweep to find all the modules
- ; targets <- mapM GHC.guessTarget srcs
+ ; targets <- mapM (\s -> GHC.guessTarget s Nothing) srcs
; GHC.setTargets session targets
; excl_mods <- readIORef v_Dep_exclude_mods
; GHC.depanal session excl_mods
-- Sort into dependency order
-- There should be no cycles
- ; let sorted = GHC.topSortModuleGraph False mod_summaries
+ ; let sorted = GHC.topSortModuleGraph False mod_summaries Nothing
-- Print out the dependencies if wanted
- ; if verbosity dflags >= 2 then
- hPutStrLn stderr (showSDoc (text "Module dependencies" $$ ppr sorted))
- else return ()
+ ; debugTraceMsg dflags 2 (showSDoc (text "Module dependencies" $$ ppr sorted))
-- Prcess them one by one, dumping results into makefile
-- and complaining about cycles
; writeDependency hdl obj_files src_file
-- Emit a dependency for each import
- ; mapM_ (do_imp True) (ms_srcimps node) -- SOURCE imports
- ; mapM_ (do_imp False) (ms_imps node) -- regular imports
+ ; mapM_ (do_imp True . unLoc) (ms_srcimps node) -- SOURCE imports
+ ; mapM_ (do_imp False . unLoc) (ms_imps node) -- regular imports
}
-- Lots of other things will break first!
insertSuffixes file_name extras
- = file_name : [ basename ++ "." ++ extra ++ "_" ++ suffix | extra <- extras ]
+ = file_name : [ basename `joinFileExt` (extra ++ "_" ++ suffix) | extra <- extras ]
where
(basename, suffix) = splitFilename file_name