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.

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.

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

build_dir [default: "."]
The compile commands will be issued in this directory.
src_dir [default: "."]
A list of directories to search for source files, both for compile commands and source navigation.
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.

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.

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.

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

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

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

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

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

If a GNAT project file is used (for example project.gpr), this option should be set to -Pproject.gpr.

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

gnatfind_opt [default: "-rf"]
Holds user gnatfind options; used in the default find commands.

Lisp variable: ada-prj-gnatfind-switches.

main [default: current file]
Specifies the name of the executable file for the project; used in the default build commands.
main_unit [default: current Ada unit]
Specifies the name of the main Ada unit for the project; used in the default build commands.
cross_prefix [default: ""]
Name of target machine in a cross-compilation environment. Used in default compile and build commands.
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.
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.

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

make_cmd [default: "${cross_prefix}gnatmake -o ${main} ${main_unit} ${gnatmake_opt} -cargs ${comp_opt} -bargs ${bind_opt} -largs ${link_opt}"]
Command used to build the application.

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

run_cmd [default: "./${main}"]
Command used to run the application.
debug_pre_cmd [default: "cd ${build_dir}"]
Command executed before debug_cmd.
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.