shake-language-c-0.6.4: 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

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

platformName :: String
 

data ArmVersion Source

Arm architecture version.

Constructors

Armv5 
Armv6 
Armv7 
Armv7s 

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)

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

targetOS :: OS

Target operating system

targetPlatform :: Platform

Target platform

targetArch :: Arch

Target architecture

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.

High-level build rules

data Linkage Source

Linkage type, static or shared.

Constructors

Static 
Shared 

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.
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.