[ros-diffs] [hpoussin] 30217: Don't hardcode multiple times the mechanisms to get object file from source file Revert r30188 and r30189

hpoussin at svn.reactos.org hpoussin at svn.reactos.org
Tue Nov 6 13:18:36 CET 2007


Author: hpoussin
Date: Tue Nov  6 15:18:36 2007
New Revision: 30217

URL: http://svn.reactos.org/svn/reactos?rev=30217&view=rev
Log:
Don't hardcode multiple times the mechanisms to get object file from source file
Revert r30188 and r30189

Modified:
    trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp

Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp?rev=30217&r1=30216&r2=30217&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Tue Nov  6 15:18:36 2007
@@ -270,33 +270,24 @@
 	string extension = GetExtension ( *file );
 	if ( extension == ".spec" || extension == ".SPEC" )
 	{
-		string basename = GetBasename ( filename );
-		return new FileLocation (
-			IntermediateDirectory,
-			file->relative_path,
-			basename + ".stubs.c" );
-	}
-	else if ( extension == ".idl" || extension == ".IDL" )
-	{
-		string basename = GetBasename ( filename );
-		if ( module.type == RpcServer )
-		{
-			return new FileLocation (
-				IntermediateDirectory,
-				file->relative_path,
-				basename + "_s.c" );
-		}
-		else if ( module.type == RpcClient )
-		{
-			return new FileLocation (
-				IntermediateDirectory,
-				file->relative_path,
-				basename + "_c.c" );
-		}
-		else
-		{
-			return new FileLocation ( *file );
-		}
+		const FileLocation *objectFile = GetObjectFilename ( file, module, NULL );
+		FileLocation *sourceFile = new FileLocation (
+			objectFile->directory,
+			objectFile->relative_path,
+			ReplaceExtension ( objectFile->name, ".c" ) );
+		delete objectFile;
+		return sourceFile;
+	}
+	else if ( ( extension == ".idl" || extension == ".IDL" ) &&
+	          ( module.type == RpcServer || module.type == RpcClient ) )
+	{
+		const FileLocation *objectFile = GetObjectFilename ( file, module, NULL );
+		FileLocation *sourceFile = new FileLocation (
+			objectFile->directory,
+			objectFile->relative_path,
+			ReplaceExtension ( objectFile->name, ".c" ) );
+		delete objectFile;
+		return sourceFile;
 	}
 	else
 		return new FileLocation ( *file );
@@ -509,13 +500,13 @@
 	if ( extension == ".rc" || extension == ".RC" )
 		newExtension = "_" + module.name + ".coff";
 	else if ( extension == ".spec" || extension == ".SPEC" )
-		newExtension = ".stubs_" + module.name + ".o";
+		newExtension = ".stubs.o";
 	else if ( extension == ".idl" || extension == ".IDL" )
 	{
 		if ( module.type == RpcServer )
-			newExtension = "_s_" + module.name + ".o";
+			newExtension = "_s.o";
 		else if ( module.type == RpcClient )
-			newExtension = "_c_" + module.name + ".o";
+			newExtension = "_c.o";
 		else
 			newExtension = ".h";
 	}
@@ -1119,10 +1110,9 @@
 const FileLocation*
 MingwModuleHandler::GetPrecompiledHeaderFilename () const
 {
-	const string& basePchFilename = module.pch->file.name + "_" + module.name + ".gch";
 	return new FileLocation ( IntermediateDirectory,
 	                          module.pch->file.relative_path,
-	                          basePchFilename );
+	                          ReplaceExtension ( module.pch->file.name, "_" + module.name + ".gch" ) );
 }
 
 void
