[project @ 2003-09-23 14:32:57 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / DriverPipeline.hs
index 24c804e..87977cb 100644 (file)
@@ -191,10 +191,6 @@ compile ghci_mode this_mod location
                -- we're in batch mode: finish the compilation pipeline.
                _other -> do
                   let object_filename = ml_obj_file location
-                      object_dir = directoryOf object_filename
-
-                  -- create the object dir if it doesn't exist
-                  createDirectoryHierarchy object_dir
 
                   runPipeline (StopBefore Ln) ""
                        True Nothing output_fn (Just location)
@@ -576,7 +572,7 @@ runPhase Hsc basename suff input_fn get_output_fn _maybe_loc = do
               getImportsFromFile input_fn
 
   -- build a ModLocation to pass to hscMain.
-       (mod, location') <- mkHomeModLocation mod_name "." basename suff
+       (mod, location') <- mkHomeModLocation mod_name (basename ++ '.':suff)
 
   -- take -ohi into account if present
        ohi <- readIORef v_Output_hi
@@ -694,10 +690,6 @@ runPhase cc_phase basename suff input_fn get_output_fn maybe_loc
 
         verb <- getVerbFlag
 
-       o2 <- readIORef v_minus_o2_for_C
-       let opt_flag | o2        = "-O2"
-                    | otherwise = "-O"
-
        pkg_extra_cc_opts <- getPackageExtraCcOpts pkgs
 
        split_objs <- readIORef v_Split_object_files
@@ -722,7 +714,7 @@ runPhase cc_phase basename suff input_fn get_output_fn maybe_loc
                       ++ (if cc_phase == HCc && mangle
                             then md_regd_c_flags
                             else [])
-                      ++ [ verb, "-S", "-Wimplicit", opt_flag ]
+                      ++ [ verb, "-S", "-Wimplicit", "-O" ]
                       ++ [ "-D__GLASGOW_HASKELL__="++cProjectVersionInt ]
                       ++ cc_opts
                       ++ split_opt
@@ -794,6 +786,10 @@ runPhase As _basename _suff input_fn get_output_fn maybe_loc
 
        output_fn <- get_output_fn Ln maybe_loc
 
+       -- we create directories for the object file, because it
+       -- might be a hierarchical module.
+       createDirectoryHierarchy (directoryOf output_fn)
+
        SysTools.runAs (map SysTools.Option as_opts
                       ++ [ SysTools.Option ("-I" ++ p) | p <- cmdline_include_paths ]
                       ++ [ SysTools.Option "-c"
@@ -1054,9 +1050,7 @@ staticLink o_files dep_packages = do
                      ++ pkg_framework_path_opts
                      ++ pkg_framework_opts
 #endif
-                     ++ if static && not no_hs_main then
-                           [ "-u", prefixUnderscore "Main_zdmain_closure"] 
-                        else []))
+                   ))
 
     -- parallel only: move binary to another dir -- HWL
     ways_ <- readIORef v_Ways