shake-ext 2.11.0.0 → 2.11.0.1
raw patch · 2 files changed
+8/−18 lines, 2 filesdep +cdeps
Dependencies added: cdeps
Files
- shake-ext.cabal +2/−2
- src/Development/Shake/C.hs +6/−16
shake-ext.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: shake-ext-version: 2.11.0.0+version: 2.11.0.1 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2018 Vanessa McHale@@ -45,6 +45,7 @@ build-depends: base >=4.11 && <5, Cabal >=2.2,+ cdeps, composition-prelude -any, cpphs -any, directory -any,@@ -56,4 +57,3 @@ if impl(ghc >=8.0) ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates- -Wcompat
src/Development/Shake/C.hs view
@@ -18,11 +18,12 @@ , staticLibA , sharedLibA , stripA+ -- * Reëxports from "Language.C.Dependency"+ , getCDepends -- * Helper functions , cconfigToArgs , ccToString , ccFromString- , getCDepends , host ) where @@ -30,11 +31,9 @@ import Data.List (isPrefixOf, isSuffixOf) import Development.Shake import Development.Shake.FilePath-import System.Directory (removeFile)+import Language.C.Dependency import System.Info --- cmake?? make (??)- -- | Given a package name or path to a @.pc@ file, output flags for C compiler. pkgConfig :: String -> Action [String] pkgConfig pkg = do@@ -42,18 +41,6 @@ (Stdout o') <- command [] "pkg-config" ["--libs", pkg] pure (words o <> words o') --- | Given C source code, return a list of included files. This writes to a file--- and then makes a call to either @clang@ or @gcc@, so it should be used--- sparingly.-getCDepends :: CCompiler -- ^ Should be either @gcc@ or @clang@.- -> String -- ^ C source code- -> Action [FilePath]-getCDepends cc' src = do- liftIO $ writeFile "shake.c" src- (Stdout o) <- command [] (ccToString cc') ["-MM", "shake.c"]- liftIO $ removeFile "shake.c"- pure (drop 1 . filter (/= "/") $ words o)- mkQualified :: Monoid a => Maybe a -> Maybe a -> a -> a mkQualified pre suff = h [f suff, g pre] where g = maybe id mappend@@ -96,6 +83,7 @@ -- fails. ccFromString :: String -> CCompiler ccFromString "gcc" = GCC Nothing+ccFromString "ccomp" = CompCert ccFromString "clang" = Clang ccFromString "ghc" = GHC Nothing Nothing ccFromString s@@ -104,6 +92,8 @@ | "ghc" `isPrefixOf` s = GHC Nothing (Just (drop 3 s)) ccFromString _ = Other "cc" +-- ALSO consider using Haskell -> C -> ICC ??+-- TODO ICC?? -- | A data type representing the C compiler to be used. data CCompiler = GCC { _prefix :: Maybe String -- ^ Usually the target triple }