packages feed

shake-c 0.4.2.0 → 0.4.3.0

raw patch · 3 files changed

+32/−1 lines, 3 files

Files

CHANGELOG.md view
@@ -1,5 +1,10 @@ # shake-c +## 0.4.3.0++  * Add `preprocessA` and `preprocessR`+  * Add `TCC` constructor for `CCompiler` data type+ ## 0.4.2.0    * Do not use oracles; they cause problems
shake-c.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: shake-c-version: 0.4.2.0+version: 0.4.3.0 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2018-2019 Vanessa McHale
src/Development/Shake/C.hs view
@@ -15,6 +15,8 @@                            , dynLibR                            , cBin                            , cToLib+                           , preprocessA+                           , preprocessR                            -- * Oracles                            , idOracle                            -- * Actions@@ -71,6 +73,7 @@ ccToString (GCC pre suff) = mkQualified pre suff "gcc" ccToString (GHC pre suff) = mkQualified pre suff "ghc" ccToString CompCert       = "ccomp"+ccToString TCC            = "tcc"  stripToString :: CCompiler -> String stripToString (GCC pre _) = mkQualified pre Nothing "strip"@@ -95,6 +98,7 @@ ccFromString "ccomp" = CompCert ccFromString "clang" = Clang ccFromString "ghc" = GHC Nothing Nothing+ccFromString "tcc" = TCC ccFromString s     | "gcc" `isSuffixOf` s = GCC (Just (reverse . drop 3 . reverse $ s)) Nothing     | "ghc" `isSuffixOf` s = GHC (Just (reverse . drop 3 . reverse $ s)) Nothing@@ -114,6 +118,7 @@                      }                | CompCert                | ICC+               | TCC                | Other String                deriving (Generic, Binary, Show, Typeable, Eq, Hashable, NFData) @@ -149,6 +154,16 @@     where objRules = objectFileR cc cfg <$> g sources <*> pure lib           g = fmap (-<.> "o") +-- | Rules for preprocessing a C source file.+--+-- @since 0.4.3.0+preprocessR :: CCompiler+            -> FilePath -- ^ C source file+            -> FilePattern -- ^ Preprocessed file output+            -> CConfig+            -> Rules ()+preprocessR cc source proc cfg = proc %> \out -> preprocessA cc source out cfg+ -- | Rules for generating a binary from C source files. Can have at most have -- one @main@ function. cBin :: CCompiler@@ -165,6 +180,17 @@        -> CCompiler -- ^ C compiler        -> Action r stripA out cc = command mempty (stripToString cc) [out]++-- | @since 0.4.3.0+preprocessA :: CmdResult r+            => CCompiler+            -> FilePath -- ^ Source file+            -> FilePath -- ^ Preprocessed output+            -> CConfig+            -> Action r+preprocessA cc source out cfg =+    need [source] *>+    (command [EchoStderr False] (ccToString cc) . (("-E" : "-o" : out : [source]) ++) . cconfigToArgs) cfg  -- | This action builds an executable. binaryA :: CmdResult r