shake-c-0.4.3.0: Library for building C code with shake

Safe HaskellNone
LanguageHaskell2010

Development.Shake.C

Contents

Description

This module provides functions for easy C builds of binaries, static libraries, and dynamic libraries.

Synopsis

Types

data CConfig Source #

Constructors

CConfig 

Fields

Instances
Eq CConfig Source # 
Instance details

Defined in Development.Shake.C

Methods

(==) :: CConfig -> CConfig -> Bool #

(/=) :: CConfig -> CConfig -> Bool #

Show CConfig Source # 
Instance details

Defined in Development.Shake.C

Generic CConfig Source # 
Instance details

Defined in Development.Shake.C

Associated Types

type Rep CConfig :: Type -> Type #

Methods

from :: CConfig -> Rep CConfig x #

to :: Rep CConfig x -> CConfig #

Binary CConfig Source # 
Instance details

Defined in Development.Shake.C

Methods

put :: CConfig -> Put #

get :: Get CConfig #

putList :: [CConfig] -> Put #

NFData CConfig Source # 
Instance details

Defined in Development.Shake.C

Methods

rnf :: CConfig -> () #

Hashable CConfig Source # 
Instance details

Defined in Development.Shake.C

Methods

hashWithSalt :: Int -> CConfig -> Int #

hash :: CConfig -> Int #

type Rep CConfig Source # 
Instance details

Defined in Development.Shake.C

type RuleResult CConfig Source # 
Instance details

Defined in Development.Shake.C

data CCompiler Source #

A data type representing the C compiler to be used.

Constructors

GCC 

Fields

Clang 
GHC 

Fields

CompCert 
ICC 
TCC 
Other String 
Instances
Eq CCompiler Source # 
Instance details

Defined in Development.Shake.C

Show CCompiler Source # 
Instance details

Defined in Development.Shake.C

Generic CCompiler Source # 
Instance details

Defined in Development.Shake.C

Associated Types

type Rep CCompiler :: Type -> Type #

Binary CCompiler Source # 
Instance details

Defined in Development.Shake.C

NFData CCompiler Source # 
Instance details

Defined in Development.Shake.C

Methods

rnf :: CCompiler -> () #

Hashable CCompiler Source # 
Instance details

Defined in Development.Shake.C

type Rep CCompiler Source # 
Instance details

Defined in Development.Shake.C

type RuleResult CCompiler Source # 
Instance details

Defined in Development.Shake.C

Rules

staticLibR Source #

Arguments

:: CCompiler 
-> [FilePath]

Object files to be linked

-> FilePattern

File pattern for static library outputs

-> CConfig 
-> Rules () 

sharedLibR Source #

Arguments

:: CCompiler 
-> [FilePath]

Object files to be linked

-> FilePattern

File pattern for shared library outputs

-> CConfig 
-> Rules () 

objectFileR Source #

Arguments

:: CCompiler 
-> CConfig 
-> FilePath

C source file

-> FilePattern

Object file output

-> Rules () 

These rules build an object file from a C source file.

dynLibR Source #

Arguments

:: CCompiler 
-> [FilePath]

C source files

-> FilePattern

Shared object file to be generated.

-> CConfig 
-> Rules () 

These rules build a dynamic library (.so on Linux).

cBin Source #

Arguments

:: CCompiler 
-> [FilePath]

C source files

-> FilePattern

Binary file output

-> CConfig 
-> Rules () 

Rules for generating a binary from C source files. Can have at most have one main function.

cToLib Source #

Arguments

:: CCompiler 
-> [FilePath]

C source files

-> FilePattern

Static libary output

-> CConfig 
-> Rules () 

Rules for making a static library from C source files. Unlike staticLibR, this also creates rules for creating object files.

preprocessA Source #

Arguments

:: CmdResult r 
=> CCompiler 
-> FilePath

Source file

-> FilePath

Preprocessed output

-> CConfig 
-> Action r 

Since: 0.4.3.0

preprocessR Source #

Arguments

:: CCompiler 
-> FilePath

C source file

-> FilePattern

Preprocessed file output

-> CConfig 
-> Rules () 

Rules for preprocessing a C source file.

Since: 0.4.3.0

Oracles

idOracle :: (RuleResult q ~ a, q ~ a, ShakeValue q) => Rules (q -> Action a) Source #

Use this for tracking e.g. CCompiler or CConfig

Since: 0.4.1.0

Actions

pkgConfig :: String -> Action [String] Source #

Given a package name or path to a .pc file, output flags for C compiler.

binaryA Source #

Arguments

:: CmdResult r 
=> CCompiler 
-> [FilePath]

Source files

-> FilePath

Executable output

-> CConfig 
-> Action r 

This action builds an executable.

staticLibA Source #

Arguments

:: CmdResult r 
=> CCompiler 
-> [FilePath]

Object files to be linked

-> FilePattern

File pattern for static library outputs

-> CConfig 
-> Action r 

sharedLibA Source #

Arguments

:: CmdResult r 
=> CCompiler 
-> [FilePath]

Object files to be linked

-> FilePattern

File pattern for shared library outputs

-> CConfig 
-> Action r 

stripA Source #

Arguments

:: CmdResult r 
=> FilePath

Build product to be stripped

-> CCompiler

C compiler

-> Action r 

Reëxports from Language.C.Dependency

getCDepends #

Arguments

:: MonadIO m 
=> [FilePath]

Directories to search in

-> FilePath

Path to C source file

-> m [FilePath] 

Get any filepaths that were #include-ed in a C source file.

getAll #

Arguments

:: MonadIO m 
=> [FilePath]

Directories for included header/source files

-> FilePath

File name

-> m [FilePath] 

Get transitive dependencies of a C source file.

Helper functions

cconfigToArgs :: CConfig -> [String] Source #

Generate compiler flags for a given configuration.

ccToString :: CCompiler -> String Source #

Get the executable name for a CCompiler

ccFromString :: String -> CCompiler Source #

Attempt to parse a string as a CCompiler, defaulting to cc if parsing fails.

host :: String Source #

The target triple of the host machine.