shake-ext-2.12.0.0: Helper functions for linting 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

data CCompiler Source #

A data type representing the C compiler to be used.

Bundled Patterns

pattern GCCStd :: CCompiler

Default gcc available

pattern GHCStd :: CCompiler

Default ghc available

Instances

Eq CCompiler Source # 
Show CCompiler Source # 
Generic CCompiler Source # 

Associated Types

type Rep CCompiler :: * -> * #

Binary CCompiler Source # 
NFData CCompiler Source # 

Methods

rnf :: CCompiler -> () #

Hashable CCompiler Source # 
type Rep CCompiler Source # 

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.

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 

Oracle helpers

queryCC :: Action () Source #

Depend on the C compiler being used.

examineCC :: CCompiler -> Rules () Source #

Set a CCompiler that can be depended on later.

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.