With the ERC32 Ada source-based library system, the compiler must be able to find source files for units that are needed by the unit being compiled. Search paths are used to guide this process.
The compiler compiles one source file whose name must be given explicitly on the command line. In other words, no searching is done for this file. To find all other source files that are needed (the most common being the specs of units), the compiler looks in the following directories, in the following order:
The directory containing the source file of the main unit being compiled (the file name on the command line).
Each directory named by an -I switch given on the gcc command line, in the order given.
Each of the directories listed in the value of the ADA_INCLUDE_PATH environment variable. Construct this value exactly as the PATH environment variable: a list of directory names separated by colons.
The default location for the ERC32 Ada Run Time Library (RTL) source files. This is determined at the time ERC32 Ada is built and installed on your system.
Specifying the switch -I- inhibits the use of the directory containing the source file named in the command line. You can still have this directory on your search path, but in this case it must be explicitly requested with a -I switch.
The compiler outputs its object files and ALI files in the current working directory. Caution: The object file can be redirected with the -o switch; however, gcc and gnat1 have not been coordinated on this so the ALI file will not go to the right place. Therefore, you should avoid using the -o switch.
The packages Ada, System, and Interfaces and their children make up the ERC32 Ada RTL, together with the simple System.IO package used in the "Hello World" example. The sources for these units are needed by the compiler and are kept together in one directory. Not all of the bodies are needed, but all of the sources are kept together anyway. In a normal installation, you need not specify these directory names when compiling or binding. Either the environment variables or the built-in defaults cause these files to be found.
In addition to the language-defined hierarchies (System, Ada and Interfaces), the ERC32 Ada distribution provides a fourth hierarchy, consisting of child units of ERC32 Ada. This is a collection of generally useful routines. See the ERC32 Ada reference manual for further details.
Besides the assistance in using the RTL, a major use of search paths is in compiling sources from multiple directories. This can make development environments much more flexible.