Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone

Shake.Shakefile

Contents

Description

Shakefile for seq and associated binaries.

Synopsis

config

packages

type Package = String Source #

Package, with or without version e.g. containers-0.5.5.1

allPackages :: [Package] Source #

This is the big list of enabled packages.

basicPackages :: [(Package, String)] Source #

This is used to create karya.cabal and supply -package arguments to ghc.

synthPackages :: [(Package, String)] Source #

Packages needed only for targets in Synth.

nessPackages :: [(Package, String)] Source #

These are used in the Ness.* hierarchy, which probably only I use, and only from ghci, so I can omit the deps from common use.

reallyAllPackages :: [(Package, String)] Source #

All packages, not just enabled ones.

extraPackagesFor :: IO.FilePath -> [Package] Source #

This is a hack so I can add packages that aren't in enabledPackages. This is for packages with tons of dependencies that I usually don't need.

config implementation

data Config Source #

Constructors

Config 

Fields

Instances
Show Config # 
Instance details

Defined in Shake.Shakefile

oDir :: Config -> IO.FilePath Source #

Root of .o and .hi hierarchy.

buildDocDir :: IO.FilePath Source #

Root for generated documentation.

docDir :: IO.FilePath Source #

Root for documentation source.

flags

data Flags Source #

Constructors

Flags 

Fields

  • define :: [Flag]
    • D flags. This is used by both g++ and ghc.
  • cInclude :: [Flag]

    There's one global list of include dirs, for both haskell and C++. Technically they don't all need the same dirs, but it doesn't hurt to have unneeded ones.

  • cLibDirs :: [Flag]

    Analogous to cInclude, this has -L flags, used when linking all C++ binaries. TODO also use when linking hs?

  • globalCcFlags :: [Flag]

    Flags for g++. This is the complete list and includes the defines and cIncludes. This is global because all CcBinaries get these flags.

  • midiLd :: [Flag]

    Linker flags to link in whatever MIDI driver we are using today. There should be corresponding flags in define to enable said driver.

  • imLd :: [Flag]

    Linker flags for im synthesizers. TODO I really need a modular package system, putting everything in global config is getting old.

  • fltkCc :: [Flag]

    Additional flags needed when compiling fltk.

  • fltkLd :: [Flag]

    Additional flags needed when linking fltk.

  • hcFlags :: [Flag]

    GHC-specific flags. Unlike globalCcFlags, this *isn't* the complete list.

  • hLinkFlags :: [Flag]

    Flags needed when linking haskell. Doesn't include the -packages.

  • sandboxFlags :: [Flag]

    Package DB flags to use a cabal sandbox, if there is one.

  • packageDbFlags :: [Flag]
    • package-db flags for ghci-flags. This comes from GHC_PACKAGE_PATH, as set by tools/use-stack, and that's enough for ghc, but I need the explicit flags for the GHC API.
Instances
Show Flags # 
Instance details

Defined in Shake.Shakefile

Methods

showsPrec :: Int -> Flags -> ShowS #

show :: Flags -> String #

showList :: [Flags] -> ShowS #

Semigroup Flags # 
Instance details

Defined in Shake.Shakefile

Methods

(<>) :: Flags -> Flags -> Flags #

sconcat :: NonEmpty Flags -> Flags #

stimes :: Integral b => b -> Flags -> Flags #

Monoid Flags # 
Instance details

Defined in Shake.Shakefile

Methods

mempty :: Flags #

mappend :: Flags -> Flags -> Flags #

mconcat :: [Flags] -> Flags #

binaries

hs

data HsBinary Source #

Describe a single haskell binary. The dependencies are inferred by chasing imports.

Constructors

HsBinary 

Fields

Instances
Show HsBinary # 
Instance details

Defined in Shake.Shakefile

defaultRtsFlags :: [Flag] Source #

RTS flags for generated binaries without an explicit target in hsBinaries, like tests and profiles.

data GuiType Source #

GUI apps require some postprocessing.

Constructors

NoGui

plain app

MakeBundle

run make_bundle on mac

