makefile

package
v0.0.0-...-f249b6c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package makefile implements output to Makefiles.

Index

Constants

View Source
const (
	VariableGroupCommon            = "common variables"
	VariableGroupDocker            = "docker build settings"
	VariableGroupExtra             = "extra variables"
	VariableGroupHelp              = "help menu"
	VariableGroupSourceDateEpoch   = "source date epoch of first commit"
	VariableGroupTargets           = "targets defines all the available targets"
	VariableGroupAdditionalTargets = "additional targets defines all the additional targets"
)

Descriptions (used as keys) of some predefined variable groups.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compiler

type Compiler interface {
	CompileMakefile(*Output) error
}

Compiler is implemented by project blocks which support Dockerfile generate.

type Condition

type Condition struct {
	// contains filtered or unexported fields
}

Condition is a if-clause in Makefile.

func (*Condition) Else

func (condition *Condition) Else(vars ...*Variable) *Condition

Else adds a variable to the else-clause.

func (*Condition) Generate

func (condition *Condition) Generate(w io.Writer) error

Generate output for the Makefile.

func (*Condition) Then

func (condition *Condition) Then(vars ...*Variable) *Condition

Then adds a variable to the then-clause.

type Output

type Output struct {
	output.FileAdapter
	// contains filtered or unexported fields
}

Output implements Makefile generation.

func NewOutput

func NewOutput() *Output

NewOutput creates new Makefile output.

func (*Output) Compile

func (o *Output) Compile(compiler Compiler) error

Compile implements output.TypedWriter interface.

func (*Output) Filenames

func (o *Output) Filenames() []string

Filenames implements output.FileWriter interface.

func (*Output) GenerateFile

func (o *Output) GenerateFile(filename string, w io.Writer) error

GenerateFile implements output.FileWriter interface.

func (*Output) HasTarget

func (o *Output) HasTarget(name string) bool

HasTarget checks that target exists.

func (*Output) IfTrueCondition

func (o *Output) IfTrueCondition(variable string) *Condition

IfTrueCondition creates new Makefile condition.

func (*Output) Target

func (o *Output) Target(name string) *Target

Target creates new Makefile target.

func (*Output) VariableGroup

func (o *Output) VariableGroup(description string) *VariableGroup

VariableGroup creates new group of variables.

type SkipAsMakefileDependency

type SkipAsMakefileDependency interface {
	SkipAsMakefileDependency()
}

SkipAsMakefileDependency signals that this node should never be exposed as Makefile dependency.

type Target

type Target struct {
	// contains filtered or unexported fields
}

Target is a Makefile target.

func (*Target) Depends

func (target *Target) Depends(targets ...string) *Target

Depends appends target dependency.

func (*Target) Description

func (target *Target) Description(description string) *Target

Description attaches target description.

func (*Target) Generate

func (target *Target) Generate(w io.Writer) error

Generate output for the Makefile.

func (*Target) Phony

func (target *Target) Phony() *Target

Phony marks target as phony.

func (*Target) Script

func (target *Target) Script(lines ...string) *Target

Script appends a line to target shell script.

type Trigger

type Trigger struct {
	// contains filtered or unexported fields
}

Trigger is the expression for the Condition.

type Variable

type Variable struct {
	// contains filtered or unexported fields
}

Variable abstract Makefile variable of different flavors.

func AppendVariable

func AppendVariable(name, value string) *Variable

AppendVariable creates new Variable with appended value (+=).

func MultilineVariable

func MultilineVariable(name, value string) *Variable

MultilineVariable creates new Variable with multi-line content (define).

func OverridableVariable

func OverridableVariable(name, value string) *Variable

OverridableVariable creates new overridable Variable of recursive (?=) flavor.

func RecursiveVariable

func RecursiveVariable(name, value string) *Variable

RecursiveVariable creates new Variable of recursive (=) flavor.

func SimpleVariable

func SimpleVariable(name, value string) *Variable

SimpleVariable creates new Variable with simple evaluation (:=).

func (*Variable) Export

func (variable *Variable) Export() *Variable

Export marks variable as exported.

func (*Variable) Generate

func (variable *Variable) Generate(w io.Writer) error

Generate renders variable definition.

func (*Variable) Push

func (variable *Variable) Push(line string) *Variable

Push is used to push extra value (+=) to RecursiveVariable.

type VariableGroup

type VariableGroup struct {
	// contains filtered or unexported fields
}

VariableGroup is a way to group nicely variables in Makefile.

func (*VariableGroup) Generate

func (group *VariableGroup) Generate(w io.Writer) error

Generate renders group to output.

func (*VariableGroup) Variable

func (group *VariableGroup) Variable(variable *Variable) *VariableGroup

Variable appends variable to the group.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL