X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FDriverMkDepend.hs;h=80d906c4a7c0e8b0c91ca2e94029238f877658aa;hb=1187e57fab2b5904a808ac973e5d04b91f880920;hp=f161d6408740d010dc1af72ba0666bd0df708e47;hpb=fb3a22d8d261e67742f92bf26861080ad9b774e9;p=ghc-hetmet.git diff --git a/ghc/compiler/main/DriverMkDepend.hs b/ghc/compiler/main/DriverMkDepend.hs index f161d64..80d906c 100644 --- a/ghc/compiler/main/DriverMkDepend.hs +++ b/ghc/compiler/main/DriverMkDepend.hs @@ -20,7 +20,7 @@ import HscTypes ( HscEnv, IsBootInterface, msObjFilePath, msHsFilePath ) import Packages ( PackageIdH(..) ) import SysTools ( newTempName ) import qualified SysTools -import Module ( Module, ModLocation(..), mkModule, moduleUserString, +import Module ( Module, ModLocation(..), mkModule, addBootSuffix_maybe ) import Digraph ( SCC(..) ) import Finder ( findModule, FindResult(..) ) @@ -30,19 +30,20 @@ import Panic import SrcLoc ( unLoc ) import CmdLineParser +#if __GLASGOW_HASKELL__ <= 408 +import Panic ( catchJust, ioErrors ) +#endif +import ErrUtils ( debugTraceMsg, printErrorsAndWarnings ) + import DATA_IOREF ( IORef, readIORef, writeIORef ) import EXCEPTION +import System ( ExitCode(..), exitWith ) import Directory import IO import Monad ( when ) import Maybe ( isJust ) -#if __GLASGOW_HASKELL__ <= 408 -import Panic ( catchJust, ioErrors ) -#endif -import ErrUtils ( debugTraceMsg ) - ----------------------------------------------------------------- -- -- The main function @@ -59,22 +60,24 @@ doMkDependHS session 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 - ; mod_summaries <- GHC.getModuleGraph session + ; r <- GHC.depanal session excl_mods True {- Allow dup roots -} + ; case r of + Nothing -> exitWith (ExitFailure 1) + Just mod_summaries -> do { -- Sort into dependency order -- There should be no cycles - ; let sorted = GHC.topSortModuleGraph False mod_summaries Nothing + let sorted = GHC.topSortModuleGraph False mod_summaries Nothing -- Print out the dependencies if wanted - ; debugTraceMsg dflags 2 (showSDoc (text "Module dependencies" $$ ppr sorted)) - + ; debugTraceMsg dflags 2 (text "Module dependencies" $$ ppr sorted) + -- Prcess them one by one, dumping results into makefile -- and complaining about cycles ; mapM (processDeps session excl_mods (mkd_tmp_hdl files)) sorted -- Tidy up - ; endMkDependHS dflags files } + ; endMkDependHS dflags files }} ----------------------------------------------------------------- --