{-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
-----------------------------------------------------------------------------
{-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
-----------------------------------------------------------------------------
findBuildTag,
getPackageExtraGhcOpts, unregFlags,
v_GhcMode, v_GhcModeFlag, GhcMode(..),
v_Keep_tmp_files, v_Ld_inputs, v_Ways,
findBuildTag,
getPackageExtraGhcOpts, unregFlags,
v_GhcMode, v_GhcModeFlag, GhcMode(..),
v_Keep_tmp_files, v_Ld_inputs, v_Ways,
readPackageConf, verifyOutputFiles, v_NoLink,
v_Build_tag
)
readPackageConf, verifyOutputFiles, v_NoLink,
v_Build_tag
)
-- build the default DynFlags (these may be adjusted on a per
-- module basis by OPTIONS pragmas and settings in the interpreter).
-- build the default DynFlags (these may be adjusted on a per
-- module basis by OPTIONS pragmas and settings in the interpreter).
_other | build_tag /= "" -> HscC
| otherwise -> hscLang dyn_flags
-- for ways other that the normal way, we must
-- compile via C.
_other | build_tag /= "" -> HscC
| otherwise -> hscLang dyn_flags
-- for ways other that the normal way, we must
-- compile via C.
hscLang = lang,
-- leave out hscOutName for now
hscOutName = panic "Main.main:hscOutName not set",
hscLang = lang,
-- leave out hscOutName for now
hscOutName = panic "Main.main:hscOutName not set",
+ -- We always link in the base package in
+ -- one-shot linking. Any other packages
+ -- required must be given using -package
+ -- options on the command-line.
+ let def_hs_pkgs = [basePackage, haskell98Package]
+
endMkDependHS }
StopBefore p -> do { compileFiles mode srcs; return () }
DoMkDLL -> do { o_files <- compileFiles mode srcs;
endMkDependHS }
StopBefore p -> do { compileFiles mode srcs; return () }
DoMkDLL -> do { o_files <- compileFiles mode srcs;
- (staticLink o_files
- [basePackage, haskell98Package]) }
- -- We always link in the base package in
- -- one-shot linking. Any other packages
- -- required must be given using -package
- -- options on the command-line.
+ (staticLink o_files def_hs_pkgs) }
- DoInteractive -> throwDyn (CmdLineError "not built for interactive use")
+ DoInteractive -> noInteractiveError
+ DoEval _ -> noInteractiveError
+ where
+ noInteractiveError = throwDyn (CmdLineError "not built for interactive use")
checkOptions :: GhcMode -> [String] -> [String] -> IO ()
-- Final sanity checking before kicking off a compilation (pipeline).
checkOptions mode srcs objs = do
checkOptions :: GhcMode -> [String] -> [String] -> IO ()
-- Final sanity checking before kicking off a compilation (pipeline).
checkOptions mode srcs objs = do
-- -----------------------------------------------------------------------------
-- Compile files in one-shot mode.
-- -----------------------------------------------------------------------------
-- Compile files in one-shot mode.
- state <- cmInit Batch
- graph <- cmDepAnal state dflags srcs
- (_, ok_flag, _) <- cmLoadModules state dflags graph
+ state <- cmInit Batch dflags
+ graph <- cmDepAnal state srcs
+ (_, ok_flag, _) <- cmLoadModules state graph