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

Safe HaskellNone
LanguageHaskell98

Development.Shake.Language.C

Contents

Description

 

Synopsis

High-level build rules

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.

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.

Constructors

X86 X86Version

Intel x86 architecture

Arm ArmVersion

Arm architecture

LLVM_IR

LLVM intermediate representation, used by Pepper (PNaCl)

archString :: Arch -> String Source

Architecture short string.

Mainly useful for constructing build output directories.

data Target Source

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

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.

Toolchains

data Linkage Source

Linkage type, static or shared.

Constructors

Static 
Shared 

Working with toolchains

data ToolChainVariant Source

Toolchain variant.

Constructors

Generic

Unspecified toolchain

GCC

GNU Compiler Collection (gcc) toolchain

LLVM

Low-Level Virtual Machine (LLVM) toolchain

Directory prefix for tools in a ToolChain, e.g. /usr/local/linux-armv5-eabi/bin.

toolPrefix :: forall cat. ArrowApply cat => Lens cat ToolChain String Source

Prefix string for tools in a ToolChain, e.g. "linux-armv5-eabi-".

Toolchain variant.

Compiler command, usually used in the compiler action.

type Compiler Source

Arguments

 = ToolChain

Toolchain

-> BuildFlags

Compiler flags

-> FilePath

Input source file

-> FilePath

Output object file

-> Action () 

Action type for producing an object file from a source file.

compiler :: forall cat. ArrowApply cat => Lens cat ToolChain Compiler Source

Compiler action for this ToolChain.

Archiver command, usually used in the archiver action.

type Archiver Source

Arguments

 = ToolChain

Toolchain

-> BuildFlags

Archiver flags

-> [FilePath]

Input object files

-> FilePath

Output object archive (static library)

-> Action () 

Action type for archiving object files into a static library.

archiver :: forall cat. ArrowApply cat => Lens cat ToolChain Archiver Source

Archiver action for this ToolChain.

Linker command, usually used in the linker action.

type Linker Source

Arguments

 = ToolChain

Toolchain

-> BuildFlags

Linker flags

-> [FilePath]

Input object files

-> FilePath

Output link product

-> Action () 

Action type for linking object files into an executable or a library.

data LinkResult Source

Link result type

Constructors

Executable

Executable

SharedLibrary

Shared (dynamically linked) library

LoadableLibrary

Dynamically loadable library

linker :: forall cat. ArrowApply cat => Lens cat ToolChain (LinkResult -> Linker) Source

Linker action for this ToolChain.

Action returning the default BuildFlags for this ToolChain.

Interfacing with other build systems

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.

Utilities for toolchain writers

defaultToolChain :: ToolChain Source

Default toolchain.

Probably not useful without modification.

defaultCompiler :: Compiler Source

Default compiler action.

defaultArchiver :: Archiver Source

Default archiver action.

defaultLinker :: Linker Source

Default linker action.

toolFromString Source

Arguments

:: ToolChain

Toolchain

-> String

Command name

-> FilePath

Full command path

Given a tool chain command name, construct the command's full path, taking into account the toolchain's toolPrefix.

tool Source

Arguments

:: ToolChain

Toolchain

-> (ToolChain :-> String)

Toolchain accessor

-> FilePath

Full command path

Construct the full path of a predefined tool given a ToolChain accessor.

Source Languages

data Language Source

Source language.

Currently something derived from C.

Constructors

C

Plain old C

Cpp

C++

ObjC

Objective-C

ObjCpp

Objective-C with C++ (Apple extension)

defaultLanguageMap :: [(String, Language)] Source

Default mapping from file extension to source language.

languageOf :: FilePath -> Maybe Language Source

Determine the source language of a file based on its extension.