HasIcon

run make_bundle, and add an icon from build/name.icns

Instances
Eq GuiType # 
Instance details

Defined in Shake.Shakefile

Methods

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

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

Show GuiType # 
Instance details

Defined in Shake.Shakefile

runProfileTest :: IO.FilePath Source #

This is run as a test, but must be compiled with optimization like a profile.

cppFlags :: Config -> IO.FilePath -> Maybe.Maybe [String] Source #

Hardcoded list of files that should be processed with CPP when chasing deps.

cppInImports :: Set IO.FilePath Source #

Hardcoded list of modules that use CPP to determine their imports. This means I need to CPP the file first before tracking the dependencies.

It would be more robust to always run CPP if the file includes 'LANGUAGE .*CPP' but there aren't many modules with CPP in their import lists so it should be faster to hardcode them.

TODO this is error-prone, maybe I should have a hack in HsDeps to look for #include in the import block. TODO this is also needed if I use #defines, but why don't I always chase includes?

generatedSrc :: HsDeps.Generated Source #

Generated src files.

nameToMain :: Map IO.FilePath IO.FilePath Source #

Module that define main and should get linked to their own binaries, and the names of their eventual binaries.

hsToCc :: Map IO.FilePath [IO.FilePath] Source #

Haskell files that use the FFI likely have dependencies on C++ source. I could figure this out automatically by looking for foreign import ... and searching for a neighboring .cc file with those symbols, but it's simpler to give the dependency explicitly. TODO a somewhat more modular way would be a magic comment that declares a dependency on a C file.

cc

data CcBinary Source #

Describe a C++ binary target. Unlike HsBinary, this has all the binary's obj file dependencies explicitly listed. This is because C source files import separate include files, so I can't infer all the dependencies just by chasing imports, unless I want to assume that each name.h has a corresponding name.cc. In any case, I have relatively little C++ and it changes rarely, so I don't mind a hardcoded list. An explicit list of deps means I can also give compile flags per source file, instead of having a global list of flags that applies to all sources.

Constructors

CcBinary 

Fields

fltkDeps :: Config -> [IO.FilePath] Source #

Since fltk.a is a library, not a binary, I can't just chase includes to know all the source files. I could read fltk/*.cc at runtime, but the fltk directory changes so rarely it seems not a great burden to just hardcode them all here.

ccORule has a special hack to give these fltkCc flags, since I don't have a separate CcLibrary target.

mode

data Mode Source #

Constructors

Debug 
Opt 
Test 
Profile 
Instances
Enum Mode # 
Instance details

Defined in Shake.Shakefile

Methods

succ :: Mode -> Mode #

pred :: Mode -> Mode #

toEnum :: Int -> Mode #

fromEnum :: Mode -> Int #

enumFrom :: Mode -> [Mode] #

enumFromThen :: Mode -> Mode -> [Mode] #

enumFromTo :: Mode -> Mode -> [Mode] #

enumFromThenTo :: Mode -> Mode -> Mode -> [Mode] #

Eq Mode # 
Instance details

Defined in Shake.Shakefile

Methods

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

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

Show Mode # 
Instance details

Defined in Shake.Shakefile

Methods

showsPrec :: Int -> Mode -> ShowS #

show :: Mode -> String #

showList :: [Mode] -> ShowS #

data MidiConfig Source #

Constructors

StubMidi 
JackMidi 
CoreMidi 
Instances
Eq MidiConfig # 
Instance details

Defined in Shake.Shakefile

Show MidiConfig # 
Instance details

Defined in Shake.Shakefile

ghcGlobalFlags :: [Flag] Source #

Flags used by both ghc and haddock. This is unlike hcFlags, which is used by ghc only, and vary based on Mode.

ghcLanguageFlags :: [Flag] Source #

Language extensions which are globally enabled.

platformDefines :: [Flag] Source #

When using gcc I get these defines automatically, but I need to add them myself for ghci. But then c2hs complains about duplicate definitions, so filter them back out for that. Nothing you can't fix by layering on another hack!

