From: Simon Marlow Date: Mon, 7 May 2007 13:42:35 +0000 (+0000) Subject: add defaultObjectTarget to the GHC API X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=17b7cf1a851f16ca8922a9f0061808e4f3b4bd0e;p=ghc-hetmet.git add defaultObjectTarget to the GHC API We had no way of getting the right value of HscTarget to use to request object files as output. --- diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 046e2b2..e5153ea 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -17,7 +17,7 @@ module DynFlags ( -- Dynamic flags DynFlag(..), DynFlags(..), - HscTarget(..), isObjectTarget, + HscTarget(..), isObjectTarget, defaultObjectTarget, GhcMode(..), isOneShot, GhcLink(..), isNoLink, PackageFlag(..), @@ -366,7 +366,11 @@ data PackageFlag | IgnorePackage String deriving Eq -defaultHscTarget +defaultHscTarget = defaultObjectTarget + +-- | the 'HscTarget' value corresponding to the default way to create +-- object files on the current platform. +defaultObjectTarget | cGhcWithNativeCodeGen == "YES" = HscAsm | otherwise = HscC diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index af1a817..a850650 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -15,7 +15,7 @@ module GHC ( -- * Flags and settings DynFlags(..), DynFlag(..), Severity(..), HscTarget(..), dopt, - GhcMode(..), GhcLink(..), + GhcMode(..), GhcLink(..), defaultObjectTarget, parseDynamicFlags, getSessionDynFlags, setSessionDynFlags,