Do automatic dependency checking for pre-compiled header files
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/automaticdependency.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/automaticdependency.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/automaticdependency.cpp	2005-05-16 11:14:04 UTC (rev 15336)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/automaticdependency.cpp	2005-05-16 11:41:54 UTC (rev 15337)
@@ -275,16 +275,30 @@
 }
 
 void
+AutomaticDependency::GetModuleFiles ( Module& module,
+                                      vector<File*>& files ) const
+{
+	for ( size_t i = 0; i < module.non_if_data.files.size (); i++ )
+		files.push_back ( module.non_if_data.files[i] );
+
+	/* FIXME: Collect files in IFs here */
+
+	if ( module.pch != NULL )
+		files.push_back ( &module.pch->file );
+}
+
+void
 AutomaticDependency::ProcessModule ( Module& module )
 {
-	const vector<File*>& files = module.non_if_data.files;
+	vector<File*> files;
+	GetModuleFiles ( module, files );
 	for ( size_t i = 0; i < files.size (); i++ )
 		ProcessFile ( module, *files[i] );
 }
 
 void
 AutomaticDependency::ProcessFile ( Module& module,
-	                               const File& file )
+                                   const File& file )
 {
 	string normalizedFilename = NormalizeFilename ( file.name );
 	RetrieveFromCacheOrParse ( module,
@@ -388,7 +402,8 @@
 	struct utimbuf timebuf;
 	for ( size_t mi = 0; mi < project.modules.size (); mi++ )
 	{
-		const vector<File*>& files = project.modules[mi]->non_if_data.files;
+		vector<File*> files;
+		GetModuleFiles ( *project.modules[mi], files );
 		for ( size_t fi = 0; fi < files.size (); fi++ )
 		{
 			File& file = *files[fi];

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-05-16 11:14:04 UTC (rev 15336)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-05-16 11:41:54 UTC (rev 15337)
@@ -840,7 +840,7 @@
 {
 	string dependencies = sourceFilename;
 	if ( module.pch && use_pch )
-		dependencies += " " + module.pch->header + ".gch";
+		dependencies += " " + module.pch->file.name + ".gch";
 	
 	/* WIDL generated headers may be used */
 	dependencies += " " + GetLinkingDependenciesMacro ();
@@ -1471,7 +1471,7 @@
 {
 	if ( module.pch )
 	{
-		const string& pch_file = module.pch->header;
+		const string& pch_file = module.pch->file.name;
 		string gch_file = pch_file + ".gch";
 		CLEAN_FILE(gch_file);
 		if ( use_pch )
@@ -2920,9 +2920,9 @@
 MingwTestModuleHandler::GetModuleSpecificSourceFiles ( vector<File*>& sourceFiles )
 {
 	string basePath = "$(INTERMEDIATE)" SSEP + module.GetBasePath ();
-	sourceFiles.push_back ( new File ( basePath + SSEP "_hooks.c", false, "" ) );
-	sourceFiles.push_back ( new File ( basePath + SSEP "_stubs.S", false, "" ) );
-	sourceFiles.push_back ( new File ( basePath + SSEP "_startup.c", false, "" ) );
+	sourceFiles.push_back ( new File ( basePath + SSEP "_hooks.c", false, "", false ) );
+	sourceFiles.push_back ( new File ( basePath + SSEP "_stubs.S", false, "", false ) );
+	sourceFiles.push_back ( new File ( basePath + SSEP "_startup.c", false, "", false ) );
 }
 
 void

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-05-16 11:14:04 UTC (rev 15336)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-05-16 11:41:54 UTC (rev 15337)
@@ -323,7 +323,8 @@
 		}
 		File* pFile = new File ( FixSeparator ( path + CSEP + e.value ),
 		                         first,
-		                         switches );
+		                         switches,
+		                         false );
 		if ( pIf )
 			pIf->data.files.push_back ( pFile );
 		else
@@ -445,7 +446,7 @@
 				e.location,
 				"Only one <pch> is valid per module" );
 		pch = new PchFile (
-			e, *this, FixSeparator ( path + CSEP + e.value ) );
+			e, *this, File ( FixSeparator ( path + CSEP + e.value ), false, "", true ) );
 		subs_invalid = true;
 	}
 	if ( subs_invalid && e.subElements.size() > 0 )
@@ -729,10 +730,12 @@
 
 
 File::File ( const string& _name, bool _first,
-	       std::string _switches )
+             std::string _switches,
+             bool _isPreCompiledHeader )
 	: name(_name),
 	  first(_first),
-	  switches(_switches)
+	  switches(_switches),
+	  isPreCompiledHeader(_isPreCompiledHeader)
 {
 }
 
@@ -1011,8 +1014,8 @@
 PchFile::PchFile (
 	const XMLElement& node_,
 	const Module& module_,
-	const string& header_ )
-	: node(node_), module(module_), header(header_)
+	const File file_ )
+	: node(node_), module(module_), file(file_)
 {
 }
 

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-05-16 11:14:04 UTC (rev 15336)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-05-16 11:41:54 UTC (rev 15337)
@@ -278,10 +278,12 @@
 	std::string name;
 	bool first;
 	std::string switches;
+	bool isPreCompiledHeader;
 
 	File ( const std::string& _name,
 	       bool _first,
-	       std::string _switches );
+	       std::string _switches,
+	       bool _isPreCompiledHeader );
 
 	void ProcessXML();
 	bool IsGeneratedFile () const;
@@ -570,6 +572,8 @@
 	void CheckAutomaticDependencies ( bool verbose );
 	void CheckAutomaticDependenciesForFile ( SourceFile* sourceFile );
 private:
+	void GetModuleFiles ( Module& module,
+                              std::vector<File*>& files ) const;
 	void ProcessModule ( Module& module );
 	void ProcessFile ( Module& module,
 	                   const File& file );
@@ -640,12 +644,12 @@
 public:
 	const XMLElement& node;
 	const Module& module;
-	std::string header;
+	File file;
 
 	PchFile (
 		const XMLElement& node,
 		const Module& module,
-		const std::string& header );
+		const File file );
 	void ProcessXML();
 };