table of contents
hare-build(1) | General Commands Manual | hare-build(1) |
NAME¶
hare build - compile a Hare program or module
SYNOPSIS¶
hare build [-hFqv]
[-a arch]
[-D ident[:type]=value]
[-j jobs]
[-L libdir]
[-l libname]
[-N namespace]
[-o path]
[-R]
[-T tagset]
[-t type]
[path]
DESCRIPTION¶
hare build compiles a Hare program or module. The path argument is a path to a Hare source file or to a directory which contains a Hare module (see hare-module(5)). If no path is given, the Hare module contained in the current working directory is built.
OPTIONS¶
-h
-F
-q
-v
-a arch
-D ident[:type]=value
-j jobs
-L libdir
-l libname
-N namespace
-o path
-R
-T tagset
-t type
ARCHITECTURES¶
The -a flag is used for cross-compilation to a target architecture different from the host architecture. The following architectures are currently supported:
- aarch64
- riscv64
- x86_64
The system usually provides reasonable defaults for the AR, AS, LD, and CC tools based on the desired target. However, you may wish to set these variables yourself to control the cross toolchain in use.
FREESTANDING ENVIRONMENT¶
If run with -F, hare build will target a freestanding environment. This has the following effects:
- No constraints are imposed on the signature of "main"
- Specifying external libraries with -l will not automatically:
- Link with libc (add -lc manually if required)
- Add the +libc flag (add -T+libc manually if required)
- Use the C compiler for linking (use LD=cc if required)
ENVIRONMENT¶
The following environment variables affect hare build's execution:
HARECACHE | The path to the build cache. Defaults to $XDG_CACHE_HOME/hare, or ~/.cache/hare if $XDG_CACHE_HOME isn't set. |
HAREPATH | The list of directories to search for module dependencies in. See hare-module(5). |
NO_COLOR | Disables all color output when set to a non-empty string. |
HAREC_COLOR | Disables color output for harec when set to 0, enables it when set to any other value. This overrides NO_COLOR. |
HAREC | Name of the harec command to use. |
HARECFLAGS | Additional flags to pass to harec. |
QBE | Name of the qbe command to use. |
QBEFLAGS | Additional flags to pass to qbe. |
AR | Name of the ar(1) command to use. |
ARFLAGS | Additional flags to pass to ar(1). |
AS | Name of the as(1) command to use. |
ASFLAGS | Additional flags to pass to as(1). |
LD | Name of the ld(1) command to use. |
LDLINKFLAGS | Additional flags to pass to ld(1). |
CC | Name of the cc(1) command to use when linking external libraries. |
LDFLAGS | Additional linker flags to pass to cc(1). |
SEE ALSO¶
hare-run(1), hare-test(1), hare-module(5), ar(1), as(1), cc(1), ld(1)
2024-08-10 |