Next: , Previous: Running gnatname, Up: Handling Arbitrary File Naming Conventions Using gnatname


10.3 Switches for gnatname

Switches for gnatname must precede any specified Naming Pattern.

You may specify any of the following switches to gnatname:

--version
Display Copyright and version, then exit disregarding all other options.
--help
If --version was not used, display usage, then exit disregarding all other options.
--and
Start another section of directories/patterns.
-cfile
Create a configuration pragmas file file (instead of the default gnat.adc). There may be zero, one or more space between -c and file. file may include directory information. file must be writable. There may be only one switch -c. When a switch -c is specified, no switch -P may be specified (see below).
-ddir
Look for source files in directory dir. There may be zero, one or more spaces between -d and dir. When a switch -d is specified, the current working directory will not be searched for source files, unless it is explicitly specified with a -d or -D switch. Several switches -d may be specified. If dir is a relative path, it is relative to the directory of the configuration pragmas file specified with switch -c, or to the directory of the project file specified with switch -P or, if neither switch -c nor switch -P are specified, it is relative to the current working directory. The directory specified with switch -d must exist and be readable.
-Dfile
Look for source files in all directories listed in text file file. There may be zero, one or more spaces between -D and file. file must be an existing, readable text file. Each nonempty line in file must be a directory. Specifying switch -D is equivalent to specifying as many switches -d as there are nonempty lines in file.
-fpattern
Foreign patterns. Using this switch, it is possible to add sources of languages other than Ada to the list of sources of a project file. It is only useful if a -P switch is used. For example,
          gnatname -Pprj -f"*.c" "*.ada"

will look for Ada units in all files with the .ada extension, and will add to the list of file for project prj.gpr the C files with extension .c.

-h
Output usage (help) information. The output is written to stdout.
-Pproj
Create or update project file proj. There may be zero, one or more space between -P and proj. proj may include directory information. proj must be writable. There may be only one switch -P. When a switch -P is specified, no switch -c may be specified.
-v
Verbose mode. Output detailed explanation of behavior to stdout. This includes name of the file written, the name of the directories to search and, for each file in those directories whose name matches at least one of the Naming Patterns, an indication of whether the file contains a unit, and if so the name of the unit.
-v -v
Very Verbose mode. In addition to the output produced in verbose mode, for each file in the searched directories whose name matches none of the Naming Patterns, an indication is given that there is no match.
-xpattern
Excluded patterns. Using this switch, it is possible to exclude some files that would match the name patterns. For example,
          gnatname -x "*_nt.ada" "*.ada"

will look for Ada units in all files with the .ada extension, except those whose names end with _nt.ada.