Switches for gnatname (GNAT User’s Guide for Native Platforms)

#### 3.3.4.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.

`--subdirs=`dir'`

  Actual object, library or exec directories are subdirectories <dir> of the specified ones.

`--no-backup`

  Do not create a backup copy of an existing project file.

`--and`

  Start another section of directories/patterns.

`-c`filename'`

  Create a configuration pragmas file `filename` (instead of the default `gnat.adc`). There may be zero, one, or more space between `-c` and `filename`. `filename` may include directory information. `filename` must be writable. You can specify only one switch `-c`. When a switch `-c` is specified, you may not specify switch `-P` (see below).

`-d`dir'`

  Look for source files in directory `dir`. You may put zero, one or more spaces between `-d` and `dir`. `dir` may end with `/**`, i.e., you may write it the form `root_dir/**`. In this case, the directory `root_dir` and all of its subdirectories, recursively, have to be searched for sources. When you specify a `-d` switch, the current working directory will is not searched for source files unless you explicitly specify it with a `-d` or `-D` switch. You may specify several switches `-d`. 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 you don’t specify either switch `-c` or switch `-P`, it’s relative to the current working directory. The directory you specified with switch `-d` must exist and be readable.

`-D`filename'`

  Look for source files in all directories listed in text file `filename`. You may place zero, one or more spaces between `-D` and `filename`. `filename` must be an existing, readable text file. Each nonempty line in `filename` must be a directory. Specifying switch `-D` is equivalent to specifying as many switches `-d` as there are nonempty lines in `file`.

`-eL`

  Follow symbolic links when processing project files.

`-f`pattern'`

  Foreign patterns. Using this switch, you can add sources of languages other than Ada to the list of sources of a project file, but it’s only useful if you also specify a `-P` switch. For example,

      gnatname -Pprj -f"*.c" "*.ada"

  looks for Ada units in all files with the `.ada` extension, and adds the C files with extension `.c` to the list of file for project `prj.gpr` .

`-h`

  Output usage (help) information. The output is written to `stdout`.

`-P`proj'`

> Create or update project file `proj`. You may place 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 you specify switch `-P`, you may not also include switch `-c`. On all platforms except VMS when `gnatname` is invoked for an existing project file `<proj>.gpr``, `gnatname` creates a backup copy of the project file in the project directory with file name `<proj>.gpr.saved_x` where `x` is the first non negative number that creates a unique filename.

`-v`

  Verbose mode. Output detailed explanation of what it’s doing to `stdout`. This includes name of the file written, the name of the directories searched, 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 (a single `-v` switch), for each file in the searched directories whose name matches none of the Naming Patterns, `gnatname` indicates that there is no match.

`-x`pattern'`

  Excluded patterns. Using this switch, you can exclude some files that otherwise would match the name patterns. For example,

      gnatname -x "*_nt.ada" "*.ada"

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