GPRname Reference
GPRname scans source directories for Ada and non-Ada source files, identifies
the Ada units they contain, and generates a GPR project file with a Naming
package that maps every discovered unit to its source file. It is the standard
tool for projects where source file names do not follow the default GNAT
naming conventions.
Command Line
Syntax
gprname -P<proj>.gpr [switches] [patterns]
GPRname requires a project file name (-P). It does not use the common
project-loading infrastructure - it creates or updates the named file rather
than loading it. The common switches documented in Common Command-Line Options
do not apply, with the exception of --target and --RTS.
Patterns
One or more filename patterns may be given on the command line. Each pattern
specifies the set of files that GPRname should scan for Ada units. Patterns
use glob syntax (*, ?, [...]). If no pattern is given, GPRname
scans for nothing and produces an empty naming project.
Multiple independent sets of patterns with different source directories can
be defined using --and to separate them into sections (see below).
Switches
Project
-PprojCreate or update proj as the main project file. Required.
--no-backupDo not create a numbered backup (
.saved_0,.saved_1, …) of the existing project file before overwriting it.
Source directories
-ddirAdd dir as a source directory for the current section. May be repeated. Append
/**to search dir recursively.-DfileRead source directories from file (one directory per line).
--minimal-dirsAfter scanning, retain in
Source_Dirsonly the directories that contain at least one source file. Directories specified with/**are expanded to an explicit list of matching subdirectories.
Naming patterns
-fpatternAdd pattern as a C-language filename pattern for the current section.
-f:lang patternAdd pattern as a filename pattern for language lang.
-xpatternExclude files matching pattern from the Ada patterns of the current section.
-xfpatternExclude files matching pattern from the C patterns of the current section.
-xf:lang patternExclude files matching pattern from the lang patterns of the current section.
--andBegin a new section. Each section has its own set of source directories and patterns. Use this when different subtrees of a project have different naming conventions.
Preprocessing
-gnateDsym=valDefine preprocessor symbol sym to val when parsing Ada sources.
-gnatep=fileUse file as a preprocessor data file when parsing Ada sources.
Ada source parser
--libadalang-parserUse Libadalang to parse Ada source files (default).
--gcc-parserUse the GCC Ada compiler to parse Ada source files.
Other
--target=nameTarget for the Ada compiler used to parse sources.
--RTS=dirRuntime for the Ada compiler used to parse sources.
--ignore-duplicate-filesSilently skip a file if its basename has already been seen. Without this switch, a duplicate basename produces a warning.
--ignore-predefined-unitsDo not record predefined Ada units (
Ada,System,Interfaces, etc.) in the naming project.-vVerbose output. Repeat for more detail.
Generated files
GPRname creates or updates three files named after the project (e.g. for
-P my_proj.gpr):
my_proj.gprThe main project file. GPRname inserts or updates:
with "my_proj_naming.gpr";- import of the naming project.for Languages use (...);- languages discovered.for Source_Dirs use (...);- source directories scanned.for Source_List_File use "my_proj_source_list.txt";package Naming renames My_Proj_Naming.Naming;
my_proj_naming.gprA separate project containing only the
Namingpackage, with onefor Spec/for Bodyentry per discovered Ada unit, andfor Implementation_Exceptionsentries for non-Ada languages.my_proj_source_list.txtA plain-text list of all discovered source files, consumed by
Source_List_Filein the main project.
A numbered backup of any pre-existing project file is created before the
file is overwritten (unless --no-backup is given).
Exit Codes
0Success.
1Error (invalid option, source file not found, etc.).