Author: hpoussin
Date: Fri Feb 29 15:45:34 2008
New Revision: 32531
URL:
http://svn.reactos.org/svn/reactos?rev=32531&view=rev
Log:
Remove parameters from GenerateLinkerCommand() ; they can be detected there
Factorize some code in GenerateCommands()
Modified:
trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Fri Feb 29 15:45:34 2008
@@ -334,7 +334,7 @@
string dependencies = backend->GetFullName ( *header );
delete header;
- return dependencies;
+ return " " + dependencies;
}
else
return "";
@@ -352,7 +352,7 @@
const File& file = *compilationUnit.GetFiles ()[i];
sourceFiles.push_back ( backend->GetFullName ( file.file ) );
}
- return v2s ( sourceFiles, 10 );
+ return string ( " " ) + v2s ( sourceFiles, 10 );
}
/* caller needs to delete the returned object */
@@ -1285,7 +1285,6 @@
"\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o
$(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c --pedll
$(source_path)$(SEP)$(source_name_noext).spec\n",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.c",
-
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.o",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
Rule widlHeaderRule (
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).h: $(source)
$(module_rbuild) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
"\t$(ECHO_WIDL)\n"
@@ -1297,21 +1296,18 @@
"\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.h -s -S
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.c $(source)\n",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.h",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.c",
-
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.o",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
Rule widlClientRule (
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.h: $(source)
$(module_rbuild) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
"\t$(ECHO_WIDL)\n"
"\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.h -c -C
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c $(source)\n",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.h",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c",
-
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.o",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
Rule widlProxyRule (
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.h: $(source)
$(module_rbuild) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
"\t$(ECHO_WIDL)\n"
"\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.h -p -P
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c $(source)\n",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.h",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c",
-
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.o",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
Rule widlTlbRule ( "$(OUTPUT)$(SEP)$(source_dir)$(SEP)$(module_name).tlb: $(source)
$(module_rbuild) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
"\t$(ECHO_WIDL)\n"
@@ -1347,8 +1343,7 @@
else
flags = cflagsMacro;
- if ( extraDependencies != "" )
- dependencies += " " + extraDependencies;
+ dependencies += extraDependencies;
if ( pchFilename )
{
dependencies += " " + backend->GetFullName ( *pchFilename );
@@ -1475,7 +1470,10 @@
if ( customRule )
customRule->Execute ( fMakefile, backend, module, &sourceFile, clean_files );
- if ( extension == ".c" || extension == ".cc" || extension ==
".cpp" || extension == ".cxx" )
+ if ( extension == ".c" || extension == ".cc" || extension ==
".cpp" || extension == ".cxx" ||
+ extension == ".spec" ||
+ ( extension == ".idl" &&
+ ( module.type == RpcServer ) || ( module.type == RpcClient ) || ( module.type ==
RpcProxy ) ) )
{
const FileLocation *objectFilename = GetObjectFilename (
&sourceFile, module );
@@ -1483,18 +1481,7 @@
delete objectFilename;
GenerateGccCommand ( &sourceFile,
- GetCompilationUnitDependencies ( compilationUnit ) +
extraDependencies );
- }
- else if ( extension == ".spec" )
- {
- GenerateGccCommand ( &sourceFile,
- extraDependencies );
- }
- else if ( extension == ".idl" &&
- ( module.type == RpcServer ) || ( module.type == RpcClient ) || ( module.type ==
RpcProxy ) )
- {
- GenerateGccCommand ( &sourceFile,
- GetExtraDependencies ( &sourceFile ) );
+ GetCompilationUnitDependencies ( compilationUnit ) +
GetExtraDependencies ( &sourceFile ) + extraDependencies );
}
else if ( !customRule )
{
@@ -1644,14 +1631,14 @@
void
MingwModuleHandler::GenerateLinkerCommand (
const string& dependencies,
- const string& linker,
const string& linkerParameters,
- const string& objectsMacro,
- const string& libsMacro,
const string& pefixupParameters )
{
const FileLocation *target_file = GetTargetFilename ( module, NULL );
const FileLocation *definitionFilename = GetDefinitionFilename ();
+ string linker = module.cplusplus ? "${gpp}" : "${gcc}";
+ string objectsMacro = GetObjectsMacro ( module );
+ string libsMacro = GetLibsMacro ();
string target_macro ( GetTargetMacro ( module ) );
string target_folder ( backend->GetFullPath ( *target_file ) );
@@ -2559,9 +2546,7 @@
{
string targetMacro ( GetTargetMacro ( module ) );
string workingDirectory = GetWorkingDirectory ( );
- string objectsMacro = GetObjectsMacro ( module );
string linkDepsMacro = GetLinkingDependenciesMacro ();
- string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
@@ -2571,16 +2556,13 @@
string dependencies = linkDepsMacro + " " + objectsMacro;
- string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s
-Wl,--image-base,%s",
- module.GetEntryPoint(!(Environment::GetArch()
== "arm")).c_str (),
- module.baseaddress.c_str () );
-
+ string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s
-Wl,--image-base,%s",
+ module.GetEntryPoint(!(Environment::GetArch() ==
"arm")).c_str (),
+ module.baseaddress.c_str () );
+
GenerateLinkerCommand ( dependencies,
- "${gcc}",
- linkerParameters + " $(NTOSKRNL_SHARED)",
- objectsMacro,
- libsMacro,
- "-sections" );
+ linkerParameters + " $(NTOSKRNL_SHARED)",
+ "-sections" );
}
else
{
@@ -2667,9 +2649,7 @@
{
string targetMacro ( GetTargetMacro ( module ) );
string workingDirectory = GetWorkingDirectory ( );
- string objectsMacro = GetObjectsMacro ( module );
string linkDepsMacro = GetLinkingDependenciesMacro ();
- string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
@@ -2683,10 +2663,7 @@
module.GetEntryPoint(true).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
- "${gcc}",
linkerParameters,
- objectsMacro,
- libsMacro,
"-sections" );
}
else
@@ -2721,9 +2698,7 @@
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ();
- string objectsMacro = GetObjectsMacro ( module );
string linkDepsMacro = GetLinkingDependenciesMacro ();
- string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
@@ -2737,10 +2712,7 @@
module.GetEntryPoint(true).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
- "${gcc}",
linkerParameters,
- objectsMacro,
- libsMacro,
"-sections" );
}
else
@@ -2774,9 +2746,7 @@
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string objectsMacro = GetObjectsMacro ( module );
string linkDepsMacro = GetLinkingDependenciesMacro ();
- string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
@@ -2790,10 +2760,7 @@
module.GetEntryPoint(true).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
- "${gcc}",
linkerParameters,
- objectsMacro,
- libsMacro,
"" );
}
else
@@ -2827,9 +2794,7 @@
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string objectsMacro = GetObjectsMacro ( module );
string linkDepsMacro = GetLinkingDependenciesMacro ();
- string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
@@ -2843,10 +2808,7 @@
module.GetEntryPoint(true).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
- "${gcc}",
linkerParameters,
- objectsMacro,
- libsMacro,
"" );
}
else
@@ -2957,9 +2919,7 @@
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string objectsMacro = GetObjectsMacro ( module );
string linkDepsMacro = GetLinkingDependenciesMacro ();
- string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
@@ -2968,21 +2928,12 @@
GenerateRules ();
string dependencies = linkDepsMacro + " " + objectsMacro;
-
- string linker;
- if ( module.cplusplus )
- linker = "${gpp}";
- else
- linker = "${gcc}";
string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s
-Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000
-shared",
module.GetEntryPoint(true).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
- linker,
linkerParameters,
- objectsMacro,
- libsMacro,
"" );
}
else
@@ -3010,9 +2961,7 @@
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string objectsMacro = GetObjectsMacro ( module );
string linkDepsMacro = GetLinkingDependenciesMacro ();
- string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
@@ -3021,21 +2970,12 @@
GenerateRules ();
string dependencies = linkDepsMacro + " " + objectsMacro;
-
- string linker;
- if ( module.cplusplus )
- linker = "${gpp}";
- else
- linker = "${gcc}";
string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s
-Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000
-shared",
module.GetEntryPoint(true).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
- linker,
linkerParameters,
- objectsMacro,
- libsMacro,
"" );
}
else
@@ -3070,9 +3010,7 @@
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string objectsMacro = GetObjectsMacro ( module );
string linkDepsMacro = GetLinkingDependenciesMacro ();
- string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
@@ -3081,21 +3019,12 @@
GenerateRules ();
string dependencies = linkDepsMacro + " " + objectsMacro;
-
- string linker;
- if ( module.cplusplus )
- linker = "${gpp}";
- else
- linker = "${gcc}";
string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s
-Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
module.GetEntryPoint(true).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
- linker,
linkerParameters,
- objectsMacro,
- libsMacro,
"" );
}
else
@@ -3130,9 +3059,7 @@
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string objectsMacro = GetObjectsMacro ( module );
string linkDepsMacro = GetLinkingDependenciesMacro ();
- string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
@@ -3141,21 +3068,12 @@
GenerateRules ();
string dependencies = linkDepsMacro + " " + objectsMacro;
-
- string linker;
- if ( module.cplusplus )
- linker = "${gpp}";
- else
- linker = "${gcc}";
string linkerParameters = ssprintf ( "-Wl,--subsystem,windows -Wl,--entry,%s
-Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
module.GetEntryPoint(true).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
- linker,
linkerParameters,
- objectsMacro,
- libsMacro,
"" );
}
else
@@ -3761,9 +3679,7 @@
{
string targetMacro ( GetTargetMacro ( module ) );
string workingDirectory = GetWorkingDirectory ( );
- string objectsMacro = GetObjectsMacro ( module );
string linkDepsMacro = GetLinkingDependenciesMacro ();
- string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
@@ -3772,21 +3688,12 @@
GenerateRules ();
string dependencies = linkDepsMacro + " " + objectsMacro;
-
- string linker;
- if ( module.cplusplus )
- linker = "${gpp}";
- else
- linker = "${gcc}";
string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s
-Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
module.GetEntryPoint(true).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
- linker,
linkerParameters,
- objectsMacro,
- libsMacro,
"" );
}
else
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h Fri Feb 29 15:45:34 2008
@@ -111,10 +111,7 @@
void GenerateRunRsymCode () const;
void GenerateRunStripCode () const;
void GenerateLinkerCommand ( const std::string& dependencies,
- const std::string& linker,
const std::string& linkerParameters,
- const std::string& objectsMacro,
- const std::string& libsMacro,
const std::string& pefixupParameters );
void GeneratePhonyTarget() const;
void GenerateBuildMapCode ( const FileLocation *mapTarget = NULL );