7.3.3 Project Files for `gnatxref' and `gnatfind'
Project files allow a programmer to specify how to compile its
application, where to find sources, etc. These files are used
primarily by GPS, but they can also be used
by the two tools gnatxref and gnatfind.
A project file name must end with .gpr
. If a single one is
present in the current directory, then gnatxref and gnatfind will
extract the information from it. If multiple project files are found, none of
them is read, and you have to use the -p
switch to specify the one
you want to use.
The following lines can be included, even though most of them have default
values which can be used in most cases.
The lines can be entered in any order in the file.
Except for src_dir
and obj_dir
, you can only have one instance of
each line. If you have multiple instances, only the last one is taken into
account.
-
- `src_dir=DIR'
-
[default: "./"].
Specifies a directory where to look for source files. Multiple src_dir
lines can be specified and they will be searched in the order they
are specified.
-
- `obj_dir=DIR'
-
[default: "./"].
Specifies a directory where to look for object and library files. Multiple
obj_dir lines can be specified, and they will be searched in the order
they are specified
-
- `comp_opt=SWITCHES'
-
[default: ""].
Creates a variable which can be referred to subsequently by using
the ${comp_opt} notation. This is intended to store the default
switches given to `gnatmake' and `gcc'.
-
- `bind_opt=SWITCHES'
-
[default: ""].
Creates a variable which can be referred to subsequently by using
the
$`bind_opt'
notation. This is intended to store the default
switches given to `gnatbind'.
-
- `link_opt=SWITCHES'
-
[default: ""].
Creates a variable which can be referred to subsequently by using
the
$`link_opt'
notation. This is intended to store the default
switches given to `gnatlink'.
-
- `main=EXECUTABLE'
-
[default: ""].
Specifies the name of the executable for the application. This variable can
be referred to in the following lines by using the
`${main'
notation.
-
- `comp_cmd=COMMAND'
-
[default: "gcc -c -I${src_dir} -g -gnatq"].
Specifies the command used to compile a single file in the application.
-
- `make_cmd=COMMAND'
-
[default: "gnatmake ${main} -aI${src_dir} -aO${obj_dir} -g -gnatq -cargs ${comp_opt} -bargs ${bind_opt} -largs ${link_opt}"].
Specifies the command used to recompile the whole application.
-
- `run_cmd=COMMAND'
-
[default: "${main}"].
Specifies the command used to run the application.
-
- `debug_cmd=COMMAND'
-
[default: "gdb ${main}"].
Specifies the command used to debug the application
`gnatxref' and `gnatfind' only take into account the
src_dir and obj_dir lines, and ignore the others.