[project @ 2005-01-28 12:55:17 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / DriverPipeline.hs
index 5eb3f24..84b7a69 100644 (file)
@@ -188,8 +188,8 @@ compile hsc_env mod_summary
                                extCoreName = basename ++ ".hcr" }
 
    -- -no-recomp should also work with --make
-   do_recomp <- readIORef v_Recomp
-   let source_unchanged' = source_unchanged && do_recomp
+   let do_recomp = recompFlag dyn_flags
+       source_unchanged' = source_unchanged && do_recomp
        hsc_env' = hsc_env { hsc_dflags = dyn_flags' }
 
    -- run the compiler
@@ -657,7 +657,7 @@ runPhase (Hsc src_flavour) todo dflags basename suff input_fn get_output_fn _may
   -- changed (which the compiler itself figures out).
   -- Setting source_unchanged to False tells the compiler that M.o is out of
   -- date wrt M.hs (or M.o doesn't exist) so we must recompile regardless.
-       do_recomp <- readIORef v_Recomp
+       let do_recomp = recompFlag dflags
        source_unchanged <- 
           if not (do_recomp && case todo of { DoLink -> True; other -> False })
             then return False
@@ -816,10 +816,12 @@ runPhase cc_phase todo dflags basename suff input_fn get_output_fn maybe_loc
 
 runPhase Mangle todo dflags _basename _suff input_fn get_output_fn maybe_loc
    = do let mangler_opts = getOpts dflags opt_m
-        machdep_opts <- if (prefixMatch "i386" cTARGETPLATFORM)
-                         then do let n_regs = stolen_x86_regs dflags
-                                 return [ show n_regs ]
-                         else return []
+
+#if i386_TARGET_ARCH
+        machdep_opts <- return [ show (stolen_x86_regs dflags) ]
+#else
+       machdep_opts <- return []
+#endif
 
        split <- readIORef v_Split_object_files
        let next_phase
@@ -1253,8 +1255,12 @@ doCpp dflags raw include_cc_opts input_fn output_fn = do
                      | otherwise = SysTools.runCc dflags (SysTools.Option "-E" : args)
 
     let target_defs = 
-         [ "-D" ++ cTARGETOS   ++ "_TARGET_OS=1",
-           "-D" ++ cTARGETARCH ++ "_TARGET_ARCH=1" ]
+         [ "-D" ++ HOST_OS     ++ "BUILD_OS=1",
+           "-D" ++ HOST_ARCH   ++ "BUILD_ARCH=1",
+           "-D" ++ TARGET_OS   ++ "HOST_OS=1",
+           "-D" ++ TARGET_ARCH ++ "HOST_ARCH=1" ]
+       -- remember, in code we *compile*, the HOST is the same our TARGET,
+       -- and BUILD is the same as our HOST.
 
     cpp_prog       ([SysTools.Option verb]
                    ++ map SysTools.Option include_paths