Documentation ¶
Index ¶
- Variables
- type Builder
- func (b *Builder) AddRaw(str string) *Builder
- func (b *Builder) AppendPhony() *Builder
- func (b *Builder) AppendVar(mv MakeVar, val Text) *Builder
- func (b *Builder) BlankLine() *Builder
- func (b *Builder) Comment() *Comment
- func (b *Builder) NewRule(target Text) *Rule
- func (b *Builder) SectionBuilder() *Builder
- func (b *Builder) SetVar(mv MakeVar, val Text) *Builder
- func (b *Builder) SetVarSlice(mv MakeVar, vals []Text) *Builder
- func (b *Builder) WriteTo(w io.Writer) (int64, error)
- type Command
- type Comment
- type ErrEmpty
- type ErrIllegalRune
- type ExtPattern
- type FilePath
- type Join
- type MakeVar
- type MakeVarSubstitution
- type RawText
- type Rule
- type RuleAttributes
- type ShellSub
- type ShellVar
- type ShellVarSubstitution
- type Text
Constants ¶
This section is empty.
Variables ¶
var Dep1 = RawText("$<")
Dep1 is the first dep of the current rule
var Target = RawText("$@")
Target is the target of the current rule
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is a tool to build a Makefile in memory
func (*Builder) AddRaw ¶
AddRaw adds a raw string to a Makefile this method does not handle newlines - please add a newline before the text
func (*Builder) AppendPhony ¶
AppendPhony appends a .PHONY rule using all of the phony rules that have been appended previously
func (*Builder) SectionBuilder ¶
SectionBuilder returns another Builder which will be substituted in
func (*Builder) SetVarSlice ¶
SetVarSlice sets a MakeVar to a slice of values
type Command ¶
type Command struct { Base Text //base is the program to invoke (e.g. gcc) Args []Text Env map[ShellVar]Text NoPrint bool }
Command is a command in a rule/shell substitution
func (*Command) AddArgSlice ¶
AddArgSlice adds a slice of arguments to a command
func (*Command) SetNoPrint ¶
SetNoPrint sets the NoPrint to true on a command
type ErrEmpty ¶
type ErrEmpty struct {
SrcType string
}
ErrEmpty is an error returned when something is empty
type ErrIllegalRune ¶
type ErrIllegalRune struct { Rune rune //the illegal rune SrcString string //the string it was found in SrcType string //the type of the source string (MakeVar, etc.) Context string //the subtype of error (e.g. "initial") }
ErrIllegalRune is an error type returned indicating that a rune is not allowed
func (ErrIllegalRune) Error ¶
func (err ErrIllegalRune) Error() string
type ExtPattern ¶
type ExtPattern string
ExtPattern is a simple Makefile pattern which matches an extension NOTE: no leading . TODO: error checking E.g. makefile.ExtPattern("go") -> %.go
func (ExtPattern) Convert ¶
func (ep ExtPattern) Convert() string
Convert formats the ExtPattern as a Makefile pattern
type FilePath ¶
type FilePath string
FilePath is a file path which can be used as Text
func (FilePath) CheckValid ¶
CheckValid does a validity check of a FilePath currently allows alphanumeric and "_ -.\/" runes
type MakeVar ¶
type MakeVar string
MakeVar is a type which can be used as a Makefile variable
func (MakeVar) CheckValid ¶
CheckValid does a very strict validity check of a MakeVar
type MakeVarSubstitution ¶
type MakeVarSubstitution struct {
Variable MakeVar
}
MakeVarSubstitution is a Text type which substitutes for a Makefile variable
func (MakeVarSubstitution) Convert ¶
func (v MakeVarSubstitution) Convert() string
Convert returns the MakeVarSubstitution formatted as a Makefile variable substitution
type Rule ¶
type Rule struct { Name Text Deps []Text Command []*Command Attr RuleAttributes }
Rule is a Makefile rule
type RuleAttributes ¶
type RuleAttributes struct { OneShell bool //goes in front of rule as .ONESHELL: Phony bool Shell Text //shell to use, goes in deps as SHELL:=path }
RuleAttributes is a struct containing the attributes of a Rule
type ShellVar ¶
type ShellVar string
ShellVar is a type which can be used as a shell variable in a Makefile
func (ShellVar) CheckValid ¶
CheckValid does a validity check of a ShellVar based on http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap08.html allows lowercase because all modern systems should have lowercase
type ShellVarSubstitution ¶
type ShellVarSubstitution struct {
Variable ShellVar
}
ShellVarSubstitution is a Text type which substitutes for a shell variable
func (ShellVarSubstitution) Convert ¶
func (v ShellVarSubstitution) Convert() string
Convert returns the ShellVarSubstitution formatted as a shell variable substitution