{-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
-----------------------------------------------------------------------------
{-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- with path so that ghc -M can find config.h
-----------------------------------------------------------------------------
-- with path so that ghc -M can find config.h
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
)
dynamic_flags, processArgs, static_flags)
import DriverMkDepend ( beginMkDependHS, endMkDependHS )
dynamic_flags, processArgs, static_flags)
import DriverMkDepend ( beginMkDependHS, endMkDependHS )
import DriverUtil ( add, handle, handleDyn, later, unknownFlagsErr )
import CmdLineOpts ( dynFlag, restoreDynFlags,
import DriverUtil ( add, handle, handleDyn, later, unknownFlagsErr )
import CmdLineOpts ( dynFlag, restoreDynFlags,
-- 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).
stg_todo <- buildStgToDo
-- set the "global" HscLang. The HscLang can be further adjusted on a module
-- by module basis, using only the -fvia-C and -fasm flags. If the global
-- HscLang is not HscC or HscAsm, -fvia-C and -fasm have no effect.
dyn_flags <- getDynFlags
stg_todo <- buildStgToDo
-- set the "global" HscLang. The HscLang can be further adjusted on a module
-- by module basis, using only the -fvia-C and -fasm flags. If the global
-- HscLang is not HscC or HscAsm, -fvia-C and -fasm have no effect.
dyn_flags <- getDynFlags
- _other | build_tag /= "" -> HscC
- | otherwise -> hscLang dyn_flags
- -- for ways other that the normal way, we must
- -- compile via C.
+ DoEval _ -> HscInterpreted
+ _other -> hscLang dyn_flags
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",
Everything else is considered to be a linker object, and passed
straight through to the linker.
-}
Everything else is considered to be a linker object, and passed
straight through to the linker.
-}
normal_fileish_paths = map normalisePath fileish_args
(srcs, objs) = partition looks_like_an_input normal_fileish_paths
normal_fileish_paths = map normalisePath fileish_args
(srcs, objs) = partition looks_like_an_input normal_fileish_paths
---------------- Display banners and configuration -----------
showBanners mode conf_file static_opts
---------------- Display banners and configuration -----------
showBanners mode conf_file static_opts
+ -- 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