Richard Jones (Richard WM Jones), author , working at Red Hat, a new build utility , aimed at addressing the shortcomings and issues in the make utility while maintaining the overall simplicity and clarity of the scripts. The make utility was designed in 1976 and has several conceptual flaws, which Goals intends to rectify without changing the overall concept.
Source code Goals under license GPLv2+.
:
- Support for only one dependency resolution strategy — "the build instruction runs if the target file is absent or it is older than one of the dependencies." Goals plans to implement other strategies as well, such as checking for the presence of a URL, comparing modification times with any file, estimating the package build in , comparing checksums, running test suites with selective test skipping.
- When processing build targets, the make utility does not distinguish between files and rule names; as a consequence, there is no checking to ensure that when a rule is executed, the file declared to be created will indeed be created. For example, if a rule named "test" that triggers scripts for tests accidentally creates a file named "test", the tests will stop being called since make will consider the target built and will not require any actions to be taken (to bypass this issue in make, one can specify the directive ".PHONY: test"). Goals explicitly distinguishes between files and rule names.

- Problem of providing only one parameter for build instructions.

Goals proposes to use an arbitrary number of named parameters. For example, one can separately extract a flag for the debug file from the name:

- Issues of interaction with the shell interpreter. For instance, the need to control the escaping of spaces in file and directory names, the resource expenditure on launching a separate shell interpreter for each command execution, the double interpretation of the symbol "$" (which is used in both shell and make), consideration of whitespace.
These issues are addressed in Goals by using the symbol "%" instead of "$" for build variables ("$" remains only for shell), applying the parser , which requires enclosing paths and file names in quotes and bracketing code blocks with curly braces. The entire block runs in one instance of the command shell, and arbitrary code formatting is allowed inside the block, without binding to special spaces.
Previously:
target: foo.o bar.o
${CC} ${CFLAGS} $< -o $@Now:
"target": "foo.o", "bar.o" {
LAGS < -o %@
}
Other features of Goals:
- Optional support for defining arbitrary names and parameters:
goal all = : "target"
goal link =
"target": "foo.o", "bar.o" { … }goal compile (name) =
«%name.o» : «%name.c», «dep.h» { LAGS -c $^ -o $@ } - Two run modes: make mode for matching build targets to file names (for example, the file "foo.o" corresponds to the target "%name.o"), and direct compile run mode:
goal all = : link
goal link =
"target": "foo.o", compile ("bar") { … }goal compile (name) =
«%name.o» : «%name.c», «dep.h» { LAGS -c $^ -o $@ } - Build tactics are defined by special rules that determine the need for rebuilding a build target. If binding to the existence of a file is done, it is explicitly defined through the corresponding indicator ("target" for the rule name and *file("target") for file checks).
"target": "foo.o", "bar.o" { … }
*file("target"): *file("foo.o"), *file("bar.o") { … }
- The developer can define arbitrary indicators for build tactics. The indicator "*file" is defined by default (@{…} indicates suppression of output, and "exit 99" signals the need for rebuilding):
tactic *file (filename) = @{
test -f %filename || exit 99
for f in %Source: opennet.ru



