diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp index 017862e2ea3..30c5f6a46bd 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@ -34,6 +34,44 @@ using std::map; typedef set 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 +}; + string MingwBackend::GetFullPath ( const FileLocation& file ) const { @@ -252,7 +290,7 @@ MingwBackend::ProcessModules () h->EnablePreCompiledHeaderSupport (); if ( module.host == HostDefault ) { - module.host = h->DefaultHost(); + module.host = ModuleHandlerInformations[h->module.type].DefaultHost; assert ( module.host != HostDefault ); } v.push_back ( h ); @@ -324,6 +362,8 @@ MingwBackend::CheckAutomaticDependenciesForModuleOnly () void MingwBackend::ProcessNormal () { + assert(sizeof(ModuleHandlerInformations)/sizeof(ModuleHandlerInformations[0]) == TypeDontCare); + DetectCompiler (); DetectBinutils (); DetectNetwideAssembler (); diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp index 7796149fe9c..ef076cca42e 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -165,18 +165,20 @@ MingwModuleHandler::InstanciateHandler ( MingwModuleHandler* handler; switch ( module.type ) { + case StaticLibrary: + case HostStaticLibrary: + case ObjectLibrary: + case RpcServer: + case RpcClient: + case RpcProxy: + case MessageHeader: + case IdlHeader: + case EmbeddedTypeLib: + handler = new MingwModuleHandler( module ); + break; case BuildTool: handler = new MingwBuildToolModuleHandler ( module ); break; - case StaticLibrary: - handler = new MingwStaticLibraryModuleHandler ( module ); - break; - case HostStaticLibrary: - handler = new MingwHostStaticLibraryModuleHandler ( module ); - break; - case ObjectLibrary: - handler = new MingwObjectLibraryModuleHandler ( module ); - break; case Kernel: handler = new MingwKernelModuleHandler ( module ); break; @@ -230,30 +232,12 @@ MingwModuleHandler::InstanciateHandler ( case Test: handler = new MingwTestModuleHandler ( module ); break; - case RpcServer: - handler = new MingwRpcServerModuleHandler ( module ); - break; - case RpcClient: - handler = new MingwRpcClientModuleHandler ( module ); - break; - case RpcProxy: - handler = new MingwRpcProxyModuleHandler ( module ); - break; case Alias: handler = new MingwAliasModuleHandler ( module ); break; - case MessageHeader: - handler = new MingwMessageHeaderModuleHandler (module); - break; - case IdlHeader: - handler = new MingwIdlHeaderModuleHandler ( module ); - break; case Cabinet: handler = new MingwCabinetModuleHandler ( module ); break; - case EmbeddedTypeLib: - handler = new MingwEmbeddedTypeLibModuleHandler ( module ); - break; case ElfExecutable: handler = new MingwElfExecutableModuleHandler ( module ); break; @@ -2541,66 +2525,6 @@ MingwKernelModuleHandler::GenerateKernelModuleTarget () } -MingwStaticLibraryModuleHandler::MingwStaticLibraryModuleHandler ( - const Module& module_ ) - - : MingwModuleHandler ( module_ ) -{ -} - -void -MingwStaticLibraryModuleHandler::Process () -{ - GenerateStaticLibraryModuleTarget (); -} - -void -MingwStaticLibraryModuleHandler::GenerateStaticLibraryModuleTarget () -{ - GenerateRules (); -} - - -MingwHostStaticLibraryModuleHandler::MingwHostStaticLibraryModuleHandler ( - const Module& module_ ) - - : MingwModuleHandler ( module_ ) -{ -} - -void -MingwHostStaticLibraryModuleHandler::Process () -{ - GenerateHostStaticLibraryModuleTarget (); -} - -void -MingwHostStaticLibraryModuleHandler::GenerateHostStaticLibraryModuleTarget () -{ - GenerateRules (); -} - - -MingwObjectLibraryModuleHandler::MingwObjectLibraryModuleHandler ( - const Module& module_ ) - - : MingwModuleHandler ( module_ ) -{ -} - -void -MingwObjectLibraryModuleHandler::Process () -{ - GenerateObjectLibraryModuleTarget (); -} - -void -MingwObjectLibraryModuleHandler::GenerateObjectLibraryModuleTarget () -{ - GenerateRules (); -} - - MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler ( const Module& module_ ) @@ -2608,19 +2532,6 @@ MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler ( { } -MingwEmbeddedTypeLibModuleHandler::MingwEmbeddedTypeLibModuleHandler ( - const Module& module_ ) - - : MingwModuleHandler ( module_ ) -{ -} - -void -MingwEmbeddedTypeLibModuleHandler::Process () -{ - GenerateRules (); -} - void MingwKernelModeDLLModuleHandler::AddImplicitLibraries ( Module& module ) @@ -3695,48 +3606,6 @@ MingwTestModuleHandler::GenerateTestModuleTarget () } -MingwRpcServerModuleHandler::MingwRpcServerModuleHandler ( - const Module& module_ ) - - : MingwModuleHandler ( module_ ) -{ -} - -void -MingwRpcServerModuleHandler::Process () -{ - GenerateRules (); -} - - -MingwRpcClientModuleHandler::MingwRpcClientModuleHandler ( - const Module& module_ ) - - : MingwModuleHandler ( module_ ) -{ -} - -void -MingwRpcClientModuleHandler::Process () -{ - GenerateRules (); -} - - -MingwRpcProxyModuleHandler::MingwRpcProxyModuleHandler ( - const Module& module_ ) - - : MingwModuleHandler ( module_ ) -{ -} - -void -MingwRpcProxyModuleHandler::Process () -{ - GenerateRules (); -} - - MingwAliasModuleHandler::MingwAliasModuleHandler ( const Module& module_ ) @@ -3749,31 +3618,6 @@ MingwAliasModuleHandler::Process () { } -MingwMessageHeaderModuleHandler::MingwMessageHeaderModuleHandler ( - const Module& module_ ) - - : MingwModuleHandler ( module_ ) -{ -} - -void -MingwMessageHeaderModuleHandler::Process () -{ - GenerateRules (); -} - -MingwIdlHeaderModuleHandler::MingwIdlHeaderModuleHandler ( - const Module& module_ ) - - : MingwModuleHandler ( module_ ) -{ -} - -void -MingwIdlHeaderModuleHandler::Process () -{ - GenerateRules (); -} MingwCabinetModuleHandler::MingwCabinetModuleHandler ( const Module& module_ ) diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.h b/reactos/tools/rbuild/backend/mingw/modulehandler.h index 6e11a1e482b..2c5d31cbee4 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.h +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.h @@ -65,9 +65,8 @@ public: static MingwModuleHandler* InstanciateHandler ( const Module& module_, MingwBackend* backend_ ); - virtual HostType DefaultHost() = 0; void GeneratePreconditionDependencies (); - virtual void Process () = 0; + virtual void Process () { GenerateRules (); } virtual std::string TypeSpecificCFlags() { return ""; } virtual std::string TypeSpecificNasmFlags() { return ""; } virtual std::string TypeSpecificLinkerFlags() { return ""; } @@ -192,7 +191,6 @@ class MingwBuildToolModuleHandler : public MingwModuleHandler { public: MingwBuildToolModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostTrue; } virtual void Process (); private: void GenerateBuildToolModuleTarget (); @@ -203,51 +201,16 @@ class MingwKernelModuleHandler : public MingwModuleHandler { public: MingwKernelModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); private: void GenerateKernelModuleTarget (); }; -class MingwStaticLibraryModuleHandler : public MingwModuleHandler -{ -public: - MingwStaticLibraryModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } - virtual void Process (); -private: - void GenerateStaticLibraryModuleTarget (); -}; - - -class MingwHostStaticLibraryModuleHandler : public MingwModuleHandler -{ -public: - MingwHostStaticLibraryModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostTrue; } - virtual void Process (); -private: - void GenerateHostStaticLibraryModuleTarget (); -}; - - -class MingwObjectLibraryModuleHandler : public MingwModuleHandler -{ -public: - MingwObjectLibraryModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } - virtual void Process (); -private: - void GenerateObjectLibraryModuleTarget (); -}; - - class MingwKernelModeDLLModuleHandler : public MingwModuleHandler { public: MingwKernelModeDLLModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); void AddImplicitLibraries ( Module& module ); private: @@ -259,7 +222,6 @@ class MingwKernelModeDriverModuleHandler : public MingwModuleHandler { public: MingwKernelModeDriverModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); std::string TypeSpecificCFlags() { return "-D__NTDRIVER__"; } void AddImplicitLibraries ( Module& module ); @@ -272,7 +234,6 @@ class MingwNativeDLLModuleHandler : public MingwModuleHandler { public: MingwNativeDLLModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); void AddImplicitLibraries ( Module& module ); private: @@ -284,7 +245,6 @@ class MingwNativeCUIModuleHandler : public MingwModuleHandler { public: MingwNativeCUIModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); std::string TypeSpecificCFlags() { return "-D__NTAPP__"; } void AddImplicitLibraries ( Module& module ); @@ -297,7 +257,6 @@ class MingwWin32DLLModuleHandler : public MingwModuleHandler { public: MingwWin32DLLModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); void AddImplicitLibraries ( Module& module ); private: @@ -309,7 +268,6 @@ class MingwWin32OCXModuleHandler : public MingwModuleHandler { public: MingwWin32OCXModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); void AddImplicitLibraries ( Module& module ); private: @@ -321,7 +279,6 @@ class MingwWin32CUIModuleHandler : public MingwModuleHandler { public: MingwWin32CUIModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); void AddImplicitLibraries ( Module& module ); private: @@ -333,7 +290,6 @@ class MingwWin32GUIModuleHandler : public MingwModuleHandler { public: MingwWin32GUIModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); void AddImplicitLibraries ( Module& module ); private: @@ -345,7 +301,6 @@ class MingwBootLoaderModuleHandler : public MingwModuleHandler { public: MingwBootLoaderModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; } private: @@ -357,7 +312,6 @@ class MingwBootSectorModuleHandler : public MingwModuleHandler { public: MingwBootSectorModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); std::string TypeSpecificNasmFlags() { return "-f bin"; } private: @@ -369,7 +323,6 @@ class MingwBootProgramModuleHandler : public MingwModuleHandler { public: MingwBootProgramModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); std::string GetProgTextAddrMacro (); std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; } @@ -382,7 +335,6 @@ class MingwIsoModuleHandler : public MingwModuleHandler { public: MingwIsoModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); private: void GenerateIsoModuleTarget (); @@ -401,7 +353,6 @@ class MingwLiveIsoModuleHandler : public MingwModuleHandler { public: MingwLiveIsoModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); private: void GenerateLiveIsoModuleTarget (); @@ -420,7 +371,6 @@ class MingwTestModuleHandler : public MingwModuleHandler { public: MingwTestModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); protected: virtual void GetModuleSpecificCompilationUnits ( std::vector& compilationUnits ); @@ -428,54 +378,10 @@ private: void GenerateTestModuleTarget (); }; - -class MingwRpcServerModuleHandler : public MingwModuleHandler -{ -public: - MingwRpcServerModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } - virtual void Process (); -}; - - -class MingwRpcClientModuleHandler : public MingwModuleHandler -{ -public: - MingwRpcClientModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } - virtual void Process (); -}; - - -class MingwRpcProxyModuleHandler : public MingwModuleHandler -{ -public: - MingwRpcProxyModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } - virtual void Process (); -}; - -class MingwMessageHeaderModuleHandler : public MingwModuleHandler -{ -public: - MingwMessageHeaderModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } - virtual void Process (); -}; - class MingwAliasModuleHandler : public MingwModuleHandler { public: MingwAliasModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } - virtual void Process (); -}; - -class MingwIdlHeaderModuleHandler : public MingwModuleHandler -{ -public: - MingwIdlHeaderModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); }; @@ -483,15 +389,6 @@ class MingwCabinetModuleHandler : public MingwModuleHandler { public: MingwCabinetModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } - virtual void Process (); -}; - -class MingwEmbeddedTypeLibModuleHandler : public MingwModuleHandler -{ -public: - MingwEmbeddedTypeLibModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); }; @@ -499,7 +396,6 @@ class MingwElfExecutableModuleHandler : public MingwModuleHandler { public: MingwElfExecutableModuleHandler ( const Module& module ); - virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); }; diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index 10b4e2141d7..18e37039298 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -275,39 +275,39 @@ private: enum ModuleType { - BuildTool = 0, - StaticLibrary = 1, - ObjectLibrary = 2, - Kernel = 3, - KernelModeDLL = 4, - KernelModeDriver = 5, - NativeDLL = 6, - NativeCUI = 7, - Win32DLL = 8, - Win32OCX = 9, - Win32CUI = 10, - Win32GUI = 11, - BootLoader = 12, - BootSector = 13, - Iso = 14, - LiveIso = 15, - Test = 16, - RpcServer = 17, - RpcClient = 18, - Alias = 19, - BootProgram = 20, - Win32SCR = 21, - IdlHeader = 23, - IsoRegTest = 24, - LiveIsoRegTest = 25, - EmbeddedTypeLib = 26, - ElfExecutable = 27, + BuildTool, + StaticLibrary, + ObjectLibrary, + Kernel, + KernelModeDLL, + KernelModeDriver, + NativeDLL, + NativeCUI, + Win32DLL, + Win32OCX, + Win32CUI, + Win32GUI, + BootLoader, + BootSector, + Iso, + LiveIso, + Test, + RpcServer, + RpcClient, + Alias, + BootProgram, + Win32SCR, + IdlHeader, + IsoRegTest, + LiveIsoRegTest, + EmbeddedTypeLib, + ElfExecutable, RpcProxy, HostStaticLibrary, - TypeDontCare, Cabinet, KeyboardLayout, - MessageHeader + MessageHeader, + TypeDontCare, // always at the end }; enum HostType