1
/*=========================================================================
3
Program: Insight Segmentation & Registration Toolkit
4
Module: $RCSfile: cmMakeDepend.h,v $
6
Date: $Date: 2001/08/22 15:58:17 $
7
Version: $Revision: 1.13 $
9
Copyright (c) 2001 Insight Consortium
12
Redistribution and use in source and binary forms, with or without
13
modification, are permitted provided that the following conditions are met:
15
* Redistributions of source code must retain the above copyright notice,
16
this list of conditions and the following disclaimer.
18
* Redistributions in binary form must reproduce the above copyright notice,
19
this list of conditions and the following disclaimer in the documentation
20
and/or other materials provided with the distribution.
22
* The name of the Insight Consortium, nor the names of any consortium members,
23
nor of any contributors, may be used to endorse or promote products derived
24
from this software without specific prior written permission.
26
* Modified source versions must be plainly marked as such, and must not be
27
misrepresented as being the original software.
29
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
30
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
33
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40
=========================================================================*/
41
#ifndef cmMakeDepend_h
42
#define cmMakeDepend_h
44
#include "cmMakefile.h"
45
#include "cmSourceFile.h"
46
#include "cmRegularExpression.h"
47
#include "cmStandardIncludes.h"
49
/** \class cmDependInformation
50
* \brief Store dependency information for a single source file.
52
* This structure stores the depend information for a single source file.
54
class cmDependInformation
58
* Construct with dependency generation marked not done; instance
59
* not placed in cmMakefile's list.
61
cmDependInformation(): m_DependDone(false), m_cmSourceFile(0) {}
64
* The set of files on which this one depends.
66
typedef std::set<cmDependInformation*> DependencySet;
67
DependencySet m_DependencySet;
70
* This flag indicates whether dependency checking has been
71
* performed for this file.
76
* If this object corresponds to a cmSourceFile instance, this points
79
const cmSourceFile *m_cmSourceFile;
82
* Full path to this file.
84
std::string m_FullPath;
87
* Name used to #include this file.
89
std::string m_IncludeName;
92
* This method adds the dependencies of another file to this one.
94
void AddDependencies(cmDependInformation*);
98
// cmMakeDepend is used to generate dependancy information for
99
// the classes in a makefile
104
* Construct the object with verbose turned off.
111
virtual ~cmMakeDepend();
114
* Set the makefile that is used as a source of classes.
116
virtual void SetMakefile(const cmMakefile* makefile);
119
* Get the depend info struct for a source file
121
const cmDependInformation *GetDependInformationForSourceFile(const cmSourceFile &sf) const;
124
* Add a directory to the search path for include files.
126
virtual void AddSearchPath(const char*);
129
* Generate dependencies for all the sources of all the targets
132
void GenerateMakefileDependencies();
135
* Generate dependencies for the file given. Returns a pointer to
136
* the cmDependInformation object for the file.
138
const cmDependInformation* FindDependencies(const char* file);
142
* Add a source file to the search path.
144
void AddFileToSearchPath(const char* filepath);
147
* Compute the depend information for this class.
149
virtual void DependWalk(cmDependInformation* info);
152
* Add a dependency. Possibly walk it for more dependencies.
154
virtual void AddDependency(cmDependInformation* info, const char* file);
157
* Fill in the given object with dependency information. If the
158
* information is already complete, nothing is done.
160
void GenerateDependInformation(cmDependInformation* info);
163
* Get an instance of cmDependInformation corresponding to the given file
166
cmDependInformation* GetDependInformation(const char* file);
169
* Find the full path name for the given file name.
170
* This uses the include directories.
171
* TODO: Cache path conversions to reduce FileExists calls.
173
std::string FullPath(const char*);
175
const cmMakefile* m_Makefile;
177
cmRegularExpression m_IncludeFileRegularExpression;
178
cmRegularExpression m_ComplainFileRegularExpression;
179
std::vector<std::string> m_IncludeDirectories;
180
typedef std::map<cmStdString, cmDependInformation*> DependInformationMap;
181
DependInformationMap m_DependInformationMap;