| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Development.Shake.Language.C
Contents
Description
Synopsis
- module Development.Shake.Language.C.Rules
- module Development.Shake.Language.C.BuildFlags
- data OS
- data Platform = Platform {}
- data ArmVersion
- data X86Version
- data Arch
- = X86 X86Version
- | Arm ArmVersion
- | LLVM_IR
- archString :: Arch -> String
- data Target = Target {
- targetOS :: OS
- targetPlatform :: Platform
- targetArch :: Arch
- class ToBuildPrefix a where
- toBuildPrefix :: a -> FilePath
- data Linkage
- data ToolChain
- data ToolChainVariant
- toolDirectory :: forall cat. ArrowApply cat => Lens cat ToolChain (Maybe FilePath)
- toolPrefix :: forall cat. ArrowApply cat => Lens cat ToolChain String
- variant :: forall cat. ArrowApply cat => Lens cat ToolChain ToolChainVariant
- compilerCommand :: forall cat. ArrowApply cat => Lens cat ToolChain FilePath
- type Compiler = ToolChain -> BuildFlags -> FilePath -> FilePath -> Action ()
- compiler :: forall cat. ArrowApply cat => Lens cat ToolChain Compiler
- archiverCommand :: forall cat. ArrowApply cat => Lens cat ToolChain FilePath
- type Archiver = ToolChain -> BuildFlags -> [FilePath] -> FilePath -> Action ()
- archiver :: forall cat. ArrowApply cat => Lens cat ToolChain Archiver
- linkerCommand :: forall cat. ArrowApply cat => Lens cat ToolChain FilePath
- type Linker = ToolChain -> BuildFlags -> [FilePath] -> FilePath -> Action ()
- data LinkResult
- linker :: forall cat. ArrowApply cat => Lens cat ToolChain (LinkResult -> Linker)
- defaultBuildFlags :: forall cat. ArrowApply cat => Lens cat ToolChain (Action (BuildFlags -> BuildFlags))
- applyEnv :: ToolChain -> Action ToolChain
- toEnv :: ToolChain -> Action [(String, String)]
- defaultToolChain :: ToolChain
- defaultCompiler :: Compiler
- defaultArchiver :: Archiver
- defaultLinker :: Linker
- toolFromString :: ToolChain -> String -> FilePath
- tool :: ToolChain -> (ToolChain :-> String) -> FilePath
- data Language
- defaultLanguageMap :: [(String, Language)]
- languageOf :: FilePath -> Maybe Language
High-level build rules
Build targets
This library's focus is on cross compilation. Here's a list of modules that provide support for targeting specific platforms:
Target operating system.
Target platform.
Basically just a platform identifier string.
data X86Version Source
X86 architecture version.
Constructors
i386, 32-bit architecture without SSE
i686, 32-bit architecture with SSE (Pentium-Pro)
x86_64, 64-bit architecture
Instances
Target architecture.
Constructors
archString :: Arch -> String Source
Architecture short string.
Mainly useful for constructing build output directories.
Compilation target triple consisting of operating system, platform and architecture.
Constructors
Fields
- targetOS :: OS
Target operating system
- targetPlatform :: Platform
Target platform
- targetArch :: Arch
Target architecture
Instances
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.
Methods
toBuildPrefix :: a -> FilePath Source
Instances
Toolchains
Linkage type, static or shared.
Working with toolchains
data ToolChainVariant Source
Toolchain variant.
Constructors
Unspecified toolchain
GNU Compiler Collection (gcc) toolchain
Low-Level Virtual Machine (LLVM) toolchain
Instances
toolDirectory :: forall cat. ArrowApply cat => Lens cat ToolChain (Maybe FilePath) Source
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-".
variant :: forall cat. ArrowApply cat => Lens cat ToolChain ToolChainVariant Source
Toolchain variant.
compilerCommand :: forall cat. ArrowApply cat => Lens cat ToolChain FilePath Source
Compiler command, usually used in the compiler action.
Arguments
Toolchain
Compiler flags
Input source file
Output object file
Action type for producing an object file from a source file.
Compiler action for this ToolChain .
archiverCommand :: forall cat. ArrowApply cat => Lens cat ToolChain FilePath Source
Archiver command, usually used in the archiver action.
Arguments
Toolchain
Archiver flags
Input object files
Output object archive (static library)
Action type for archiving object files into a static library.
Archiver action for this ToolChain .
linkerCommand :: forall cat. ArrowApply cat => Lens cat ToolChain FilePath Source
Linker command, usually used in the linker action.
Arguments
Toolchain
Linker flags
Input object files
Output link product
Action type for linking object files into an executable or a library.
data LinkResult Source
Link result type
Constructors
Executable
Shared (dynamically linked) library
Dynamically loadable library
Instances
linker :: forall cat. ArrowApply cat => Lens cat ToolChain (LinkResult -> Linker) Source
Linker action for this ToolChain .
defaultBuildFlags :: forall cat. ArrowApply cat => Lens cat ToolChain (Action (BuildFlags -> BuildFlags)) Source
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
Ccompiler. 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 theCcompiler 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.
Given a tool chain command name, construct the command's full path, taking into account the toolchain's toolPrefix .
Construct the full path of a predefined tool given a ToolChain accessor.
Source Languages
Source language.
Currently something derived from C.
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.