@@ -1132,7 +1122,8 @@
 	const string& cc,
 	const string& cflagsMacro )
 {
-	string dependencies = backend->GetFullName ( *sourceFile );
+	const FileLocation *generatedSourceFileName = GetActualSourceFilename ( sourceFile );
+	string dependencies = backend->GetFullName ( *generatedSourceFileName );
 	if ( extraDependencies != "" )
 		dependencies += " " + extraDependencies;
 	if ( module.pch && use_pch )
@@ -1261,9 +1252,7 @@
 	                        basename + ".spec.def" );
 	CLEAN_FILE ( def_file );
 
-	FileLocation stub_file ( IntermediateDirectory,
-	                        sourceFile->relative_path,
-	                        basename + ".stubs.c" );
+	FileLocation stub_file ( *GetActualSourceFilename ( sourceFile ) );
 	CLEAN_FILE ( stub_file );
 
 	fprintf ( fMakefile,
@@ -1472,7 +1461,7 @@
 		                             widlflagsMacro );
 	else if ( module.type == EmbeddedTypeLib )
 		GenerateWidlCommandsEmbeddedTypeLib ( compilationUnit,
-										widlflagsMacro );
+		                                      widlflagsMacro );
 	else // applies also for other module.types which include idl files
 		GenerateWidlCommandsIdlHeader ( compilationUnit,
 		                                widlflagsMacro );
@@ -1531,7 +1520,7 @@
 	else if ( extension == ".spec" || extension == ".SPEC" )
 	{
 		GenerateWinebuildCommands ( sourceFile );
-		GenerateGccCommand ( GetActualSourceFilename ( sourceFile ),
+		GenerateGccCommand ( sourceFile,
 		                     extraDependencies,
 		                     cc,
 		                     cflagsMacro );
@@ -1543,7 +1532,7 @@
 		                       widlflagsMacro );
 		if ( (module.type == RpcServer) || (module.type == RpcClient) )
 		{
-			GenerateGccCommand ( GetActualSourceFilename ( sourceFile ),
+			GenerateGccCommand ( sourceFile,
 			                     GetExtraDependencies ( sourceFile ),
 			                     cc,
 			                     cflagsMacro );
@@ -3481,12 +3470,12 @@
 		vSourceFiles.push_back ( srcunattend );
 
 	// bootsector
-	FileLocation isoboot ( OutputDirectory,
-	                       "boot" + sSep + "freeldr" + sSep + "bootsect",
-	                       module.type == IsoRegTest
-	                           ? "isobtrt_isobtrt.o"
-	                           : "isoboot_isoboot.o" );
-	vSourceFiles.push_back ( isoboot );
+	const Module* bootModule;
+	bootModule = module.project.LocateModule ( module.type == IsoRegTest
+	                                               ? "isobtrt"
+	                                               : "isoboot" );
+	const FileLocation *isoboot = bootModule->output;
+	vSourceFiles.push_back ( *isoboot );
 
 	// prepare reactos.dff and reactos.inf
 	FileLocation reactosDff ( SourceDirectory,
@@ -3518,7 +3507,7 @@
 	fprintf ( fMakefile,
 	          "%s: all %s %s %s $(CABMAN_TARGET) $(CDMAKE_TARGET) %s\n",
 	          module.name.c_str (),
-	          backend->GetFullName ( isoboot ).c_str (),
+	          backend->GetFullName ( *isoboot ).c_str (),
 	          sourceFiles.c_str (),
 	          cdFiles.c_str (),
 	          cdDirectories.c_str () );
@@ -3544,7 +3533,7 @@
 	fprintf ( fMakefile, "\t$(ECHO_CDMAKE)\n" );
 	fprintf ( fMakefile,
 	          "\t$(Q)$(CDMAKE_TARGET) -v -j -m -b %s %s REACTOS %s\n",
-	          backend->GetFullName ( isoboot ).c_str (),
+	          backend->GetFullName ( *isoboot ).c_str (),
 	          backend->GetFullPath ( bootcd ).c_str (),
 	          IsoName.c_str() );
 	fprintf ( fMakefile,




More information about the Ros-diffs mailing list