import DriverPipeline ( CompResult(..), preprocess, compile, link )
import HscMain ( newHscEnv )
-import DriverState ( v_Output_file, v_NoHsMain )
+import DriverState ( v_Output_file, v_NoHsMain, v_MainModIs )
import DriverPhases
import Finder
import HscTypes
let verb = verbosity dflags
-- Find out if we have a Main module
- let a_root_is_Main
- = any ((=="Main").moduleNameUserString.modSummaryName)
+ mb_main_mod <- readIORef v_MainModIs
+ let
+ main_mod = mb_main_mod `orElse` "Main"
+ a_root_is_Main
+ = any ((==main_mod).moduleNameUserString.modSummaryName)
mg2unsorted
let mg2unsorted_names = map modSummaryName mg2unsorted
let do_linking = a_root_is_Main || no_hs_main
when (ghci_mode == Batch && isJust ofile && not do_linking
&& verb > 0) $
- hPutStrLn stderr "Warning: output was redirected with -o, but no output will be generated\nbecause there is no Main module."
+ hPutStrLn stderr ("Warning: output was redirected with -o, but no output will be generated\nbecause there is no " ++ main_mod ++ " module.")
-- link everything together
linkresult <- link ghci_mode dflags do_linking (hsc_HPT hsc_env3)