shake-ext-2.11.0.0: Helper functions for linting with shake
Safe HaskellNone
LanguageHaskell2010

Development.Shake.C

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

Instances details
Eq 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.

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 

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.

getCDepends Source #

Arguments

:: CCompiler

Should be either gcc or clang.

-> String

C source code

-> Action [FilePath] 

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.

host :: String Source #

The target triple of the host machine.