Documentation ¶
Overview ¶
mkf package works with makefiles.
Index ¶
- Variables
- func BackupMakefile(makefilePath string) error
- type Mkf
- func (m *Mkf) AppendString(s string, appendEmptyLine bool) error
- func (m *Mkf) AppendTextLines(textLines []string, appendEmptyLine bool) error
- func (m *Mkf) Bytes() []byte
- func (m *Mkf) InsertAutoEditedMark() error
- func (m *Mkf) InsertValue(entryName string, values []string) error
- func (m *Mkf) IsAutoEdited() bool
- func (m *Mkf) Parse() (*ParsedMkf, error)
- func (m *Mkf) ReadValue(entryName string) ([]string, error)
- func (m *Mkf) RemoveValue(entryName string) error
- func (m *Mkf) ReplaceValue(entryName string, values []string) error
- func (m *Mkf) String() string
- type ParsedMkf
Constants ¶
This section is empty.
Variables ¶
var ( AutoEditedMarkComment = `# This file was edited by ergomcutool` AutoEditedMarkPrefix = "# ERGOMCUTOOL_VERSION =" ErrValueNotFound = errors.New("value not found") ErrEntryNotFound = errors.New("entry not found") )
Functions ¶
func BackupMakefile ¶
BackupMakefile moves specified makefile to '_non_persistent/backups/makefile/'.
Types ¶
type Mkf ¶
type Mkf struct { // Lines are the lines read from a Makefile. Lines []string // LineEnding specifies the Makefile line endings ("\n" and "\r\n" are supported). LineEnding string }
func FromFile ¶
FromFile reads a Makefile from the specified file. Line endings are detected automatically.
func (*Mkf) AppendString ¶
AppendString is similar to AppendTextLines but it splits 's' into lines first, and then appends the lines. No whitespace characters will be removed, except '\r' and '\n'.
func (*Mkf) AppendTextLines ¶
AppendTextLines appends a text block at the end of the makefile, but before `# *** EOF ***` line if such line exists. The text block must not contain line endings.
func (*Mkf) InsertAutoEditedMark ¶
InsertAutoEditedMark inserts a mark that helps to identify if the Makefile was edited by ergomcutool.
func (*Mkf) InsertValue ¶
InsertValue writes the value of the specified entry. It doesn't create the entry itself.
func (*Mkf) IsAutoEdited ¶
func (*Mkf) RemoveValue ¶
RemoveValue removes the value of the specified entry. It doesn't remove the entry itself.
func (*Mkf) ReplaceValue ¶
ReplaceValue removes the original entry value and inserts the new one.
type ParsedMkf ¶
type ParsedMkf struct { // IsAutoEdited is true if the Makefile has been edited by ergomcutool IsAutoEdited bool // ErgomcutoolVersion is the version of ergomcutool that edited the Makefile ErgomcutoolVersion string // Debug is 1 if the Debug mode is selected, or 0 in Release mode. Debug string // Opt contains optimization level arguments, default is -Og Opt string // BuildDir is the build directory, default is 'build' BuildDir string // CSources is a list of .c files from the Makefile, // the order is preserved. CSources []string // CDefs is a list of definitions from the Makefile, // the order is preserved. CDefs []string // CIncludes is a list of include paths from the Makefile, // the order is preserved. CIncludes []string }