Safe Haskell | None |
---|---|
Language | Haskell98 |
- type Location = String
- data MakeState = MS {}
- initialMakeState :: File -> MakeState
- getPlacementPos :: Make Int
- addPlacement :: Int -> File -> Make ()
- addMakeDep :: File -> Make ()
- tmpFile :: MonadMake m => String -> m File
- prebuild :: MonadMake m => CommandGen -> m ()
- postbuild :: MonadMake m => CommandGen -> m ()
- checkForEmptyTarget :: Foldable f => f Recipe -> String
- checkForTargetConflicts :: Foldable f => f Recipe -> String
- class Monad m => MonadMake m where
- newtype Make' m a = Make {}
- type Make a = Make' IO a
- evalMake :: Monad m => File -> Make' m a -> m MakeState
- modifyLoc :: MonadState MakeState m => (Location -> Location) -> m ()
- addRecipe :: Recipe -> Make ()
- getLoc :: Make String
- includeMakefile :: Foldable t => t File -> Make ()
- newtype A' m a = A' {}
- type A a = A' (Make' IO) a
- class (Monad m, Monad t) => MonadAction t m | t -> m where
- liftAction :: A' m x -> t x
- runA' :: Monad m => Recipe -> A' m a -> m (Recipe, a)
- runA :: Monad m => String -> A' m a -> m (Recipe, a)
- runA_ :: Monad m => String -> A' m a -> m Recipe
- targets :: (Applicative m, Monad m) => A' m (Set File)
- prerequisites :: (Applicative m, Monad m) => A' m (Set File)
- markPhony :: Monad m => A' m ()
- phony :: Monad m => String -> A' m ()
- markIntermediate :: Monad m => A' m ()
- readFileForMake :: MonadMake m => File -> m ByteString
- newtype CommandGen' m = CommandGen' {}
- type CommandGen = CommandGen' (Make' IO)
- commandGen :: A Command -> CommandGen
- ignoreDepends :: Monad m => A' m a -> A' m a
- shell :: Monad m => CommandGen' m -> A' m [File]
- unsafeShell :: Monad m => CommandGen' m -> A' m [File]
- newtype CakeString = CakeString String
- string :: String -> CakeString
- class Monad m => RefOutput m x where
- inbetween :: Monad m => t -> m [[t]] -> m [t]
- spacify :: Monad m => m [[CommandPiece]] -> m [CommandPiece]
- class MonadAction a m => RefInput a m x where
- depend :: RefInput a m x => x -> a ()
- produce :: RefOutput m x => x -> A' m ()
- variables :: (Foldable t, Monad m) => t Variable -> A' m ()
- commands :: Monad m => [Command] -> A' m ()
- location :: Monad m => String -> A' m ()
- flags :: Monad m => Set Flag -> A' m ()
- cmd :: QuasiQuoter
Documentation
MakeState describes the state of the EDSL synthesizers during the the program execution.
MS | |
|
Monad m => MonadState MakeState (Make' m) |
initialMakeState :: File -> MakeState Source
addPlacement :: Int -> File -> Make () Source
addMakeDep :: File -> Make () Source
prebuild :: MonadMake m => CommandGen -> m () Source
Add prebuild command
postbuild :: MonadMake m => CommandGen -> m () Source
Add prebuild command
checkForEmptyTarget :: Foldable f => f Recipe -> String Source
Find recipes without targets
checkForTargetConflicts :: Foldable f => f Recipe -> String Source
Find recipes sharing a target
class Monad m => MonadMake m where Source
A Monad providing access to MakeState. TODO: not mention IO here.
(RefInput a m x, MonadMake a) => RefInput a m (Make x) | |
(MonadAction a m, MonadMake a) => RefInput a m (Make Recipe) | |
Monad m => MonadState MakeState (Make' m) | |
Monad m => Monad (Make' m) | |
Functor m => Functor (Make' m) | |
MonadFix m => MonadFix (Make' m) | |
(Monad m, Functor m) => Applicative (Make' m) | |
Monad m => MonadLoc (Make' m) | |
MonadIO m => MonadIO (Make' m) | |
MonadMake (Make' IO) |
includeMakefile :: Foldable t => t File -> Make () Source
Add 'include ...' directive to the final Makefile for each input file.
A
here stands for Action. It is a State monad carrying a Recipe as its
state. Various monadic actions add targets, prerequisites and shell commands
to this recipe. After that, rule
function records it to the MakeState
.
After the recording, no modification is allowed for this recipe.
class (Monad m, Monad t) => MonadAction t m | t -> m where Source
A class of monads providing access to the underlying A monad
liftAction :: A' m x -> t x Source
Monad m => MonadAction (A' m) m |
runA' :: Monad m => Recipe -> A' m a -> m (Recipe, a) Source
Run the Action monad, using already existing Recipe as input.
Create new empty recipe and run action on it.
runA_ :: Monad m => String -> A' m a -> m Recipe Source
Version of runA discarding the result of A's computation
prerequisites :: (Applicative m, Monad m) => A' m (Set File) Source
Get a list of prerequisites added so far
markPhony :: Monad m => A' m () Source
Mark the recipe as PHONY
i.e. claim that all it's targets are not real
files. Makefile-specific.
Adds the phony target for a rule. Typical usage:
rule $ do phony "clean" unsafeShell [cmd|rm $elf $os $d|]
markIntermediate :: Monad m => A' m () Source
Mark the recipe as INTERMEDIATE
i.e. claim that all it's targets may be
removed after the build process. Makefile-specific.
:: MonadMake m | |
=> File | File to read contents of |
-> m ByteString |
Obtain the contents of a File. Note, that this generally means, that Makefile should be regenerated each time the File is changed.
newtype CommandGen' m Source
CommandGen is a recipe-builder packed in the newtype to prevent partial expantion of it's commands
MonadAction a m => RefInput a m (CommandGen' m) |
type CommandGen = CommandGen' (Make' IO) Source
commandGen :: A Command -> CommandGen Source
Pack the command builder into a CommandGen
ignoreDepends :: Monad m => A' m a -> A' m a Source
Modifie the recipe builder: ignore all the dependencies
:: Monad m | |
=> CommandGen' m | Command builder as returned by cmd quasi-quoter |
-> A' m [File] |
Apply the recipe builder to the current recipe state. Return the list of
targets of the current Recipe
under construction
unsafeShell :: Monad m => CommandGen' m -> A' m [File] Source
Version of shell
which doesn't track it's dependencies
newtype CakeString Source
Simple wrapper for strings, a target for various typeclass instances.
Eq CakeString | |
Ord CakeString | |
Show CakeString | |
MonadAction a m => RefInput a m CakeString |
string :: String -> CakeString Source
An alias to CakeString constructor
class Monad m => RefOutput m x where Source
Class of things which may be referenced using '@(expr)' syntax of the quasi-quoted shell expressions.
spacify :: Monad m => m [[CommandPiece]] -> m [CommandPiece] Source
class MonadAction a m => RefInput a m x where Source
Class of things which may be referenced using '$(expr)' from inside of quasy-quoted shell expressions
MonadAction a m => RefInput a m CakeString | |
MonadAction a m => RefInput a m Variable | |
MonadAction a m => RefInput a m Recipe | |
MonadAction a m => RefInput a m File | |
MonadAction a m => RefInput a m UWExe | |
MonadAction a m => RefInput a m UWLib | |
MonadAction a m => RefInput a m (CommandGen' m) | |
RefInput a m x => RefInput a m (Maybe x) | |
(RefInput a m x, MonadMake a) => RefInput a m (Make x) | |
(MonadAction a m, MonadMake a) => RefInput a m (Make Recipe) | |
(MonadIO a, RefInput a m x) => RefInput a m (IO x) | |
MonadAction a m => RefInput a m (Set File) | |
RefInput a m x => RefInput a m [x] |
:: RefInput a m x | |
=> x | File or [File] or (Set File) or other form of dependency. |
-> a () |
Add it's argument to the list of dependencies (prerequsites) of a current recipe under construction
Declare that current recipe produces some producable item.
Add variables to the list of variables referenced by the current recipe
commands :: Monad m => [Command] -> A' m () Source
Add commands to the list of commands of a current recipe under construction. Warning: this function behaves like unsafeShell i.e. it doesn't analyze the command text
cmd :: QuasiQuoter Source
Has effect of a function QQ -> CommandGen
where QQ is a string supporting
the following syntax:
- $(expr) evaluates to expr and adds it to the list of dependencies (prerequsites)
- @(expr) evaluates to expr and adds it to the list of targets
- $$ and @@ evaluates to $ and @
Example
[cmd|gcc $flags -o @file|]
is equivalent to
return $ CommandGen $ do s1 <- refInput "gcc " s2 <- refInput (flags :: Variable) s3 <- refInput " -o " s4 <- refOutput (file :: File) return (s1 ++ s2 ++ s3 ++ s4)
Later, this command may be examined or passed to the shell function to apply it to the recipe