gnatmake
Build Ada executables from source code
TLDR
Compile an executable
Set a custom [o]utput executable name
[f]orce recompilation
SYNOPSIS
gnatmake [options] {file.adb|...|-Pproj.gpr[=scen]} [options]
PARAMETERS
-P proj[=scen]
Build using project file proj.gpr; optional scenario variables.
-f
Force recompilations, ignoring time stamps.
-u
Recompile unchanged files (unique compilation tags).
-k
Keep going after errors.
-j n
Use n parallel jobs for compilation.
-q
Quiet mode, suppress non-error output.
-v
Verbose mode, show all commands executed.
-b
Brief mode, show only errors and warnings.
-o exec
Name output executable exec.
-p
Create missing object and library directories.
-aOdir
Object files in directory dir.
-aIdir
Add dir to source search path.
-c
Compile only, no bind or link.
-l
Link only, assume objects up-to-date.
-M
Generate Makefile dependencies.
-i
Ignore missing sources or library files.
--unchecked-shared-lib-imports
Skip binder elaboration checks.
-gnat
Pass compiler switch -gnat
DESCRIPTION
gnatmake is the intelligent project builder for the GNAT Ada compiler. It automatically compiles Ada source files, handles dependencies including generics, subunits, and configuration pragmas, binds object files, and links executables. Unlike standard make(1), it understands Ada semantics for precise recompilation only when needed, saving time on large projects.
Invoke with source file names for simple builds or use -P for project files (.gpr) supporting multi-language, hierarchical projects, and external builders. Features parallel compilation (-j), dynamic dependency checking, and checks for missing with-clauses or obsolete files. Outputs progress, errors, and warnings verbosely by default.
Ideal for Ada development, it integrates with gcc backend. Supports cross-compilation and static/dynamic linking. For modern use, consider gprbuild as successor.
CAVEATS
Deprecated in GNAT 2020+ favoring gprbuild(1); may not handle complex multi-lang projects well without -P. Requires GNAT tools in PATH.
SIMPLE EXAMPLE
gnatmake hello.adb
Compiles, binds, links hello executable.
PROJECT EXAMPLE
gnatmake -P myproj.gpr -j4
Builds project with 4 parallel jobs.
HISTORY
Developed 1992 by NYU and US DOD for GNAT Ada 9X; evolved by Ada Core Systems (now AdaCore). Integral to GNAT through GPS IDE integration until gprbuild (2006+) as extensible replacement.


