Forrest logo
tool overview
On this page you find all important commands for the CLI tool gnatprep. If the command you are looking for is missing please ask our AI.


The gnatprep tool is a command-line utility that is part of the GNAT Ada development environment. It is used to perform preprocessing tasks on Ada source code files before they are compiled.

Here are some key points about gnatprep:

  1. Preprocessing: gnatprep allows you to perform conditional compilation in Ada by selectively including or excluding certain parts of the code based on specified conditions. It supports several types of directives such as ifdef, ifndef, else, and endif that control the preprocessing behavior.

  2. Macro Expansion: The tool also supports the definition and expansion of macros. Macros are snippets of code that are replaced by their expanded form during preprocessing. This allows for code reuse, simplification of repetitive tasks, and customization of Ada source files.

  3. File Inclusion: gnatprep provides the ability to include the contents of other files at specific points in the source code. This allows for modularization and separation of concerns by breaking down the code into smaller, manageable units that can be included where needed.

  4. Integration with GNAT: gnatprep seamlessly integrates with the GNAT Ada compiler and build system. It can be used as an intermediate step during the build process to preprocess Ada source files before compilation. The preprocessed files are then passed to the compiler for final translation into object code.

  5. Cross-Platform: gnatprep is available on multiple platforms, including Windows, Linux, and macOS, making it suitable for developers working on various environments and operating systems.

Overall, gnatprep is a versatile command-line tool for performing preprocessing tasks on Ada source files. It enables conditional compilation, macro expansion, and file inclusion, providing developers with greater flexibility and customization options.

List of commands for gnatprep:

  • gnatprep:tldr:88033 gnatprep: Use symbol definitions from a file.
    $ gnatprep ${source_file} ${target_file} ${definitions_file}
    try on your machine
    explain this command
  • gnatprep:tldr:df83e gnatprep: Specify symbol values in the command-line.
    $ gnatprep -D${name}=${value} ${source_file} ${target_file}
    try on your machine
    explain this command
tool overview