Previous: GUI Editor, Up: Project files

5.3 Project file variables

The following variables can be defined in a project file; some can also be defined in lisp variables.

To set a project variable that is a list, specify each element of the list on a separate line in the project file.

Any project variable can be referenced in other project variables, using a shell-like notation. For instance, if the variable comp_cmd contains ${comp_opt}, the value of the comp_opt variable will be substituted when comp_cmd is used.

In addition, process environment variables can be referenced using the same syntax, or the normal $var syntax.

Most project variables have defaults that can be changed by setting lisp variables; the table below identifies the lisp variable for each project variable. Lisp variables corresponding to project variables that are lists are lisp lists.

In general, project variables are evaluated when referenced in Emacs Ada mode commands. Relative file paths are expanded to absolute relative to ${build_dir}.

Here is the list of variables. In the default values, the current directory "." is the project file directory.

ada_project_path_sep [default: ":" or ";"]
Path separator for ADA_PROJECT_PATH. It defaults to the correct value for a native implementation of GNAT for the current operating system. The user must override this when using Windows native GNAT with Cygwin Emacs, and perhaps in other cases.

Lisp variable: ada-prj-ada-project-path-sep.

ada_project_path [default: ""]
A list of directories to search for GNAT project files.

If set, the ADA_PROJECT_PATH process environment variable is set to this value in the Emacs process when the Emacs Ada mode project is selected via menu ‘Ada | Project | Load’.

For ada_project_path, relative file paths are expanded to absolute when the Emacs Ada project file is read, rather than when the project file is selected.

For example if the project file is in the directory /home/myproject, the environment variable GDS_ROOT is set to /home/shared, and the project file contains:

          ada_project_path_sep=:
          ada_project_path=$GDS_ROOT/makerules
          ada_project_path=../opentoken

then as a result the environment variable ADA_PROJECT_PATH will be set to "/home/shared/makerules:/home/opentoken/".

The default value is not the current value of this environment variable, because that will typically have been set by another project, and will therefore be incorrect for this project.

If you have the environment variable set correctly for all of your projects, you do not need to set this project variable.

bind_opt [default: ""]
Holds user binder options; used in the default build commands.

Lisp variable: ada-prj-default-bind-opt.

build_dir [default: "."]
The compile commands will be issued in this directory.
casing [default: ("~/.emacs_case_exceptions")]
List of files containing casing exceptions. See the help on ada-case-exception-file for more info.

Lisp variable: ada-case-exception-file.

check_cmd [default: "${cross_prefix}gnatmake -u -c -gnatc ${gnatmake_opt} ${full_current} -cargs ${comp_opt}"]
Command used to syntax check a single file. The name of the file is substituted for full_current.

Lisp variable: ada-prj-default-check-cmd

comp_cmd [default: "${cross_prefix}gnatmake -u -c ${gnatmake_opt} ${full_current} -cargs ${comp_opt}"]
Command used to compile a single file. The name of the file is substituted for full_current.

Lisp variable: ada-prj-default-comp-cmd.

comp_opt [default: "-gnatq -gnatQ"]
Holds user compiler options; used in the default compile commands. The default value tells gnatmake to generate library files for cross-referencing even when there are errors.

If source code for the project is in multiple directories, the appropriate compiler options must be added here. Set source search path for examples of this. Alternately, GNAT project files may be used; Use GNAT project file.

Lisp variable: ada-prj-default-comp-opt.

cross_prefix [default: ""]
Name of target machine in a cross-compilation environment. Used in default compile and build commands.
debug_cmd [default: "${cross_prefix}gdb ${main}"]
Command used to debug the application

Lisp variable: ada-prj-default-debugger.

debug_post_cmd [default: ""]
Command executed after debug_cmd.
debug_pre_cmd [default: "cd ${build_dir}"]
Command executed before debug_cmd.
gnatfind_opt [default: "-rf"]
Holds user gnatfind options; used in the default find commands.

Lisp variable: ada-prj-gnatfind-switches.

gnatmake_opt [default: "-g"]
Holds user gnatmake options; used in the default build commands.

Lisp variable: ada-prj-default-gnatmake-opt.

gpr_file [default: ""]
Specify GNAT project file.

If set, the source and object directories specified in the GNAT project file are appended to src_dir and obj_dir. This allows specifying Ada source directories with a GNAT project file, and other source directories with the Emacs project file.

In addition, -P{gpr_file} is added to the project variable gnatmake_opt whenever it is referenced. With the default project variables, this passes the project file to all gnatmake commands.

Lisp variable: ada-prj-default-gpr-file.

link_opt [default: ""]
Holds user linker options; used in the default build commands.

Lisp variable: ada-prj-default-link-opt.

main [default: current file]
Specifies the name of the executable file for the project; used in the default build commands.
make_cmd [default: "${cross_prefix}gnatmake -o ${main} ${main} ${gnatmake_opt} -cargs ${comp_opt} -bargs ${bind_opt} -largs ${link_opt}"]
Command used to build the application.

Lisp variable: ada-prj-default-make-cmd.

obj_dir [default: "."]
A list of directories to search for library files. Ada mode searches this list for the ‘.ali’ files generated by GNAT that contain cross-reference information.

The compiler commands must place the ‘.ali’ files in one of these directories; the default commands do that.

remote_machine [default: ""]
Name of the machine to log into before issuing the compile and build commands. If this variable is empty, the command will be run on the local machine.
run_cmd [default: "./${main}"]
Command used to run the application.
src_dir [default: "."]
A list of directories to search for source files, both for compile commands and source navigation.