The build system for V
Usage:
v [build flags] ['run'] [run options]
Note that these build flags also work with `run` too, but you need to
pass them *before* `run` . The argument directly after `run` is assumed
to be a .v source file or folder containing .v source files.
Everything after that, is assumed to be flags, that V will ignore itself,
but will pass to the executable after it is compiled.
This enables you to do for example: `v -cc gcc -g run myfile.v -param1 abcde`
... which means for V: "compile using gcc, produce debugging information,
then run `./myfile -param1 abcde` and exit with its exit code".
When compiling packages, V ignores files that end in '_test.v'.
Use `v build script.vsh` to compile a `.vsh` script without running it.
`v -skip-running script.vsh` works too.
When compiling a single main package, V writes the resulting executable to an output file
named after the build target. ('v abc.v' and 'v abc/' both write either 'abc' or 'abc.exe')
The '.exe' suffix is added automatically, when writing a Windows executable.
By default, the executable is stored in the same directory as the compiled source code.
The -o flag forces V to write the resulting executable or object to the output file or directory,
instead of the default behavior described in the last two paragraphs.
If the output ends with a path separator, it is treated as an output directory and
V will infer the filename from the target, creating the directory if needed.
You can put common options inside an environment variable named VFLAGS, so that
you don't have to repeat them.
You can set it like this: `export VFLAGS="-cc clang -g"` on *nix,
`set VFLAGS=-cc msvc` on Windows.
V respects the TMPDIR environment variable, and will put .tmp.c files in TMPDIR/v/ .
If you have not set it, a suitable platform specific folder (like /tmp) will be used.
NB: the build flags are shared with the run command too:
-v2
Delegate direct compilation to the V2 frontend from `cmd/v2/v2.v`.
Example: `v -v2 hello.v` or `v -v2 -b arm64 hello.v`.
V2 defaults to the `cleanc` backend unless `-b`/`-backend` selects another one.
Use `v -v2 -eval file.v` to run the V2 eval backend.
-b , -backend
Specifies the backend that will be used for building the executable.
Current list of supported backends:
* `c` (default) - V outputs C source code, which is then passed to a C compiler.
* `go` - V outputs Go source code, which is then passed to a Go compiler.
* `js` - V outputs JS source code which can be passed to NodeJS to be ran.
* `js_browser` - V outputs JS source code ready for the browser.
* `js_node` - V outputs JS source code to run with nodejs.
* `js_freestanding` - V outputs JS source code with no hard runtime dependency.
* `native` - V outputs a native executable directly.
(see -arch x64|arm64 and -os linux|macos) (EXPERIMENTAL).
* `wasm` - V outputs a WebAssembly module directly
(see -os wasi|browser) (EXPERIMENTAL).
-d [=], -define [=]
Define the provided flag.
If `value` is not provided, it is assumed to be set to `true`.
`value` can be any pure literal like `32` (i64),`34.98` (f64), `false` (bool),
`v` (char) or `"V rocks"` (string).
In V code you can use `value := $d('', )` to retrieve the
value assigned to ``.
If no flag identifier (or value) is assigned, `$d()` will return the passed ``.
-g, -debug
Compile the executable in debug mode, allowing code to be debugged more easily.
-o