← 返回命令列表

Linux command

gnatmake 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Compile an Ada program

gnatmake [main.adb]

Compile with optimization

gnatmake -O2 [main.adb]

Compile with debugging info

gnatmake -g [main.adb]

Compile with parallel jobs

gnatmake -j4 [main.adb]

Specify output executable name

gnatmake [main.adb] -o [program]

Force recompilation of all sources

gnatmake -f [main.adb]

说明

gnatmake is the primary build utility for Ada programs in the GNAT (GNU Ada Toolset) environment. It automatically determines dependencies by analyzing Ada's with clauses, compiles modified source files, and performs binding and linking to create an executable. Unlike traditional make utilities, gnatmake always recomputes dependencies from sources, ensuring accurate tracking of changes.

参数

-jN
Use N parallel jobs for compilation.
-g
Generate debugging information.
-O_level_
Optimization level (0, 1, 2, 3, or s for size).
-o _name_
Output executable name.
-c
Compile only, do not bind or link.
-f
Force recompilation of all sources.
-q
Quiet mode, less output.
-v
Verbose mode.
-I_dir_
Add directory to source search path.
--RTS=_runtime_
Specify Ada runtime library.

FAQ

What is the gnatmake command used for?

gnatmake is the primary build utility for Ada programs in the GNAT (GNU Ada Toolset) environment. It automatically determines dependencies by analyzing Ada's with clauses, compiles modified source files, and performs binding and linking to create an executable. Unlike traditional make utilities, gnatmake always recomputes dependencies from sources, ensuring accurate tracking of changes.

How do I run a basic gnatmake example?

Run `gnatmake [main.adb]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -jN do in gnatmake?

Use N parallel jobs for compilation.