parseGhcVersion :: IO.FilePath -> (Int, Int, Int) Source #

Parse the GHC version out of the ghc --print-libdir path. Technically I should probably use ghc --numeric-version, but I already have libdir so let's not run ghc again.

ghcVersionMacro :: (Int, Int, Int) -> String Source #

Generate a number CPP can compare.

inferConfig :: (Mode -> Config) -> InferConfig Source #

Figure out the Config for a given target by looking at its directory.

rules

oracle

newtype Question a Source #

Constructors

Question () 
Instances
Eq (Question a) # 
Instance details

Defined in Shake.Shakefile

Methods

(==) :: Question a -> Question a -> Bool #

(/=) :: Question a -> Question a -> Bool #

Show (Question a) # 
Instance details

Defined in Shake.Shakefile

Methods

showsPrec :: Int -> Question a -> ShowS #

show :: Question a -> String #

showList :: [Question a] -> ShowS #

DeepSeq.NFData (Question a) # 
Instance details

Defined in Shake.Shakefile

Methods

rnf :: Question a -> () #

Hashable (Question a) # 
Instance details

Defined in Shake.Shakefile

Methods

hashWithSalt :: Int -> Question a -> Int #

hash :: Question a -> Int #

Binary (Question a) # 
Instance details

Defined in Shake.Shakefile

Methods

put :: Question a -> Put #

get :: Get (Question a) #

putList :: [Question a] -> Put #

type Shake.RuleResult (Question MidiQ) # 
Instance details

Defined in Shake.Shakefile

type Shake.RuleResult (Question ReplQ) # 
Instance details

Defined in Shake.Shakefile

type Shake.RuleResult (Question FltkQ) # 
Instance details

Defined in Shake.Shakefile

type Shake.RuleResult (Question GhcQ) # 
Instance details

Defined in Shake.Shakefile

data GhcQ Source #

Instances
type Shake.RuleResult (Question GhcQ) # 
Instance details

Defined in Shake.Shakefile

data FltkQ Source #

Instances
type Shake.RuleResult (Question FltkQ) # 
Instance details

Defined in Shake.Shakefile

data ReplQ Source #

Instances
type Shake.RuleResult (Question ReplQ) # 
Instance details

Defined in Shake.Shakefile

data MidiQ Source #

Instances
type Shake.RuleResult (Question MidiQ) # 
Instance details

Defined in Shake.Shakefile

misc rules

hsconfigH :: IO.FilePath Source #

Dynamically generated header.

hsconfigHRule :: IO.FilePath -> Shake.Action () Source #

Write a header to configure the haskell compilation.

It's in a separate file so that the relevant haskell files can include it. This way only those files will recompile when the config changes.

matchObj :: Shake.FilePattern -> IO.FilePath -> Bool Source #

Match a file in buildmodeobj/ or buildmode.

doc

makeAllDocumentation :: (Mode -> Config) -> Shake.Action () Source #

Make all documentation.

extractableDocs :: [IO.FilePath] Source #

Docs produced by extract_doc.

getHaddockInterfaces :: [Package] -> IO.IO [String] Source #

Get paths to haddock interface files for all the packages.

getAllHs :: Config -> Shake.Action [IO.FilePath] Source #

