summaryrefslogtreecommitdiffstats
path: root/Source/cmMakeDepend.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2001-07-17 19:09:16 (GMT)
committerBrad King <brad.king@kitware.com>2001-07-17 19:09:16 (GMT)
commit82c1916a6d1c5f01bece5d773b9739b5d546a594 (patch)
tree480a61427d133fcda0114f8e9609fe8d91ba952b /Source/cmMakeDepend.h
parentc5381e85885c289d0669d5f3ddb5e3d2d3d2e5dd (diff)
downloadCMake-82c1916a6d1c5f01bece5d773b9739b5d546a594.zip
CMake-82c1916a6d1c5f01bece5d773b9739b5d546a594.tar.gz
CMake-82c1916a6d1c5f01bece5d773b9739b5d546a594.tar.bz2
ENH: Hacked together a new implementation of the dependency generator code. This should support finding dependencies for individual files without doing them for the entire makefile. Use cmMakeDepend::FindDependencies() to do this.
Diffstat (limited to 'Source/cmMakeDepend.h')
-rw-r--r--Source/cmMakeDepend.h88
1 files changed, 42 insertions, 46 deletions
diff --git a/Source/cmMakeDepend.h b/Source/cmMakeDepend.h
index b49f8cd..fabb47f 100644
--- a/Source/cmMakeDepend.h
+++ b/Source/cmMakeDepend.h
@@ -58,46 +58,40 @@ public:
* Construct with dependency generation marked not done; instance
* not placed in cmMakefile's list.
*/
- cmDependInformation()
- {
- m_DependDone = false;
- m_ClassFileIndex = 0;
- }
+ cmDependInformation(): m_DependDone(false), m_cmSourceFile(0) {}
/**
- * A set of indices into the m_DependInformation array of cmMakeDepend.
- * The index represents the files that this file depends on.
- * This must be a "set" to keep indices unique.
+ * The set of files on which this one depends.
*/
- typedef std::set<int> IndexSet;
- IndexSet m_IndexSet;
+ typedef std::set<cmDependInformation*> DependencySet;
+ DependencySet m_DependencySet;
/**
- * Full path to this file.
+ * This flag indicates whether dependency checking has been
+ * performed for this file.
*/
- std::string m_FullPath;
+ bool m_DependDone;
/**
- * Name that the include directive uses.
+ * If this object corresponds to a cmSourceFile instance, this points
+ * to it.
*/
- std::string m_IncludeName;
-
+ const cmSourceFile *m_cmSourceFile;
+
/**
- * The index into the cmMakefile::m_Classes list.
- * The index value of 0 indicates that it is not in the list.
+ * Full path to this file.
*/
- const cmSourceFile *m_ClassFileIndex;
+ std::string m_FullPath;
/**
- * This flag indicates whether dependency checking has been
- * performed for this file.
+ * Name used to #include this file.
*/
- bool m_DependDone;
+ std::string m_IncludeName;
/**
* This method adds the dependencies of another file to this one.
*/
- void MergeInfo(cmDependInformation*);
+ void AddDependencies(cmDependInformation*);
};
@@ -122,58 +116,59 @@ public:
virtual void SetMakefile(const cmMakefile* makefile);
/**
- * Generate the depend information
- */
- virtual void GenerateDependInformation();
-
- /**
* Get the depend info struct for a source file
*/
const cmDependInformation *GetDependInformationForSourceFile(const cmSourceFile &sf) const;
- const cmDependInformation *GetDependInformationForSourceFile(const char *) const;
-
- /**
- * Get the depend info struct
- */
- typedef std::vector<cmDependInformation*> DependArray;
- const DependArray &GetDependInformation() const {
- return m_DependInformation; }
/**
* Add a directory to the search path for include files.
*/
virtual void AddSearchPath(const char*);
-protected:
/**
- * Add a source file to the search path.
+ * Generate dependencies for all the sources of all the targets
+ * in the makefile.
*/
- void AddFileToSearchPath(const char* filepath);
+ void GenerateMakefileDependencies();
/**
- * Find the index into the m_DependInformation array
- * that matches the given m_IncludeName.
+ * Generate dependencies for the file given. Returns a pointer to
+ * the cmDependInformation object for the file.
*/
- virtual int FindInformation(const char* includeName);
+ const cmDependInformation* FindDependencies(const char* file);
+protected:
/**
- * Compute the depend information for this class.
+ * Add a source file to the search path.
*/
- virtual void Depend(cmDependInformation* info);
+ void AddFileToSearchPath(const char* filepath);
/**
* Compute the depend information for this class.
*/
- virtual void DependWalk(cmDependInformation* info, const char* file);
+ virtual void DependWalk(cmDependInformation* info);
/**
* Add a dependency. Possibly walk it for more dependencies.
*/
virtual void AddDependency(cmDependInformation* info, const char* file);
-
+
+ /**
+ * Fill in the given object with dependency information. If the
+ * information is already complete, nothing is done.
+ */
+ void GenerateDependInformation(cmDependInformation* info);
+
+ /**
+ * Get an instance of cmDependInformation corresponding to the given file
+ * name.
+ */
+ cmDependInformation* GetDependInformation(const char* file);
+
/**
* Find the full path name for the given file name.
* This uses the include directories.
+ * TODO: Cache path conversions to reduce FileExists calls.
*/
std::string FullPath(const char*);
@@ -181,8 +176,9 @@ protected:
bool m_Verbose;
cmRegularExpression m_IncludeFileRegularExpression;
cmRegularExpression m_ComplainFileRegularExpression;
- DependArray m_DependInformation;
std::vector<std::string> m_IncludeDirectories;
+ typedef std::map<std::string, cmDependInformation*> DependInformationMap;
+ DependInformationMap m_DependInformationMap;
};
#endif