Built-in variables
Variables
In build recipes:
in
, or{^}
in strings: Input files (the result of thefrom
statement)out
, or{@}
in strings: Output files (the path of the actual file being built by the recipe).depfile
: If the recipe has adepfile
statement, this is the evaluated path to the depfile.%
or{%}
in strings: The stem of the matched pattern, if a pattern is in scope and that pattern contains a%
. When defining patterns in a scope where another pattern is already present, the interpolated{%}
may be used to unambiguously refer to the stem of the "outer" pattern.
Global constants
These variables are valid in all scopes.
ROOT
: The abstract or filesystem path to the project root, which is always/
. When interpolated as<ROOT>
, this becomes the filesystem path to the directory containing the Werkfile.OS
: Lowercase name of the host operating system.- Windows:
windows
- macOS:
macos
- Linux:
linux
- FreeBSD:
freebsd
- DragonFly:
dragonfly
- OpenBSD:
openbsd
- NetBSD:
netbsd
- WebAssembly (WASIp2):
wasm-wasi
- Windows:
OS_FAMILY
: Classification of the host operating system.- Windows:
windows
- Linux, macOS, and BSDs:
unix
- WebAssembly (WASIp2):
wasm
- Windows:
ARCH
: Name of the host architecture.- x86_64 / x64:
x86_64
- x86:
x86
- ARM (64-bit):
aarch64
- ARM (32-bit):
arm
- WebAssembly:
wasm
- x86_64 / x64:
ARCH_FAMILY
: Classification of the host architecture.- x86, x86_64:
x86
- ARM:
arm
- WebAssembly:
wasm
- x86, x86_64:
EXE_SUFFIX
:- Windows:
.exe
- Other: empty
- Windows:
DYLIB_PREFIX
:- Windows: empty
- Linux and macOS:
lib
DYLIB_SUFFIX
:- Windows:
.dll
- Linux:
.so
- macOS:
.dylib
- Windows:
STATICLIB_PREFIX
:- Windows: empty
- Linux and macOS:
lib
STATICLIB_SUFFIX
:- Windows:
.lib
- Linux and macOS:
.a
- Windows:
EMPTY
: Always the empty stringCOLOR
: When color output is enabled forwerk
, this is set to"1"
. This may be used to conditionally pass command-line arguments to compilers that don't respect the conventionalCLICOLOR
environment variables.