shake-language-c-0.10.1: Utilities for cross-compiling with Shake

Safe HaskellNone
LanguageHaskell98

Development.Shake.Language.C

Contents

Description

 

Synopsis

Build targets

data OS #

Target operating system.

Constructors

Android

Google Android

Linux

GNU Linux

OSX

Apple Mac OSX and iOS

Pepper

Google Portable Native Client (PNaCl)

Windows

Microsoft Windows

Instances

Eq OS # 

Methods

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

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

Ord OS # 

Methods

compare :: OS -> OS -> Ordering #

(<) :: OS -> OS -> Bool #

(<=) :: OS -> OS -> Bool #

(>) :: OS -> OS -> Bool #

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

max :: OS -> OS -> OS #

min :: OS -> OS -> OS #

Show OS # 

Methods

showsPrec :: Int -> OS -> ShowS #

show :: OS -> String #

showList :: [OS] -> ShowS #

data Platform #

Target platform.

Basically just a platform identifier string. Use toBuildPrefix to convert a platform to a file path prefix that can be used in Shake rules.

Constructors

Platform 

Fields

data ArmVersion #

Arm architecture version.

Constructors

Armv5 
Armv6 
Armv7 
Armv7s 
Arm64 

data X86Version #

X86 architecture version.

Constructors

I386

i386, 32-bit architecture without SSE

I686

i686, 32-bit architecture with SSE (Pentium-Pro)

X86_64

x86_64, 64-bit architecture

data Arch #

Target architecture.

Use toBuildPrefix to convert an architecture to a short, more or less canonical file path prefix that can be used in Shake rules.

Constructors

X86 X86Version

Intel x86 architecture

Arm ArmVersion

Arm architecture

LLVM_IR

LLVM intermediate representation, used by Pepper (PNaCl)

Instances

Eq Arch # 

Methods

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

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

Show Arch # 

Methods

showsPrec :: Int -> Arch -> ShowS #

show :: Arch -> String #

showList :: [Arch] -> ShowS #

ToBuildPrefix Arch # 

data Target #

Compilation target triple consisting of operating system, platform and architecture.

Use toBuildPrefix to convert a target to a file path prefix that can be used in Shake rules. The prefix is of the form

<platform>/<architecture>

For example:

>>> import qualified Development.Shake.Language.C.Target.OSX as OSX
>>> toBuildPrefix $ OSX.target OSX.iPhoneOS (Arm Armv7)
"iphoneos/armv7"

Constructors

Target 

Fields

class ToBuildPrefix a where #

Convert a value to a build directory prefix.

The idea is that several such values can be combined to form more complex build directory hierarchies. This can be important for disambiguating build product paths in Shake rules.

Minimal complete definition

toBuildPrefix

Methods

toBuildPrefix :: a -> FilePath #

Convert a value to a (unique) build directory prefix.

High-level build rules

data Linkage #

Linkage type, static or shared.

Constructors

Static 
Shared 

executable #

Arguments

:: Action ToolChain

Action returning a target ToolChain

-> FilePath

Output file

-> Action (BuildFlags -> BuildFlags)

Action returning a BuildFlags modifier

-> Action [FilePath]

Action returning a list of input source files

-> Rules FilePath

Rule returning the output file path

Shake rule for building an executable.

staticLibrary #

Arguments

:: Action ToolChain

Action returning a target ToolChain

-> FilePath

Output file

-> Action (BuildFlags -> BuildFlags)

Action returning a BuildFlags modifier

-> Action [FilePath]

Action returning a list of input source files

-> Rules FilePath

Rule returning the output file path

Shake rule for building a static library.

sharedLibrary #

Arguments

:: Action ToolChain

Action returning a target ToolChain

-> FilePath

Output file

-> Action (BuildFlags -> BuildFlags)

Action returning a BuildFlags modifier

-> Action [FilePath]

Action returning a list of input source files

-> Rules FilePath

Rule returning the output file path

Shake rule for building a shared (dynamically linked) library.

loadableLibrary #

Arguments

:: Action ToolChain

Action returning a target ToolChain

-> FilePath

Output file

-> Action (BuildFlags -> BuildFlags)

Action returning a BuildFlags modifier

-> Action [FilePath]

Action returning a list of input source files

-> Rules FilePath

Rule returning the output file path

Shake rule for building a dynamically loadable library.

Toolchain types and utilities

data ToolChainVariant #

Toolchain variant.

Constructors

Generic

Unspecified toolchain

GCC

GNU Compiler Collection (gcc) toolchain

LLVM

Low-Level Virtual Machine (LLVM) toolchain

applyEnv :: ToolChain -> Action ToolChain #

Apply the current environment and return a modified toolchain.

This function is experimental and subject to change!

Currently recognised environment variables are

CC
Path to C compiler.
LD
Path to linker.
SHAKE_TOOLCHAIN_VARIANT
One of the values of ToolChainVariant (case insensitive). If this variable is not present, an attempt is made to determine the toolchain variant from the C compiler command.

toEnv :: ToolChain -> Action [(String, String)] #

Export a ToolChain definition to a list of environment variable mappings, suitable e.g. for calling third-party configure scripts in cross-compilation mode.

Needs some fleshing out; currently only works for "standard" binutil toolchains.