diff options
author | Ian Lynagh <ian@well-typed.com> | 2012-08-28 23:22:28 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2012-08-28 23:22:28 +0100 |
commit | 350b5c4e1915ae0cc61a0c4c4315917b15166303 (patch) | |
tree | a0e06a9c39d1d5a8c968569843a094d2442dd420 /compiler | |
parent | a94b80b1b1fa8a24f52a33bb38d1975e52a4037a (diff) | |
download | haskell-350b5c4e1915ae0cc61a0c4c4315917b15166303.tar.gz |
Remove some CPP from compiler/ghci/Linker.lhs
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ghci/Linker.lhs | 5 | ||||
-rw-r--r-- | compiler/main/DriverPhases.hs | 41 |
2 files changed, 23 insertions, 23 deletions
diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs index 43bb59d132..7a5ca901bc 100644 --- a/compiler/ghci/Linker.lhs +++ b/compiler/ghci/Linker.lhs @@ -355,12 +355,13 @@ users? classifyLdInput :: DynFlags -> FilePath -> IO (Maybe LibrarySpec) classifyLdInput dflags f - | isObjectFilename f = return (Just (Object f)) - | isDynLibFilename f = return (Just (DLLPath f)) + | isObjectFilename platform f = return (Just (Object f)) + | isDynLibFilename platform f = return (Just (DLLPath f)) | otherwise = do log_action dflags dflags SevInfo noSrcSpan defaultUserStyle (text ("Warning: ignoring unrecognised input `" ++ f ++ "'")) return Nothing + where platform = targetPlatform dflags preloadLib :: DynFlags -> [String] -> [String] -> LibrarySpec -> IO () preloadLib dflags lib_paths framework_paths lib_spec diff --git a/compiler/main/DriverPhases.hs b/compiler/main/DriverPhases.hs index 29dbb58413..a1eac536b6 100644 --- a/compiler/main/DriverPhases.hs +++ b/compiler/main/DriverPhases.hs @@ -36,6 +36,7 @@ module DriverPhases ( #include "HsVersions.h" import Outputable +import Platform import System.FilePath ----------------------------------------------------------------------------- @@ -228,49 +229,47 @@ extcoreish_suffixes = [ "hcr" ] -- Will not be deleted as temp files: haskellish_user_src_suffixes = [ "hs", "lhs", "hs-boot", "lhs-boot" ] -objish_suffixes :: [String] +objish_suffixes :: Platform -> [String] -- Use the appropriate suffix for the system on which -- the GHC-compiled code will run -#if mingw32_TARGET_OS || cygwin32_TARGET_OS -objish_suffixes = [ "o", "O", "obj", "OBJ" ] -#else -objish_suffixes = [ "o" ] -#endif +objish_suffixes platform = case platformOS platform of + OSMinGW32 -> [ "o", "O", "obj", "OBJ" ] + _ -> [ "o" ] -dynlib_suffixes :: [String] -#ifdef mingw32_TARGET_OS -dynlib_suffixes = ["dll", "DLL"] -#elif defined(darwin_TARGET_OS) -dynlib_suffixes = ["dylib"] -#else -dynlib_suffixes = ["so"] -#endif +dynlib_suffixes :: Platform -> [String] +dynlib_suffixes platform = case platformOS platform of + OSMinGW32 -> ["dll", "DLL"] + OSDarwin -> ["dylib"] + _ -> ["so"] isHaskellishSuffix, isHaskellSrcSuffix, isCishSuffix, isExtCoreSuffix, - isObjectSuffix, isHaskellUserSrcSuffix, isDynLibSuffix + isHaskellUserSrcSuffix :: String -> Bool isHaskellishSuffix s = s `elem` haskellish_suffixes isHaskellSrcSuffix s = s `elem` haskellish_src_suffixes isCishSuffix s = s `elem` cish_suffixes isExtCoreSuffix s = s `elem` extcoreish_suffixes -isObjectSuffix s = s `elem` objish_suffixes isHaskellUserSrcSuffix s = s `elem` haskellish_user_src_suffixes -isDynLibSuffix s = s `elem` dynlib_suffixes + +isObjectSuffix, isDynLibSuffix :: Platform -> String -> Bool +isObjectSuffix platform s = s `elem` objish_suffixes platform +isDynLibSuffix platform s = s `elem` dynlib_suffixes platform isSourceSuffix :: String -> Bool isSourceSuffix suff = isHaskellishSuffix suff || isCishSuffix suff isHaskellishFilename, isHaskellSrcFilename, isCishFilename, - isExtCoreFilename, isObjectFilename, isHaskellUserSrcFilename, - isDynLibFilename, isSourceFilename + isExtCoreFilename, isHaskellUserSrcFilename, isSourceFilename :: FilePath -> Bool -- takeExtension return .foo, so we drop 1 to get rid of the . isHaskellishFilename f = isHaskellishSuffix (drop 1 $ takeExtension f) isHaskellSrcFilename f = isHaskellSrcSuffix (drop 1 $ takeExtension f) isCishFilename f = isCishSuffix (drop 1 $ takeExtension f) isExtCoreFilename f = isExtCoreSuffix (drop 1 $ takeExtension f) -isObjectFilename f = isObjectSuffix (drop 1 $ takeExtension f) isHaskellUserSrcFilename f = isHaskellUserSrcSuffix (drop 1 $ takeExtension f) -isDynLibFilename f = isDynLibSuffix (drop 1 $ takeExtension f) isSourceFilename f = isSourceSuffix (drop 1 $ takeExtension f) +isObjectFilename, isDynLibFilename :: Platform -> FilePath -> Bool +isObjectFilename platform f = isObjectSuffix platform (drop 1 $ takeExtension f) +isDynLibFilename platform f = isDynLibSuffix platform (drop 1 $ takeExtension f) + |