From: simonmar Date: Tue, 27 Feb 2001 15:25:18 +0000 (+0000) Subject: [project @ 2001-02-27 15:25:18 by simonmar] X-Git-Tag: Approximately_9120_patches~2529 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=8a097699a0fe3493286391cb9d59208f2cf0733f;p=ghc-hetmet.git [project @ 2001-02-27 15:25:18 by simonmar] - clean up recognising of objects on the ghci command line - recognise objects on the ghc --make command line, and link them in (untested) --- diff --git a/ghc/compiler/main/DriverPhases.hs b/ghc/compiler/main/DriverPhases.hs index 3a7053f..bd1b176 100644 --- a/ghc/compiler/main/DriverPhases.hs +++ b/ghc/compiler/main/DriverPhases.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverPhases.hs,v 1.5 2001/02/27 12:36:37 rrt Exp $ +-- $Id: DriverPhases.hs,v 1.6 2001/02/27 15:25:18 simonmar Exp $ -- -- GHC Driver -- @@ -12,10 +12,9 @@ module DriverPhases ( startPhase, -- :: String -> Phase phaseInputExt, -- :: Phase -> String - haskellish_file, - haskellish_suffix, - cish_file, - cish_suffix + haskellish_file, haskellish_suffix, + objish_file, objish_suffix, + cish_file, cish_suffix ) where import DriverUtil @@ -85,6 +84,12 @@ phaseInputExt MkDependHS = "dep" haskellish_suffix = (`elem` [ "hs", "hspp", "lhs", "hc" ]) cish_suffix = (`elem` [ "c", "s", "S" ]) -- maybe .cc et al.?? -haskellish_file f = haskellish_suffix suf where (_,suf) = splitFilename f -cish_file f = cish_suffix suf where (_,suf) = splitFilename f +#if mingw32_TARGET_OS || cygwin32_TARGET_OS +objish_suffix = (`elem` [ "o", "O", "obj", "OBJ" ]) +#else +objish_suffix = (`elem` [ "o" ]) +#endif +haskellish_file f = haskellish_suffix suf where (_,suf) = splitFilename f +cish_file f = cish_suffix suf where (_,suf) = splitFilename f +objish_file f = objish_suffix suf where (_,suf) = splitFilename f diff --git a/ghc/compiler/main/Main.hs b/ghc/compiler/main/Main.hs index 9ebd0d7..a5b094f 100644 --- a/ghc/compiler/main/Main.hs +++ b/ghc/compiler/main/Main.hs @@ -1,6 +1,6 @@ {-# OPTIONS -fno-warn-incomplete-patterns #-} ----------------------------------------------------------------------------- --- $Id: Main.hs,v 1.55 2001/02/27 12:36:37 rrt Exp $ +-- $Id: Main.hs,v 1.56 2001/02/27 15:25:18 simonmar Exp $ -- -- GHC Driver program -- @@ -32,7 +32,7 @@ import DriverFlags import DriverMkDepend import DriverUtil import Panic -import DriverPhases ( Phase(..), haskellish_file ) +import DriverPhases ( Phase(..), haskellish_file, objish_file ) import CmdLineOpts import TmpFiles import Finder ( initFinder ) @@ -49,7 +49,6 @@ import Exception import IO import Monad import List -import Char ( toLower ) import System import Maybe @@ -309,8 +308,11 @@ setTopDir args = do return others beginMake :: [String] -> IO () -beginMake mods - = do case mods of +beginMake fileish_args + = do let (objs, mods) = partition objish_file fileish_args + mapM (add v_Ld_inputs) objs + + case mods of [] -> throwDyn (UsageError "no input files") [mod] -> do state <- cmInit Batch cmLoadModule state mod @@ -324,17 +326,14 @@ beginInteractive = throwDyn (OtherError "not built for interactive use") #else beginInteractive fileish_args = do minus_ls <- readIORef v_Cmdline_libraries - let is_libraryish nm - = let nmr = map toLower (reverse nm) - in take 2 nmr == "o." - libs = map Left (filter is_libraryish fileish_args) - ++ map Right minus_ls - mods = filter (not.is_libraryish) fileish_args - mod = case mods of - [] -> Nothing - [mod] -> Just mod - _ -> throwDyn (UsageError - "only one module allowed with --interactive") + + let (objs, mods) = partition objish_file fileish_args + libs = map Left objs ++ map Right minus_ls + state <- cmInit Interactive - interactiveUI state mod libs + case mods of + [] -> interactiveUI state Nothing libs + [mod] -> interactiveUI state (Just mod) libs + _ -> throwDyn (UsageError + "only one module allowed with --interactive") #endif