Next: Initialization, Previous: Command Line, Up: Building with GPRbuild [Contents][Index]
GPRbuild takes into account switches that may be specified on the command line or in attributes Switches(<main or language>) or Default_Switches (<language) in package Builder of the main project.
When there are a single main (specified on the command line or in attribute Main in the main project), the switches that are taken into account in package Builder of the main project are Switches (<main>), if declared, or Switches (<language of main>), if declared.
When there are several mains, if there are sources of the same language, then Switches (<language of main>) is taken into account, if specified.
When there are no main specified, if there is only one compiled language (that is a language with a non empty Compiler Driver), then Switches (<single language>) is taken into account, if specified.
The switches that are interpreted directly by GPRbuild are listed below.
First, the switches that may be specified only on the command line, but not in package Builder of the main project:
Display information about GPRbuild: version, origin and legal status, then exit successfully, ignoring other options.
Display GPRbuild usage, then exit successfully, ignoring other options.
Display two lines: the configuration project file search path and the user project file search path, then exit successfully, ignoring other options.
This specifies the configuration project file name. By default, the configuration project file name is default.cgpr. Option --config= cannot be specified more than once. The configuration project file specified with --config= must exist.
This specifies a configuration project file name that already exists or will be created automatically. Option --autoconf= cannot be specified more than once. If the configuration project file specified with --autoconf= exists, then it is used. Otherwise, GPRconfig is invoked to create it automatically.
This specifies that the default configuration project file is <targetname>.cgpr. If no configuration project file with this name is found, then GPRconfig is invoked with option --target=<targetname>to create a configuration project file auto.cgpr.
Note: only one of --config, --autoconf or --target= can be specified.
Do not check if an object has been created after compilation.
This indicates that the real directories (except the source directories) are subdirectories of the directories specified in the project files. This applies in particular to object directories, library directories and exec directories. If the directories do not exist, they are created automatically.
Allow shared library projects to import projects that are not shared library projects.
Specify a source info file. If the source info file is specified as a relative path, then it is relative to the object directory of the main project. If the source info file does not exist, then after the Project Manager has successfully parsed and processed the project files and found the sources, it creates the source info file. If the source info file already exists and can be read successfully, then the Project Manager will get all the needed information about the sources from the source info file and will not look for them. This reduces the time to process the project files, especially when looking for sources that take a long time. If the source info file exists but cannot be parsed successfully, the Project Manager will attempt to recreate it. If the Project Manager fails to create the source info file, a message is issued, but GPRbuild does not fail.
Specify to GPRbuild to add directory dir to the user project file search path, before the default directory.
Specify to GPRbuild that the post-compilation (or binding) phase is to be performed, but not the other phases unless they are specified by appropriate switches.
Specify to GPRbuild that the compilation phase is to be performed, but not the other phases unless they are specified by appropriate switches.
Display progress for each source, up to date or not, as a single line completed x out of y (zz%).... If the file needs to be compiled this is displayed after the invocation of the compiler. These lines are displayed even in quiet output mode (switch -q).
By default, symbolic links on project files are not taken into account when processing project files. Switch -eL changes this default behavior.
This switch is only accepted for compatibility with gnatmake, but it has no effect. For gnatmake, it means: echo commands to standard output instead of standard error, but for gprbuild, commands are always echoed to standard output.
By default, in non verbose mode, when an error occurs while processing a project file, only the simple name of the project file is displayed in the error message. When switch -F is used, the full path of the project file is used. This switch has no effect when switch -v is used.
Specify to GPRbuild that the linking phase is to be performed, but not the other phases unless they are specified by appropriate switches.
Do not recompile Ada code if timestamps are different but checksums are the same.
Specify the file name of the executable. Switch -o can
be used only if there is exactly one executable being built;
that is, there is exactly one main on the command line,
or there are no mains on the command line and exactly one
main in attribute Main
of the main project.
Specify the path name of the main project file. The space between -P and the project file name is optional. Specifying a project file name (with suffix .gpr) may be used in place of option -P. Exactly one main project file can be specified.
This switch has an effect only when -c or -u is also specified and there are no mains: it means that all sources of all projects need to be compiled or recompiled.
If there are sources specified on the command line, only compile these sources. If there are no sources specified on the command line, compile all the sources of the main project.
In both cases, do not attempt the binding and the linking phases.
If there are sources specified on the command line, only compile these sources. If there are no sources specified on the command line, compile all the sources of all the projects in the project tree.
In both cases, do not attempt the binding and the linking phases.
By default, GPRbuild does not display anything when processing project files, except when there are errors. This default behavior is obtained with switch -vP0. Switches -vP1 and -vP2 yield increasingly detailed output.
Specify an external reference that may be queried inside the project files
using built-in function external
. For example, with
-XBUILD=DEBUG,
external("BUILD")
inside a project file will have the value
"DEBUG"
.
Then, the switches that may be specified on the command line as well as in package Builder of the main project (attribute Switches):
When linking an executable, if supported by the platform, create a map file with the same name as the executable, but with suffix .map.
When linking an executable, if supported by the platform, create a map file with file name <map file>.
This indicates that sources of a project should import only sources or header files from directly imported projects, that is those projects mentioned in a with clause and the projects they extend directly or indirectly. A check is done in the compilation phase, after a successful compilation, that the sources follow these restrictions. For Ada sources, the check is fully enforced. For non Ada sources, the check is partial, as in the dependency file there is no distinction between header files directly included and those indirectly included. The check will fail if there is no possibility that a header file in a non directly imported project could have been indirectly imported. If the check fails, the compilation artifacts (dependency file, object file, switches file) are deleted.
This indicates that sources of a project can import sources or header files from directly or indirectly imported projects. This is the default behavior. This switch is provided to cancel a previous switch --no-indirect-imports on the command line.
Forbid the sources of the same Ada unit to be in different projects.
Disallow several simultaneous compilations for the same object directory.
Force the complete processing of all phases (or of those explicitly specified) even when up to date.
By default, GPRbuild invokes one compiler at a time. With switch -j, it is possible to instruct GPRbuild to spawn several simultaneous compilation jobs if needed. For example, -j2 for two simultaneous compilation jobs or -j4 for four. On a multi-processor system, -j<num> can greatly speed up the build process.
By default, GPRbuild stops spawning new compilation jobs at the first compilation failure. Using switch -k, it is possible to attempt to compile/recompile all the sources that are not up to date, even when some compilations failed. The post-compilation phase and the linking phase are never attempted if there are compilation failures, even when switch -k is used.
By default, GPRbuild checks that the object, library and exec directories specified in project files exist. Switch -p instructs GPRbuild to attempt to create missing directories. Note that these switches may be specified in package Builder of the main project, but they are useless there as either the directories already exist or the processing of the project files has failed before the evaluation of the Builder switches, because there is at least one missing directory.
Do not display anything except errors and progress (switch -d). Cancel any previous switch -v.
Do not use a run path option to link executables or shared libraries, even when attribute Run_Path_Option is specified.
By default, GPRbuild will not recompile a source if all dependencies are satisfied. Switch -s instructs GPRbuild to recompile sources when a different set of compilation switches has been used in the previous compilation, even if all dependencies are satisfied. Each time GPRbuild invokes a compiler, it writes a text file that lists the switches used in the invocation of the compiler, so that it can retrieve these switches if -s is used later.
Display full paths, all options used in spawned processes, and reasons why these processes are spawned. Cancel any previous switch -q.
Verbose output. Some verbose messages are not displayed.
Verbose output. Some verbose messages may not be displayed.
Equivalent to -v.
When -we is used, any warning during the processing of the project files becomes an error and GPRbuild does not attempt any of the phases.
Switch -wn may be used to restore the default after -we or -ws.
Do not generate any warnings while processing the project files.
Switches that are accepted for compatibility with gnatmake, either on the command line or in the Builder Ada switches in the main project file:
These switches are passed to the Ada compiler.