Get all hs files in the repo, in their .hs form (so it's the generated output from .hsc or .chs).

wantsHaddock :: Config -> IO.FilePath -> Bool Source #

Should this module have haddock documentation generated?

packages

hs

buildHs :: Config -> [Flag] -> [IO.FilePath] -> [Package] -> IO.FilePath -> IO.FilePath -> Shake.Action () Source #

Build a haskell binary.

tests and profiles

testRules :: Config -> Shake.Rules () Source #

Generate RunTests.hs and compile it.

criterionRules :: Config -> Shake.Rules () Source #

Build build(mode)RunCriterion-A.B.C from ABC_criterion.hs

runCriterionToSrc :: Config -> IO.FilePath -> IO.FilePath Source #

build(mode)RunCriterion-Derive.Derive -> Derive/Derive_criterion.hs

srcToRunCriterion :: Config -> IO.FilePath -> IO.FilePath Source #

DeriveDerive_criterion.hs -> build(mode)/RunCriterion-Derive.Derive

getCriterionTargets :: Config -> Shake.Action [IO.FilePath] Source #

Find targets for all criterion benchmarks.

binaryWithPrefix :: IO.FilePath -> IO.FilePath -> Bool Source #

Match any filename that starts with the given prefix but doesn't have an extension, i.e. binaries.

generated haskell

faust

generatedFaustAll :: IO.FilePath Source #

This is in build instead of build/faust because that makes it simpler to just say buildfaust*.cc is generated by faust.

srcToDsp :: IO.FilePath -> IO.FilePath Source #

buildfaustx.cc -> SynthFaustdsp/x.dsp

dspToSrc :: IO.FilePath -> IO.FilePath Source #

SynthFaustdspx.dsp -> buildfaust/x.cc

markdown

htmlToDoc :: IO.FilePath -> IO.FilePath Source #

builddocxyz.md.html -> doc/xyz.md

docToHtml :: IO.FilePath -> IO.FilePath Source #

docxyz.md -> builddoc/xyz.md.html

hs

matchHsObjHi :: IO.FilePath -> Maybe.Maybe [IO.FilePath] Source #

Generate both .hs.o and .hi from a .hs file.

writeGhciFlags :: (Mode -> Config) -> IO.IO () Source #

ghci has to be called with the same flags that the .o files were compiled with or it won't load them.

makeDataLinks :: IO.IO () Source #

Make links to large binary files I don't want to put into source control.

ghcFlags :: Config -> [Flag] Source #

Get the file-independent flags for a haskell compile. This is disjunct from hcFlags, which is the per-file compile-specific ones.

ghciFlags :: Config -> [Flag] Source #

Blend the delicate mix of flags needed to convince ghci to load .o files that ghc just produced.

cc

findFlags :: Config -> IO.FilePath -> Maybe.Maybe [Flag] Source #

Find which CcBinary has the obj file in its ccDeps and get its ccCompileFlags. This assumes that each obj file only occurs in one CcBinary. Another way to do this would be to create explicit rules for each Mode for each source file, but I wonder if that would add to startup overhead.

hsc

c2hs

util

srcToObj :: Config -> IO.FilePath -> IO.FilePath Source #

AB.{hs,hsc,chs} -> builddebugobjA/B.hs.o AB.cc -> builddebugobjA/B.cc.o buildAB.hs -> buildAB.hs.o build{hsc,chs}UiKey.hs -> builddebugobjUi/Key.hs.o

Generated .hs files are already in build so they shouldn't have buildetc. prepended. Unless they were .hsc or .chs generated files.

objToSrc :: Config -> IO.FilePath -> IO.FilePath Source #

builddebugobjAB.hs.o -> A/B.hs

objToHscHs :: Config -> IO.FilePath -> IO.FilePath Source #

builddebugobjAB.o -> buildhscA/B.hs

objToChsHs :: Config -> IO.FilePath -> IO.FilePath Source #

builddebugobjAB.o -> buildchsA/B.hs

hsToHsc :: IO.FilePath -> IO.FilePath -> IO.FilePath Source #

buildhscAB.hs -> AB.hsc

hscToHs :: IO.FilePath -> IO.FilePath -> IO.FilePath Source #

AB.hsc -> buildhscAB.hs

chsToHs :: IO.FilePath -> IO.FilePath -> IO.FilePath Source #

AB.chs -> buildchsAB.hs

hsToChs :: IO.FilePath -> IO.FilePath -> IO.FilePath Source #

buildchsAB.hs -> AB.chs

pathToModule :: IO.FilePath -> String Source #

Foor/Bar.hs -> Foo.Bar

moduleToPath :: String -> IO.FilePath Source #

Foo.Bar -> Foo/Bar

logDepsGeneric :: String -> IO.FilePath -> [IO.FilePath] -> Shake.Action () Source #

logDeps for Mode-independent build products.