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

Safe HaskellNone
LanguageHaskell98

Development.Shake.Language.C

Contents

Description

 

Synopsis

Build targets

data OS Source #

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 Source # 

Methods

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

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

Ord OS Source # 

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 Source # 

Methods

showsPrec :: Int -> OS -> ShowS #

show :: OS -> String #

showList :: [OS] -> ShowS #

data Platform Source #

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 Source #

Arm architecture version.

Constructors

Armv5 
Armv6 
Armv7 
Armv7s 
Arm64 

data X86Version Source #

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 Source #

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

data Target Source #

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 Source #

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 Source #

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

High-level build rules

executable Source #

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 Source #

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 Source #

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 Source #

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 Source #

Toolchain variant.

Constructors

Generic

Unspecified toolchain

GCC

GNU Compiler Collection (gcc) toolchain

LLVM

Low-Level Virtual Machine (LLVM) toolchain

applyEnv :: ToolChain -> Action ToolChain Source #

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)] Source #

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.