Building
From a main module to an exe, one unit compiled once.
A build
adam build hello.adam -r builds the program and runs it (The adam command):
module exe hello;
begin
println("Hello from Adam!");
end.
Hello from Adam!
A build prints one line per phase with its time (parse, analyze, lower, generate, link) and the Built line naming the exe; -q prints only the reports.
Optimization levels
-opt or the main module's @optimize picks the level: debug, safe, fast or small. debug is the level when neither names one. debug runs no optimizer pass but the copying of inline routines into their calls (Declarations); safe, fast and small run Adam's own optimizer over the SSA IR, target-neutral: inlining, promotion of locals to values, constant propagation, memory forwarding, value numbering, loop passes and dead code removal, with fast also unrolling loops and small also merging tails that end alike. Every function's code starts on a 64-byte cache line (16 bytes at small), so where the link places it does not change its speed. A debug build prints a heap report when the program ends ([Heap] Allocs: N, Frees: N, Leaked: N); a release build (-opt fast, the docs' samples) prints only the program's own output (The heap report).
Defines
Every file is compiled with the defines ADAM, BUILD_<kind> (the module's kind), DEBUG in a debug build or RELEASE and RELEASE_<LEVEL> in the others, and the target's (Target defines). @ifdef picks code by them (Directives).
Output
A build writes into the output folder split by kind, target and mode: bin/<triple>/<mode> for the exe (and a dll), lib/<triple>/<mode> for static libraries, acu/<triple>/<mode> for compiled units; the mode is debug or release.
Compiled units
Each unit compiles once into a .acu compiled unit, which later builds load instead of compiling the unit again until its source changes. The std and runtime units ship precompiled beside adam.