[project @ 2000-06-20 10:24:39 by simonmar]
authorsimonmar <unknown>
Tue, 20 Jun 2000 10:24:39 +0000 (10:24 +0000)
committersimonmar <unknown>
Tue, 20 Jun 2000 10:24:39 +0000 (10:24 +0000)
- fix -optCrts (was being overriden by -optC)
- fix -osuf with -split-objs
- fix -odir

ghc/driver/Main.hs

index 1603a36..f71ca92 100644 (file)
@@ -268,14 +268,14 @@ odir_ify f = do
   odir_opt <- readIORef output_dir
   case odir_opt of
        Nothing -> return f
-       Just d  -> return (newdir f d)
+       Just d  -> return (newdir d f)
 
 osuf_ify :: String -> IO String
 osuf_ify f = do
   osuf_opt <- readIORef output_suf
   case osuf_opt of
        Nothing -> return f
-       Just s  -> return (newsuf f s)
+       Just s  -> return (newsuf s f)
 
 -----------------------------------------------------------------------------
 -- Hi Files
@@ -1499,19 +1499,20 @@ run_phase SplitAs basename input_fn output_fn
        
        split_s_prefix <- readIORef split_prefix
        n <- readIORef n_split_files
-       
+
        odir <- readIORef output_dir
        let real_odir = case odir of
                                Nothing -> basename
                                Just d  -> d
-       
+
        let assemble_file n = do
                    let input_s  = split_s_prefix ++ "__" ++ show n ++ ".s"
                    let output_o = newdir real_odir 
                                        (basename ++ "__" ++ show n ++ ".o")
+                   real_o <- osuf_ify output_o
                    run_something "Assembler" 
                            (unwords (as : as_opts
-                                     ++ [ "-c", "-o ", output_o, input_s ]
+                                     ++ [ "-c", "-o", real_o, input_s ]
                            ))
        
        mapM_ assemble_file [1..n]
@@ -1597,6 +1598,10 @@ data OptKind
        | AnySuffix (String -> IO ())   -- flag is a prefix, pass whole arg to fn
        | PassFlag  (String -> IO ())   -- flag with no arg, pass flag to fn
 
+-- note that ordering is important in the following list: any flag which
+-- is a prefix flag (i.e. HasArg, Prefix, OptPrefix, AnySuffix) will override
+-- flags further down the list with the same prefix.
+
 opts = 
   [  ------- help -------------------------------------------------------
      ( "?"             , NoArg long_usage)
@@ -1701,8 +1706,8 @@ opts =
   ,  ( "optdep"                , HasArg (add opt_dep) )
   ,  ( "optL"          , HasArg (add opt_L) )
   ,  ( "optP"          , HasArg (add opt_P) )
-  ,  ( "optC"          , HasArg (add opt_C) )
   ,  ( "optCrts"        , HasArg (add opt_Crts) )
+  ,  ( "optC"          , HasArg (add opt_C) )
   ,  ( "optc"          , HasArg (add opt_c) )
   ,  ( "optm"          , HasArg (add opt_m) )
   ,  ( "opta"          , HasArg (add opt_a) )