Ada mode provides a much complete environment for compiling, debugging and running an application within Emacs.
All the commands used by Emacs to manipulate your application can be customized in the project file. Some default values are provided, but these will likely not be good enough for a big or even medium-sized project. See the section on the project file for an explanation on how to set up the commands to use.
One of the variables you can set in your project file,
cross_prefix
, indicates whether you are using a cross-compilation
environment, and if yes for which target. The default command used for
compilation will add this cross_prefix
in front of the name:
gcc
will become cross_prefix
-gcc
, gnatmake
will become cross_prefix
-gnatmake
, ...
This will also modify the way your application is run and debugged, although this is not implemented at the moment.
Here are the commands for building and using an Ada application
compile
command from the
Ada menu. It compiles unconditionally the current source using the
comp_cmd
variable of the project file. Compilation options can be
customized with the variable comp_opt
of the project file.
Emacs will display a new buffer that contains the result of the compilation. Each line associated with an error will become active: you can simply click on it with the middle button of the mouse, or move the cursor on it and press Return. Emacs will then display the relevant source file and put the cursor on the line and column the error was found at.
You can also simply press the C-x ` key and Emacs will jump to the first error. If you press that key again, it will move you to the second error, and so on.
Some error messages might also include references to some files. These references are also clickable in the same way.
build
command from the
Ada menu. It compiles all obsolete units of the current application
using the make_cmd
variable of the project file. Compilation
options can be customized with the variable comp_opt
of the
project file, binder options with bind_opt
and linker options
with link_opt
. The main unit of the application may be specified
with main
.
The compilation buffer is also active in the same way it was for the above command.
run
command from the
Ada menu. It executes the current application in an emacs
buffer. Arguments can be passed through before executing. The execution
buffer allows for interactive input/output.
This command is not yet available in a cross-compilation toolchain. Emacs would first need to log on the target before running the application. This will be implemented in a future release of Gnat.