3.4.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 you specify the switch -gnatA, GNAT ignores gnat.adc. When used, GNAT adds gnat.adc to the dependencies so that if gnat.adc is modified later, the source will be recompiled on a future invocation of gnatmake.

You can add configuration pragmas into the gnat.adc file either by running gnatchop on a source file consisting only of configuration pragmas or, more conveniently, by directly editing the gnat.adc file, which is a standard format source file.

Besides gnat.adc, you may apply additional files containing configuration pragmas to the current compilation using the -gnatec=`path' switch, where 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 you do not use switch -gnatA). You can specify multiple -gnatec= switches.

GNAT will add files containing configuration pragmas specified with switches -gnatec= 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.

By default, configuration pragma files are stored by their absolute paths in ALI files. You can use the -gnateb switch to request they be stored instead by just their basename.

If you are using project file, they provide a separate mechanism using project attributes.