diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp index fc538efd8a5..95fb63101d2 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -265,6 +265,9 @@ MingwModuleHandler::InstanciateHandler ( case IdlHeader: handler = new MingwIdlHeaderModuleHandler ( module ); break; + case TypeLib: + handler = new MingwTypeLibModuleHandler ( module ); + break; default: throw UnknownModuleTypeException ( module.node.location, @@ -320,13 +323,17 @@ MingwModuleHandler::GetActualSourceFilename ( backend->intermediateDirectory ); return new FileLocation ( backend->intermediateDirectory, NormalizeFilename ( newname ) ); } - else //if ( module.type == IdlHeader ) + else if ( module.type == IdlHeader ) { newname = basename + ".h"; PassThruCacheDirectory ( NormalizeFilename ( newname ), backend->intermediateDirectory ); return new FileLocation ( fileLocation->directory, filename ); } + else + { + return new FileLocation ( fileLocation->directory, filename ); + } } else return new FileLocation ( fileLocation->directory, filename ); @@ -342,8 +349,10 @@ MingwModuleHandler::GetExtraDependencies ( string basename = GetBasename ( filename ); if ( (module.type == RpcServer) || (module.type == RpcClient) ) return GetRpcServerHeaderFilename ( basename ) + " " + GetRpcClientHeaderFilename ( basename ); - else + else if ( module.type == IdlHeader ) return GetIdlHeaderFilename ( basename ); + else + return ""; } else return ""; @@ -1253,6 +1262,32 @@ MingwModuleHandler::GetIdlHeaderFilename ( string basename ) const backend->intermediateDirectory ); } +void +MingwModuleHandler::GenerateWidlCommandsTypeLib ( + const CompilationUnit& compilationUnit, + const string& widlflagsMacro ) +{ + FileLocation* sourceFileLocation = compilationUnit.GetFilename ( backend->intermediateDirectory ); + string filename = sourceFileLocation->filename; + string dependencies = filename; + dependencies += " " + NormalizeFilename ( module.xmlbuildFile ); + + string TypeLibFilename = module.GetTargetName (); + + fprintf ( fMakefile, + "%s: %s $(WIDL_TARGET) | %s\n", + GetTargetMacro ( module ).c_str (), + dependencies.c_str (), + GetDirectory ( TypeLibFilename ).c_str () ); + fprintf ( fMakefile, "\t$(ECHO_WIDL)\n" ); + fprintf ( fMakefile, + "\t%s %s %s -t -T $@ %s\n", + "$(Q)$(WIDL_TARGET)", + GetWidlFlags ( compilationUnit ).c_str (), + widlflagsMacro.c_str (), + filename.c_str () ); +} + void MingwModuleHandler::GenerateWidlCommandsClient ( const CompilationUnit& compilationUnit, @@ -1331,7 +1366,10 @@ MingwModuleHandler::GenerateWidlCommands ( else if ( module.type == RpcClient ) GenerateWidlCommandsClient ( compilationUnit, widlflagsMacro ); - else + else if ( module.type == TypeLib ) + GenerateWidlCommandsTypeLib ( compilationUnit, + widlflagsMacro ); + else // applies also for other module.types which include idl files GenerateWidlCommandsIdlHeader ( compilationUnit, widlflagsMacro ); } @@ -2454,6 +2492,20 @@ MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler ( { } +MingwTypeLibModuleHandler::MingwTypeLibModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwTypeLibModuleHandler::Process () +{ + GenerateRules (); +} + + void MingwKernelModeDLLModuleHandler::AddImplicitLibraries ( Module& module ) { diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.h b/reactos/tools/rbuild/backend/mingw/modulehandler.h index 118dcc38a69..4a10330f526 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.h +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.h @@ -172,6 +172,9 @@ private: void GenerateWidlCommandsIdlHeader ( const CompilationUnit& compilationUnit, const std::string& widlflagsMacro ); + void GenerateWidlCommandsTypeLib ( + const CompilationUnit& compilationUnit, + const std::string& widlflagsMacro ); void GenerateWidlCommands ( const CompilationUnit& compilationUnit, const std::string& widlflagsMacro ); void GenerateCommands ( const CompilationUnit& compilationUnit, @@ -502,4 +505,12 @@ public: virtual void Process (); }; +class MingwTypeLibModuleHandler : public MingwModuleHandler +{ +public: + MingwTypeLibModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); +}; + #endif /* MINGW_MODULEHANDLER_H */ diff --git a/reactos/tools/rbuild/bootstrap.cpp b/reactos/tools/rbuild/bootstrap.cpp index a6670900d5d..b41b076d6e6 100644 --- a/reactos/tools/rbuild/bootstrap.cpp +++ b/reactos/tools/rbuild/bootstrap.cpp @@ -68,6 +68,7 @@ Bootstrap::IsSupportedModuleType ( ModuleType type ) case RpcClient: case Alias: case IdlHeader: + case TypeLib: return false; } throw InvalidOperationException ( __FILE__, diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index 8c1c0256eaf..e96587642da 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -839,6 +839,8 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute ) return Alias; if ( attribute.value == "idlheader" ) return IdlHeader; + if ( attribute.value == "typelib" ) + return TypeLib; throw InvalidAttributeValueException ( location, attribute.name, attribute.value ); @@ -890,6 +892,8 @@ Module::GetDefaultModuleExtension () const case BootProgram: case IdlHeader: return ""; + case TypeLib: + return ".tlb"; } throw InvalidOperationException ( __FILE__, __LINE__ ); @@ -939,6 +943,7 @@ Module::GetDefaultModuleEntrypoint () const case Alias: case BootProgram: case IdlHeader: + case TypeLib: return ""; } throw InvalidOperationException ( __FILE__, @@ -981,6 +986,7 @@ Module::GetDefaultModuleBaseaddress () const case Alias: case BootProgram: case IdlHeader: + case TypeLib: return ""; } throw InvalidOperationException ( __FILE__, @@ -1025,6 +1031,7 @@ Module::IsDLL () const case RpcClient: case Alias: case IdlHeader: + case TypeLib: return false; } throw InvalidOperationException ( __FILE__, @@ -1056,6 +1063,7 @@ Module::GenerateInOutputTree () const case LiveIso: case IsoRegTest: case LiveIsoRegTest: + case TypeLib: return true; case StaticLibrary: case ObjectLibrary: @@ -1557,6 +1565,7 @@ AutoRegister::IsSupportedModuleType ( ModuleType type ) case RpcClient: case Alias: case IdlHeader: + case TypeLib: return false; } throw InvalidOperationException ( __FILE__, diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index 8d11c50ed9c..bf89d83f172 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -273,7 +273,8 @@ enum ModuleType ExportDriver = 22, IdlHeader = 23, IsoRegTest = 24, - LiveIsoRegTest = 25 + LiveIsoRegTest = 25, + TypeLib = 26 }; enum HostType