2023-08-18
Jake is a build utility. Its name comes from: Jobs Make. Parallel jobs are used to make goals.
Jake was inspired by the reliable "make" utility.
However, the goal is not to support everything make can do.
Rather, to provide a clear approach to achieve user-defined goals.
If it is also faster, the better.
The rules and dependencies should all be visible in the config files.
This helps for clarity and aims to eliminate the cases of: "maybe another rule was applied", "maybe another tool was launched".
Jake does not know what a compiler is, neither a linker.
Simple enough is easier to handle.
Limits are not imposed where there is no need to.
The user controls what tool, when and how to use it, in order to achieve the chosen goals.
The makefiles which follow to jake syntax can be used directly.
Known unsupported make-specific constructs are ignored. e.g. if
constructs.
The syntax is roughly a subset of "make" syntax. With few small additions.
goal : dependency ... dependency | order-only-dependency ... order-only-dependency
rule command
...
rule command
A goal is usually a file on file system. When the file exists, its modification time is used.
The goal is re-build when:
dependency
is newer.The goal is Not re-build when:
Re-build means:
An order-only-dependency
need only to exist before the goal is made.
Its time is not compared with the goal time.
Dependencies after char |
are considered order-only-dependencies.
goal
.
On the next build, the time-stamp of this file is used.touch goal
to create an empty file anyway.
Then the goal time-stamp is saved to file-system for the next build to use it.
All parts of the goal are optional, except the goal itself.
Dependencies part or rules part can be empty.
Examples:
usual-goal : dependency ... dependency
rule command
...
rule command
goal-with-order-only-dependency : | order-only-dependency ... order-only-dependency
rule command
...
rule command
goal-with-no-rules : dependency | order-only-dependency
goal-only :
Rule commands are indented by spaces or tab characters.
-
means: consider this command returned code 0.@
means: do not echo this command.
Goals are combined in the order they are found.
goal : dep1
cmd1
another-goal:
goal : dep2
cmd2
When goal
is used, internally it looks like this:
goal : dep1 dep2
cmd1
cmd2
.PHONY: special-goal
The special-goal
is a phony goal.
special-goal
exists, it is rebuild.When Jake is launched without any goal in the command line arguments, the default goal is used.
There is only one default goal: the first one found in a Jake file.
Alternatively, the default goal can be changed like this:
.DEFAULT_GOAL := new-default-goal
A recursive-directory-dependency:
/.
.Not all systems support, or are configured to propagate a file modified time its "container", the directory. And then to update also the upper directory. Even if that feature works, the time update should stop when a sym-link to a directory is part of the dependency path.
A recursive-directory-dependency is computed recursively from file-system, only for files. Directories are scanned, but their time-stamp is ignored. The scan may take a bit longer, but is more reliable compared to using the directory timestamp.
\
char at the end of the line means: join with the next line.\
char can be used elsewhere in the line to escape the next char./
is used as a path separator.\
can also be used on Windows.
However, it is translated internally to /
and back,
and it is not officially supported.# this is a comment, to the end of the line
// this is also a comment, to the end of the line
export VAR
command is supported.
export VAR=value
on a single line is supported as of version v2.30-r0811.
Jake uses JAKE_FLAGS
, which can be set in the environment or in a Jake file.
In addition, the following are available:
OS_NAME
Linux
and Windows
are currently available.HOSTNAME
USER
USERNAME
.HOME
USERPROFILE
, else from HOMEDRIVE
and HOMEPATH
.These additional variables provide support for flexible-enough cross-compiling build rules.
Examples:
# variable assignment
VAR = value // for compatibility with make
VAR = "value"
VAR = 'value' // variables in this string are not expanded right away
VAR := value // for compatibility with make
VAR += "appended value"
# using variables
include $(VAR_PATH)
goal:
@echo HOSTNAME $HOSTNAME
@echo HOSTNAME ${HOSTNAME}
@echo HOSTNAME $(HOSTNAME)
include "file"
Include directive allow to use include instructions from another Jake file.
file
must exist. It is included in this line and parsed.-include "file"
This form of Include directive allow to use compiler-generated dependencies, if the compiler generated that file.
file
may exist or not.file
exists, it is included in this line and parsed.file
does not exist, this line is ignored.Lines with a wrong/unknown syntax are usually ignored. This is to allow to use Makefiles.
However, there may be cases when errors are reported for known wrong syntax, and the build will not start.
//EOF//