Depend on generated RPC headers
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-05-15 23:24:11 UTC (rev 15326)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-05-15 23:43:28 UTC (rev 15327)
@@ -1003,6 +1003,12 @@
 {
 	return file.switches;
 }
+
+string
+MingwModuleHandler::GetRpcServerHeaderFilename ( string basename ) const
+{
+	return basename + "_s.h";
+}
 		
 void
 MingwModuleHandler::GenerateWidlCommandsServer (
@@ -1019,7 +1025,7 @@
 		backend->intermediateDirectory );
 	CLEAN_FILE(generatedHeaderFilename);
 	*/
-	string generatedHeaderFilename = basename + "_s.h";
+	string generatedHeaderFilename = GetRpcServerHeaderFilename ( basename );
 	CLEAN_FILE(generatedHeaderFilename);
 
   	string generatedServerFilename = PassThruCacheDirectory (
@@ -1044,6 +1050,12 @@
 	          file.name.c_str () );
 }
 
+string
+MingwModuleHandler::GetRpcClientHeaderFilename ( string basename ) const
+{
+	return basename + "_c.h";
+}
+
 void
 MingwModuleHandler::GenerateWidlCommandsClient (
 	const File& file,
@@ -1059,7 +1071,7 @@
 		backend->intermediateDirectory );
 	CLEAN_FILE(generatedHeaderFilename);
 	*/
-	string generatedHeaderFilename = basename + "_c.h";
+	string generatedHeaderFilename = GetRpcClientHeaderFilename ( basename );
 	CLEAN_FILE(generatedHeaderFilename);
 
   	string generatedClientFilename = PassThruCacheDirectory (
@@ -1582,6 +1594,34 @@
 }
 
 void
+MingwModuleHandler::GetRpcHeaderDependencies (
+	string_list& dependencies ) const
+{
+	for ( size_t i = 0; i < module.non_if_data.libraries.size (); i++ )
+	{
+		Library& library = *module.non_if_data.libraries[i];
+		if ( library.imported_module->type == RpcServer ||
+		     library.imported_module->type == RpcClient )
+		{
+
+			for ( size_t j = 0; j < library.imported_module->non_if_data.files.size (); j++ )
+			{
+				File& file = *library.imported_module->non_if_data.files[j];
+				string extension = GetExtension ( file.name );
+				if ( extension == ".idl" || extension == ".IDL" )
+				{
+					string basename = GetBasename ( file.name );
+					if ( library.imported_module->type == RpcServer )
+						dependencies.push_back ( GetRpcServerHeaderFilename ( basename ) );
+					if ( library.imported_module->type == RpcClient )
+						dependencies.push_back ( GetRpcClientHeaderFilename ( basename ) );
+				}
+			}
+		}
+	}
+}
+
+void
 MingwModuleHandler::GenerateOtherMacros ()
 {
 	cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ());
@@ -1597,9 +1637,9 @@
 		module.non_if_data,
 		&module.linkerFlags );
 
+	string_list s;
 	if ( module.importLibrary )
 	{
-		string_list s;
 		const vector<File*>& files = module.non_if_data.files;
 		for ( size_t i = 0; i < files.size (); i++ )
 		{
@@ -1608,19 +1648,20 @@
 			if ( extension == ".spec" || extension == ".SPEC" )
 				GetSpecObjectDependencies ( s, file.name );
 		}
-		if ( s.size () > 0 )
-		{
-			fprintf (
-				fMakefile,
-				"%s +=",
-				linkDepsMacro.c_str() );
-			for ( size_t i = 0; i < s.size(); i++ )
-				fprintf ( fMakefile,
-				          " %s",
-				          s[i].c_str () );
-			fprintf ( fMakefile, "\n" );
-		}
 	}
+	GetRpcHeaderDependencies ( s );
+	if ( s.size () > 0 )
+	{
+		fprintf (
+			fMakefile,
+			"%s +=",
+			linkDepsMacro.c_str() );
+		for ( size_t i = 0; i < s.size(); i++ )
+			fprintf ( fMakefile,
+			          " %s",
+			          s[i].c_str () );
+		fprintf ( fMakefile, "\n" );
+	}
 
 	string globalCflags = "-g";
 	if ( backend->usePipe )

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-05-15 23:24:11 UTC (rev 15326)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-05-15 23:43:28 UTC (rev 15327)
@@ -177,6 +177,9 @@
 	void GenerateBuildMapCode ();
 	void GenerateBuildNonSymbolStrippedCode ();
 	void CleanupFileVector ( std::vector<File*>& sourceFiles );
+	void GetRpcHeaderDependencies ( string_list& dependencies ) const;
+	std::string GetRpcServerHeaderFilename ( std::string basename ) const;
+	std::string GetRpcClientHeaderFilename ( std::string basename ) const;
 public:
 	const Module& module;
 	string_list clean_files;