www.delorie.com/gnu/docs/gcc/gnat_ug_128.html   search  
 
Buy the book!


Untitled Document

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.4.4 Source File Names

In a project that contains source files, their names may be specified by the attributes Source_Files (a string list) or Source_List_File (a string). Source file names never include any directory information.

If the attribute Source_Files is given an explicit value, then each element of the list is a source file name.

 
   for Source_Files use ("main.adb");
   for Source_Files use ("main.adb", "pack1.ads", "pack2.adb");

If the attribute Source_Files is not given an explicit value, but the attribute Source_List_File is given a string value, then the source file names are contained in the text file whose path name (absolute or relative to the directory of the project file) is the value of the attribute Source_List_File.

Each line in the file that is not empty or is not a comment contains a source file name. A comment line starts with two hyphens.

 
   for Source_List_File use "source_list.txt";

By default, if neither the attribute Source_Files nor the attribute Source_List_File is given an explicit value, then each file in the source directories that conforms to the project's naming scheme (see 10.10 Naming Schemes) is an immediate source of the project.

A warning is issued if both attributes Source_Files and Source_List_File are given explicit values. In this case, the attribute Source_Files prevails.

Each source file name must be the name of one and only one existing source file in one of the source directories.

A Source_Files attribute defined with an empty list as its value indicates that there are no source files in the project.

Except for projects that are clearly specified as containing no Ada source files (Source_Dirs or Source_Files specified as an empty list, or Languages specified without "Ada" in the list)
 
   for Source_Dirs use ();
   for Source_Files use ();
   for Languages use ("C", "C++");

a project must contain at least one immediate source.

Projects with no source files are useful as template packages (see 10.8 Packages in Project Files) for other projects; in particular to define a package Naming (see 10.10 Naming Schemes).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003