make

package
v0.6.7-70-gb195eae Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Overview

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file expect in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file expect in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

Index

Constants

View Source
const (
	DefaultBinaryName        = "make"
	DefaultDarwinBinaryName  = "gmake"
	DefaultWindowsBinaryName = "nmake"
)

Variables

View Source
var IgnoredMakePrefixes = []string{
	"make[",
}

Functions

This section is empty.

Types

type ConditionalValue added in v0.4.0

type ConditionalValue struct {
	DependsOn *string
	Value     string
}

ConditionalValue represents an expression in a Makefile in the form of `VARIABLE-$(CONDITION) += VALUE`. This is a typical convention in C-based projects where the `$(CONDITION)` variable either resolves itself to a variable or value, e.g. `y`.

type Make

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

func NewFromInterface

func NewFromInterface(args interface{}, mopts ...MakeOption) (*Make, error)

NewFromInterface prepares a GNU Make command call by parsing the input interface searching for `export` annotations within each attribute's tag.

func (*Make) Execute

func (m *Make) Execute(ctx context.Context) error

Execute starts and waits on the prepared make invocation

type MakeOption

type MakeOption func(mo *MakeOptions) error

func WithAlwaysMake

func WithAlwaysMake(alwaysMake bool) MakeOption

Unconditionally make all targets. Equivalent to calling the flags -B|--always-make

func WithAssumeNew

func WithAssumeNew(file string) MakeOption

Consider files to be infinitely new. Equivalent to calling the flags -W|--what-if|--new-file|--assume-new

func WithBinPath

func WithBinPath(path string) MakeOption

WithBinPath sets an alternative path to the GNU Make binary executable

func WithCheckSymlinkTimes

func WithCheckSymlinkTimes(cst bool) MakeOption

Use the latest mtime between symlinks and target. Equivalent to calling the flags -L|--check-symlink-times

func WithDebug

func WithDebug(debug bool) MakeOption

Print lots of debugging information. Equivalent to calling the flags -d|--debug

func WithDirectory

func WithDirectory(dir string) MakeOption

Change to Directory before doing anything. Equivalent to calling the flags -C|--directory

func WithEnvOverrides

func WithEnvOverrides(envOverrides bool) MakeOption

Environment variables override makefiles. Equivalent to calling the flags -e|--environment-overrides

func WithEvaluates

func WithEvaluates(evaluates string) MakeOption

Evaluate strings as makefile statements. Equivalent to calling the flags -E|--eval

func WithExecOptions

func WithExecOptions(eopts ...exec.ExecOption) MakeOption

WithExecOptions offers configuration options to the underlying process executor

func WithFile

func WithFile(file string) MakeOption

Read files as a makefile. Equivalent to calling the flags -f|--file|--makefile

func WithIgnoreErrors

func WithIgnoreErrors(ignoreErrors bool) MakeOption

Ignore errors from recipes. Equivalent to calling the flags -i|--ignore-errors

func WithIncludeDir

func WithIncludeDir(dir string) MakeOption

Search directories for included makefiles. Equivalent to calling the flags `-I|--include-dir

func WithJobs

func WithJobs(jobs int) MakeOption

Allow N jobs at once; infinite jobs with no arg. Equivalent to calling the flags -j|--jobs with a value

func WithJustPrint

func WithJustPrint(justPrint bool) MakeOption

Don't actually run any recipe; just print them. Equivalent to calling the flags -n|--just-print|--dry-run|--recon

func WithKeepGoing

func WithKeepGoing(keepGoing bool) MakeOption

Keep going when some targets can't be made. Equivalent to calling the flags -k|--keep-going

func WithLoadAverage

func WithLoadAverage(loadAverage int) MakeOption

Don't start multiple jobs unless load is below N. Equivalent to calling the flags -l|--load-average|--max-load

func WithMaxJobs

func WithMaxJobs(maxJobs bool) MakeOption

Allow N jobs at once; infinite jobs with no arg. Equivalent to calling the flags -j|--jobs with a value

func WithNoBuiltinRules

func WithNoBuiltinRules(nbr bool) MakeOption

Disable the built-in implicit rules. Equivalent to calling the flags -r|--no-builtin-rules

func WithNoBuiltinVariables

func WithNoBuiltinVariables(nbv bool) MakeOption

Disable the built-in variable settings. Equivalent to calling the flags -R|--no-builtin-variables

func WithNoPrintDirectory added in v0.2.0

func WithNoPrintDirectory(npd bool) MakeOption

Turn off directory printing, even if it was turned on implicitly. Equivalent to calling the flags --no-print-directory

func WithOldFile

func WithOldFile(file string) MakeOption

Consider these files to be very old and don't remake them. Equivalent to calling the flags -o|--old-file|--assume-old

func WithPrintDataBase

func WithPrintDataBase(printDataBase bool) MakeOption

Print make's internal database. Equivalent to calling the flags -p|--print-data-base

func WithPrintDirectory

func WithPrintDirectory(printDirectory bool) MakeOption

Print the current directory. Equivalent to calling the flags -w|--print-directory

func WithProgressFunc

func WithProgressFunc(onProgress func(float64)) MakeOption

WithProgressFunc sets an optional progress function which is used as a callback during the ultimate invocation of make which can be calculated by invoking make's "just print" option

func WithQuestion

func WithQuestion(question bool) MakeOption

Run no recipe; exit status says if up to date. Equivalent to calling the flags -q|--question

func WithSilent

func WithSilent(silent bool) MakeOption

Don't echo recipes. Equivalent to calling the flags -s|--silent|--quiet

func WithTarget

func WithTarget(target ...string) MakeOption

The targets to make (omittion will invoke all targets). Equivalent to calling the flags

func WithTouch

func WithTouch(touch bool) MakeOption

Touch targets instead of remaking them. Equivalent to calling the flags -t|--touch

func WithTrace

func WithTrace(trace bool) MakeOption

Print tracing information. Equivalent to calling the flag --trace

func WithVar

func WithVar(key, val string) MakeOption

WithVar sets a variable and its value before invoking make.

func WithVars

func WithVars(vars map[string]string) MakeOption

WithVars sets a map of additional variables before invoking make.

func WithVersion

func WithVersion(version bool) MakeOption

Print the version number of make and exit. Equivalent to calling the flags -v|--version

func WithWarnUndefinedVariables

func WithWarnUndefinedVariables(wuv bool) MakeOption

Warn when an undefined variable is referenced. Equivalent to calling the flag --warn-undefined-variables

type MakeOptions

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

MakeOptions represents all the command-line arguments which can be passed to the invocation of GNU Make.

func NewMakeOptions

func NewMakeOptions(mopts ...MakeOption) (*MakeOptions, error)

NewMakeOptions

func (*MakeOptions) Vars

func (mo *MakeOptions) Vars() []string

Vars returns serialized slice of Make variables which are passed as arguments to make along with all CLI flags

Jump to

Keyboard shortcuts

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