70 lines
2.8 KiB
Plaintext
70 lines
2.8 KiB
Plaintext
Usage: v [build flags] ['build'] <file.v|directory>
|
|
|
|
This command compiles the given target, along with their dependencies, into an executable.
|
|
|
|
This help topic explores C-backend specific build flags.
|
|
For help regarding building an executable, see `v help build`.
|
|
|
|
These build flags are enabled on `build` and `run` as long as the backend is set to `c`:
|
|
|
|
-cc <compiler>
|
|
Change the C compiler V invokes to the specified compiler.
|
|
The C compiler is required to support C99.
|
|
Officially supported/tested C compilers include: `clang`, `gcc`, `tcc`, `mingw-w64` and `msvc`.
|
|
|
|
-cflags <flag>
|
|
Pass the provided flag as is to the C compiler.
|
|
Can be specified multiple times to provide multiple flags.
|
|
Use quotes to wrap the flag argument if it contains spaces.
|
|
|
|
-printfn <fn_name>
|
|
Prints the content of the generated C function named fn_name. You can repeat that many times.
|
|
This is useful when you just want to quickly tweak the generated C code,
|
|
without opening the generated .c file in an text editor.
|
|
|
|
-cg
|
|
Enable generating more debug information in the compiled executable.
|
|
This makes program backtraces more useful.
|
|
Using debuggers like gdb/lldb with such executables is easier too.
|
|
|
|
-compress
|
|
Strip the compiled executable to compress it.
|
|
|
|
-freestanding
|
|
Build the executable without dependency on libc.
|
|
Supported only on `linux` targets currently.
|
|
|
|
-live
|
|
Build the executable with live capabilities (`[live]`).
|
|
|
|
-os <os>, -target-os <os>
|
|
Change the target OS that V tries to compile for.
|
|
By default, the target OS is the host system.
|
|
When OS is `cross`, V will attempt to output cross-platform C code.
|
|
List of OS supported by V: `linux`, `windows`, `ios`, `mac`, `freebsd`, `openbsd`,
|
|
`netbsd`, `dragonfly`, `solaris`, `android` and `haiku`.
|
|
|
|
-m32, -m64
|
|
Specify whether 32-bit or 64-bit machine code is generated.
|
|
|
|
-sanitize
|
|
Pass flags related to sanitization to the C compiler.
|
|
|
|
-shared
|
|
Tell V to compile a shared object instead of an executable.
|
|
The resulting file extension will be `.dll` on Windows and `.so` on Unix systems
|
|
|
|
-no-prelude
|
|
Prevents V from generating a prelude in generated .c files, useful for freestanding targets
|
|
where eg. you replace C standard library with your own, or some definitions/headers break something.
|
|
|
|
-custom-prelude <path>
|
|
Useful for similar use-case as above option, except it replaces V-generated prelude with
|
|
your custom one loaded from specified <path>.
|
|
|
|
-showcc
|
|
Prints the C command that is used to build the program.
|
|
|
|
-keepc
|
|
Do not remove the temporary .tmp.c and .tmp.c.rsp files. Also do not use a random prefix for them, so they would be fixed and predictable.
|