[project @ 2002-09-06 14:35:42 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / DriverPipeline.hs
index b567817..bc75ba7 100644 (file)
@@ -48,20 +48,18 @@ import Maybes               ( expectJust )
 
 import ParserCoreUtils ( getCoreModuleName )
 
+import EXCEPTION
+import DATA_IOREF      ( readIORef, writeIORef )
+
 #ifdef GHCI
 import Time            ( getClockTime )
 #endif
 import Directory
 import System
-import IOExts
-import Exception
-
 import IO
 import Monad
 import Maybe
 
-import PackedString
-
 -----------------------------------------------------------------------------
 -- genPipeline
 --
@@ -155,11 +153,6 @@ genPipeline todo stop_flag persistent_output lang (filename,suffix)
                | split           -> not_valid
                | otherwise       -> [ Hsc, HCc, As ]
 
-       HscCore | split && mangle -> [ Hsc, HCc, Mangle, SplitMangle, SplitAs ]
-               | mangle          -> [ Hsc, HCc, Mangle, As ]
-               | split           -> not_valid
-               | otherwise       -> [ Hsc, HCc, As ]
-
        HscAsm  | split           -> [ Hsc, SplitMangle, SplitAs ]
                | otherwise       -> [ Hsc, As ]
 
@@ -401,12 +394,9 @@ run_phase Cpp basename suff input_fn output_fn
 
 -------------------------------------------------------------------------------
 -- HsPp phase 
-run_phase HsPp basename suff input_fn output_fn
-  = do src_opts <- getOptionsFromSource input_fn
-       unhandled_flags <- processArgs dynamic_flags src_opts []
-       checkProcessArgsResult unhandled_flags basename suff
 
-       let orig_fn = basename ++ '.':suff
+run_phase HsPp basename suff input_fn output_fn
+  = do let orig_fn = basename ++ '.':suff
        do_pp   <- dynFlag ppFlag
        if not do_pp then
            -- no need to preprocess, just pass input file along
@@ -903,6 +893,21 @@ doLink o_files = do
     let lib_opts = map ("-l"++) (reverse libs)
         -- reverse because they're added in reverse order from the cmd line
 
+#ifdef darwin_TARGET_OS
+    pkg_framework_paths <- getPackageFrameworkPath
+    let pkg_framework_path_opts = map ("-F"++) pkg_framework_paths
+
+    framework_paths <- readIORef v_Framework_paths
+    let framework_path_opts = map ("-F"++) framework_paths
+
+    pkg_frameworks <- getPackageFrameworks
+    let pkg_framework_opts = map ("-framework " ++) pkg_frameworks
+
+    frameworks <- readIORef v_Cmdline_frameworks
+    let framework_opts = map ("-framework "++) (reverse frameworks)
+        -- reverse because they're added in reverse order from the cmd line
+#endif
+
     pkg_extra_ld_opts <- getPackageExtraLdOpts
 
        -- probably _stub.o files
@@ -930,8 +935,16 @@ doLink o_files = do
                      ++ extra_ld_inputs
                      ++ lib_path_opts
                      ++ lib_opts
+#ifdef darwin_TARGET_OS
+                     ++ framework_path_opts
+                     ++ framework_opts
+#endif
                      ++ pkg_lib_path_opts
                      ++ pkg_lib_opts
+#ifdef darwin_TARGET_OS
+                     ++ pkg_framework_path_opts
+                     ++ pkg_framework_opts
+#endif
                      ++ pkg_extra_ld_opts
                      ++ extra_ld_opts
                      ++ if static && not no_hs_main then