Next: Regular Expressions in gnatfind and gnatxref, Previous: Switches for gnatfind, Up: The Cross-Referencing Tools 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
"./"
]
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
"./"
]
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
""
]
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
""
]
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
""
]
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
""
]
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
"gcc -c -I${src_dir} -g -gnatq"
]
specifies the command used to compile a single file in the application.
make_cmd=COMMAND
"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
"${main}"
]
specifies the command used to run the application.
debug_cmd=COMMAND
"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.