+ -- Always link in the haskell98 package for static linking. Other
+ -- packages have to be specified via the -package flag.
+ let link_pkgs
+ | ExtPackage h98_id <- haskell98PackageId (pkgState dflags) = [h98_id]
+ | otherwise = []
+
+ case mode of
+ DoMake -> doMake dflags srcs
+ DoMkDependHS -> doMkDependHS dflags srcs
+ StopBefore p -> do { compileFiles mode dflags srcs; return () }
+ DoMkDLL -> do { o_files <- compileFiles mode dflags srcs;
+ doMkDLL dflags o_files link_pkgs }
+ DoLink -> do { o_files <- compileFiles mode dflags srcs;
+ omit_linking <- readIORef v_NoLink;
+ when (not omit_linking)
+ (staticLink dflags o_files link_pkgs) }
+
+#ifndef GHCI
+ DoInteractive -> noInteractiveError
+ DoEval _ -> noInteractiveError
+ where
+ noInteractiveError = throwDyn (CmdLineError "not built for interactive use")
+#else
+ DoInteractive -> interactiveUI dflags srcs Nothing
+ DoEval expr -> interactiveUI dflags srcs (Just expr)
+#endif
+
+-- -----------------------------------------------------------------------------
+-- Option sanity checks
+
+checkOptions :: GhcMode -> [String] -> [String] -> IO ()
+ -- Final sanity checking before kicking off a compilation (pipeline).
+checkOptions mode srcs objs = do
+ -- Complain about any unknown flags
+ let unknown_opts = [ f | f@('-':_) <- srcs ]
+ when (notNull unknown_opts) (unknownFlagsErr unknown_opts)
+
+ -- -ohi sanity check
+ ohi <- readIORef v_Output_hi