Author: hpoussin
Date: Tue Sep 9 02:12:30 2008
New Revision: 36076
URL:
http://svn.reactos.org/svn/reactos?rev=36076&view=rev
Log:
Remove host attribute of module element. It wasn't used and can be deduced from module
type
Remove MingwBootSectorModuleHandler class
Move module specific cflags, nasmflags and linkerflags to an array. One day, we won't
be forced to create a new MingwModuleHandler each time we add a module type
Modified:
trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
trunk/reactos/tools/rbuild/backend/mingw/mingw.h
trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
trunk/reactos/tools/rbuild/module.cpp
trunk/reactos/tools/rbuild/rbuild.h
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp [iso-8859-1] Tue Sep 9 02:12:30
2008
@@ -34,42 +34,39 @@
typedef set<string> set_string;
-static const struct
-{
- HostType DefaultHost;
-} ModuleHandlerInformations[] = {
- { HostTrue }, // BuildTool
- { HostFalse }, // StaticLibrary
- { HostFalse }, // ObjectLibrary
- { HostFalse }, // Kernel
- { HostFalse }, // KernelModeDLL
- { HostFalse }, // KernelModeDriver
- { HostFalse }, // NativeDLL
- { HostFalse }, // NativeCUI
- { HostFalse }, // Win32DLL
- { HostFalse }, // Win32OCX
- { HostFalse }, // Win32CUI
- { HostFalse }, // Win32GUI
- { HostFalse }, // BootLoader
- { HostFalse }, // BootSector
- { HostFalse }, // Iso
- { HostFalse }, // LiveIso
- { HostFalse }, // Test
- { HostFalse }, // RpcServer
- { HostFalse }, // RpcClient
- { HostFalse }, // Alias
- { HostFalse }, // BootProgram
- { HostFalse }, // Win32SCR
- { HostFalse }, // IdlHeader
- { HostFalse }, // IsoRegTest
- { HostFalse }, // LiveIsoRegTest
- { HostFalse }, // EmbeddedTypeLib
- { HostFalse }, // ElfExecutable
- { HostFalse }, // RpcProxy
- { HostTrue }, // HostStaticLibrary
- { HostFalse }, // Cabinet
- { HostFalse }, // KeyboardLayout
- { HostFalse }, // MessageHeader
+const struct ModuleHandlerInformations ModuleHandlerInformations[] = {
+ { HostTrue, "", "", "" }, // BuildTool
+ { HostFalse, "", "", "" }, // StaticLibrary
+ { HostFalse, "", "", "" }, // ObjectLibrary
+ { HostFalse, "", "", "" }, // Kernel
+ { HostFalse, "", "", "" }, // KernelModeDLL
+ { HostFalse, "-D__NTDRIVER__", "", "" }, //
KernelModeDriver
+ { HostFalse, "", "", "" }, // NativeDLL
+ { HostFalse, "-D__NTAPP__", "", "" }, // NativeCUI
+ { HostFalse, "", "", "" }, // Win32DLL
+ { HostFalse, "", "", "" }, // Win32OCX
+ { HostFalse, "", "", "" }, // Win32CUI
+ { HostFalse, "", "", "" }, // Win32GUI
+ { HostFalse, "", "", "-nostartfiles -nostdlib" }, //
BootLoader
+ { HostFalse, "", "-f bin", "" }, // BootSector
+ { HostFalse, "", "", "" }, // Iso
+ { HostFalse, "", "", "" }, // LiveIso
+ { HostFalse, "", "", "" }, // Test
+ { HostFalse, "", "", "" }, // RpcServer
+ { HostFalse, "", "", "" }, // RpcClient
+ { HostFalse, "", "", "" }, // Alias
+ { HostFalse, "", "", "-nostartfiles -nostdlib" }, //
BootProgram
+ { HostFalse, "", "", "" }, // Win32SCR
+ { HostFalse, "", "", "" }, // IdlHeader
+ { HostFalse, "", "", "" }, // IsoRegTest
+ { HostFalse, "", "", "" }, // LiveIsoRegTest
+ { HostFalse, "", "", "" }, // EmbeddedTypeLib
+ { HostFalse, "", "", "" }, // ElfExecutable
+ { HostFalse, "", "", "" }, // RpcProxy
+ { HostTrue, "", "", "" }, // HostStaticLibrary
+ { HostFalse, "", "", "" }, // Cabinet
+ { HostFalse, "", "", "" }, // KeyboardLayout
+ { HostFalse, "", "", "" }, // MessageHeader
};
string
@@ -269,11 +266,6 @@
h->AddImplicitLibraries ( module );
if ( use_pch && CanEnablePreCompiledHeaderSupportForModule ( module ) )
h->EnablePreCompiledHeaderSupport ();
- if ( module.host == HostDefault )
- {
- module.host = ModuleHandlerInformations[h->module.type].DefaultHost;
- assert ( module.host != HostDefault );
- }
v.push_back ( h );
}
@@ -343,7 +335,7 @@
void
MingwBackend::ProcessNormal ()
{
- assert(sizeof(ModuleHandlerInformations)/sizeof(ModuleHandlerInformations[0]) ==
TypeDontCare);
+ assert(sizeof(ModuleHandlerInformations)/sizeof(ModuleHandlerInformations[0]) ==
TypeDontCare);
DetectCompiler ();
DetectBinutils ();
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/mingw.h [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/mingw.h [iso-8859-1] Tue Sep 9 02:12:30
2008
@@ -142,4 +142,14 @@
const Project& project;
};
+typedef struct ModuleHandlerInformations
+{
+ HostType DefaultHost;
+ const char* cflags;
+ const char* nasmflags;
+ const char* linkerflags;
+};
+
+extern const struct ModuleHandlerInformations ModuleHandlerInformations[];
+
#endif /* MINGW_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 [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp [iso-8859-1] Tue Sep 9
02:12:30 2008
@@ -174,6 +174,7 @@
case MessageHeader:
case IdlHeader:
case EmbeddedTypeLib:
+ case BootSector:
handler = new MingwModuleHandler( module );
break;
case BuildTool:
@@ -210,9 +211,6 @@
break;
case BootLoader:
handler = new MingwBootLoaderModuleHandler ( module );
- break;
- case BootSector:
- handler = new MingwBootSectorModuleHandler ( module );
break;
case BootProgram:
handler = new MingwBootProgramModuleHandler ( module );
@@ -1315,7 +1313,7 @@
for ( i = 0; i < sizeof ( rules ) / sizeof ( rules[0] ); i++ )
{
- if ( rules[i].host != HostDontCare && rules[i].host != module.host )
+ if ( rules[i].host != HostDontCare && rules[i].host !=
ModuleHandlerInformations[module.type].DefaultHost )
continue;
if ( rules[i].type != TypeDontCare && rules[i].type != module.type )
continue;
@@ -1638,8 +1636,8 @@
if ( pchFilename )
{
- string cc = ( module.host == HostTrue ? "${host_gcc}" : "${gcc}"
);
- string cppc = ( module.host == HostTrue ? "${host_gpp}" : "${gpp}"
);
+ string cc = ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue ?
"${host_gcc}" : "${gcc}" );
+ string cppc = ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue ?
"${host_gpp}" : "${gpp}" );
const FileLocation& baseHeaderFile = *module.pch->file;
CLEAN_FILE ( *pchFilename );
@@ -1849,7 +1847,7 @@
&module.linkerFlags,
used_defs );
- if ( module.host == HostFalse )
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
{
GenerateMacros (
"+=",
@@ -1885,7 +1883,7 @@
}
string globalCflags = "";
- if ( module.host == HostFalse )
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
globalCflags += " $(PROJECT_CFLAGS)";
else
globalCflags += " -Wall -Wpointer-arith -D__REACTOS__";
@@ -1894,7 +1892,7 @@
globalCflags += " -pipe";
if ( !module.allowWarnings )
globalCflags += " -Werror";
- if ( module.host == HostTrue )
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue )
{
if ( module.cplusplus )
globalCflags += " $(HOST_CPPFLAGS)";
@@ -1922,7 +1920,7 @@
cflagsMacro.c_str (),
globalCflags.c_str () );
- if ( module.host == HostFalse )
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
{
fprintf (
fMakefile,
@@ -1955,31 +1953,31 @@
linkDepsMacro.c_str (),
libsMacro.c_str () );
- string cflags = TypeSpecificCFlags();
- if ( cflags.size() > 0 )
+ const char *cflags = ModuleHandlerInformations[module.type].cflags;
+ if ( strlen( cflags ) > 0 )
{
fprintf ( fMakefile,
"%s += %s\n\n",
cflagsMacro.c_str (),
- cflags.c_str () );
- }
-
- string nasmflags = TypeSpecificNasmFlags();
- if ( nasmflags.size () > 0 )
+ cflags );
+ }
+
+ const char* nasmflags = ModuleHandlerInformations[module.type].nasmflags;
+ if ( strlen( nasmflags ) > 0 )
{
fprintf ( fMakefile,
"%s += %s\n\n",
nasmflagsMacro.c_str (),
- nasmflags.c_str () );
- }
-
- string linkerflags = TypeSpecificLinkerFlags();
- if ( linkerflags.size() > 0 )
+ nasmflags );
+ }
+
+ const char *linkerflags = ModuleHandlerInformations[module.type].linkerflags;
+ if ( strlen( linkerflags ) > 0 )
{
fprintf ( fMakefile,
"%s += %s\n\n",
linkerflagsMacro.c_str (),
- linkerflags.c_str () );
+ linkerflags );
}
if ( IsStaticLibrary ( module ) && module.isStartupLib )
@@ -2106,7 +2104,7 @@
string_list& dependencies ) const
{
/* Avoid circular dependency */
- if ( module.host == HostTrue )
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue )
return;
if (module.name != "psdk" &&
@@ -2957,35 +2955,6 @@
backend->GetFullName ( junk_tmp ).c_str () );
delete target_file;
-}
-
-
-MingwBootSectorModuleHandler::MingwBootSectorModuleHandler (
- const Module& module_ )
-
- : MingwModuleHandler ( module_ )
-{
-}
-
-void
-MingwBootSectorModuleHandler::Process ()
-{
- GenerateBootSectorModuleTarget ();
-}
-
-void
-MingwBootSectorModuleHandler::GenerateBootSectorModuleTarget ()
-{
- string objectsMacro = GetObjectsMacro ( module );
-
- GenerateRules ();
-
- fprintf ( fMakefile, ".PHONY: %s\n\n",
- module.name.c_str ());
- fprintf ( fMakefile,
- "%s: %s\n",
- module.name.c_str (),
- objectsMacro.c_str () );
}
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 [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h [iso-8859-1] Tue Sep 9
02:12:30 2008
@@ -67,9 +67,6 @@
MingwBackend* backend_ );
void GeneratePreconditionDependencies ();
virtual void Process () { GenerateRules (); }
- virtual std::string TypeSpecificCFlags() { return ""; }
- virtual std::string TypeSpecificNasmFlags() { return ""; }
- virtual std::string TypeSpecificLinkerFlags() { return ""; }
void GenerateInvocations () const;
void GenerateCleanTarget () const;
void GenerateInstallTarget () const;
@@ -221,7 +218,6 @@
public:
MingwKernelModeDriverModuleHandler ( const Module& module );
virtual void Process ();
- std::string TypeSpecificCFlags() { return "-D__NTDRIVER__"; }
void AddImplicitLibraries ( Module& module );
private:
void GenerateKernelModeDriverModuleTarget ();
@@ -244,7 +240,6 @@
public:
MingwNativeCUIModuleHandler ( const Module& module );
virtual void Process ();
- std::string TypeSpecificCFlags() { return "-D__NTAPP__"; }
void AddImplicitLibraries ( Module& module );
private:
void GenerateNativeCUIModuleTarget ();
@@ -300,30 +295,17 @@
public:
MingwBootLoaderModuleHandler ( const Module& module );
virtual void Process ();
- std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
private:
void GenerateBootLoaderModuleTarget ();
};
-class MingwBootSectorModuleHandler : public MingwModuleHandler
-{
-public:
- MingwBootSectorModuleHandler ( const Module& module );
- virtual void Process ();
- std::string TypeSpecificNasmFlags() { return "-f bin"; }
-private:
- void GenerateBootSectorModuleTarget ();
-};
-
-
class MingwBootProgramModuleHandler : public MingwModuleHandler
{
public:
MingwBootProgramModuleHandler ( const Module& module );
virtual void Process ();
std::string GetProgTextAddrMacro ();
- std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
private:
void GenerateBootProgramModuleTarget ();
};
Modified: trunk/reactos/tools/rbuild/module.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/module.cpp?re…
==============================================================================
--- trunk/reactos/tools/rbuild/module.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/module.cpp [iso-8859-1] Tue Sep 9 02:12:30 2008
@@ -245,7 +245,6 @@
linkerScript (NULL),
pch (NULL),
cplusplus (false),
- host (HostDefault),
output (NULL),
install (NULL)
{
@@ -363,23 +362,6 @@
else
underscoreSymbols = false;
- att = moduleNode.GetAttribute ( "host", false );
- if ( att != NULL )
- {
- const char* p = att->value.c_str();
- if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) )
- host = HostTrue;
- else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) )
- host = HostFalse;
- else
- {
- throw InvalidAttributeValueException (
- moduleNode.location,
- "host",
- att->value );
- }
- }
-
att = moduleNode.GetAttribute ( "isstartuplib", false );
if ( att != NULL )
{
@@ -392,7 +374,7 @@
{
throw InvalidAttributeValueException (
moduleNode.location,
- "host",
+ "isstartuplib",
att->value );
}
}
Modified: trunk/reactos/tools/rbuild/rbuild.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h?rev=…
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.h [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/rbuild.h [iso-8859-1] Tue Sep 9 02:12:30 2008
@@ -369,7 +369,6 @@
PchFile* pch;
bool cplusplus;
std::string prefix;
- HostType host;
std::string aliasedModuleName;
bool allowWarnings;
bool enabled;