Previous: Handling of Configuration Pragmas, Up: Configuration Pragmas


9.2 The Configuration Pragmas Files

In GNAT a compilation environment is defined by the current directory at the time that a compile command is given. This current directory is searched for a file whose name is gnat.adc. If this file is present, it is expected to contain one or more configuration pragmas that will be applied to the current compilation. However, if the switch -gnatA is used, gnat.adc is not considered. When taken into account, gnat.adc is added to the dependencies, so that if gnat.adc is modified later, an invocation of gnatmake will recompile the source.

Configuration pragmas may be entered into the gnat.adc file either by running gnatchop on a source file that consists only of configuration pragmas, or more conveniently by direct editing of the gnat.adc file, which is a standard format source file.

In addition to gnat.adc, additional files containing configuration pragmas may be applied to the current compilation using the switch -gnatec=path. path must designate an existing file that contains only configuration pragmas. These configuration pragmas are in addition to those found in gnat.adc (provided gnat.adc is present and switch -gnatA is not used).

It is allowable to specify several switches -gnatec=, all of which will be taken into account.

Files containing configuration pragmas specified with switches -gnatec= are added to the dependencies, unless they are temporary files. A file is considered temporary if its name ends in .tmp or .TMP. Certain tools follow this naming convention because they pass information to gcc via temporary files that are immediately deleted; it doesn't make sense to depend on a file that no longer exists. Such tools include gprbuild, gnatmake, and gnatcheck.

If you are using project file, a separate mechanism is provided using project attributes, see Specifying Configuration Pragmas for more details.