Author: fireball
Date: Sun Jun 18 23:39:13 2006
New Revision: 22400
URL:
http://svn.reactos.ru/svn/reactos?rev=22400&view=rev
Log:
Thomas Weidenmueller: RBUILD: Support generating headers from .idl files (Patch 1592)
Modified:
trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
trunk/reactos/tools/rbuild/bootstrap.cpp
trunk/reactos/tools/rbuild/module.cpp
trunk/reactos/tools/rbuild/rbuild.h
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
URL:
http://svn.reactos.ru/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 Sun Jun 18 23:39:13 2006
@@ -253,6 +253,9 @@
case Alias:
handler = new MingwAliasModuleHandler ( module );
break;
+ case IdlHeader:
+ handler = new MingwIdlHeaderModuleHandler ( module );
+ break;
default:
throw UnknownModuleTypeException (
module.node.location,
@@ -296,8 +299,10 @@
string newname;
if ( module.type == RpcServer )
newname = basename + "_s.c";
- else
+ else if ( module.type == RpcClient )
newname = basename + "_c.c";
+ else //if ( module.type == IdlHeader )
+ newname = basename + ".h";
PassThruCacheDirectory ( NormalizeFilename ( newname ),
backend->intermediateDirectory );
return new FileLocation ( backend->intermediateDirectory, NormalizeFilename (
newname ) );
@@ -314,7 +319,10 @@
if ( extension == ".idl" || extension == ".IDL" )
{
string basename = GetBasename ( filename );
- return GetRpcServerHeaderFilename ( basename ) + " " +
GetRpcClientHeaderFilename ( basename );
+ if ( module.type == IdlHeader )
+ return GetIdlHeaderFilename ( basename );
+ else
+ return GetRpcServerHeaderFilename ( basename ) + " " +
GetRpcClientHeaderFilename ( basename );
}
else
return "";
@@ -362,6 +370,8 @@
if ( module.type == RpcServer )
return true;
if ( module.type == RpcClient )
+ return true;
+ if ( module.type == IdlHeader )
return true;
return false;
}
@@ -478,10 +488,15 @@
newExtension = ".stubs.o";
else if ( extension == ".idl" || extension == ".IDL" )
{
- if ( module.type == RpcServer )
- newExtension = "_s.o";
+ if ( module.type == IdlHeader )
+ newExtension = ".h";
else
- newExtension = "_c.o";
+ {
+ if ( module.type == RpcServer )
+ newExtension = "_s.o";
+ else
+ newExtension = "_c.o";
+ }
}
else
newExtension = ".o";
@@ -759,7 +774,8 @@
string includeDirectory;
if ( include.baseModule != NULL &&
( include.baseModule->type == RpcServer ||
- include.baseModule->type == RpcClient ) )
+ include.baseModule->type == RpcClient ||
+ include.baseModule->type == IdlHeader) )
includeDirectory = PassThruCacheDirectory ( NormalizeFilename ( include.directory ),
backend->intermediateDirectory );
else
@@ -1195,6 +1211,13 @@
backend->intermediateDirectory );
}
+string
+MingwModuleHandler::GetIdlHeaderFilename ( string basename ) const
+{
+ return PassThruCacheDirectory ( basename + ".h",
+ backend->intermediateDirectory );
+}
+
void
MingwModuleHandler::GenerateWidlCommandsClient (
const CompilationUnit& compilationUnit,
@@ -1233,6 +1256,36 @@
}
void
+MingwModuleHandler::GenerateWidlCommandsIdlHeader (
+ const CompilationUnit& compilationUnit,
+ const string& widlflagsMacro )
+{
+ FileLocation* sourceFileLocation = compilationUnit.GetFilename (
backend->intermediateDirectory );
+ string filename = sourceFileLocation->filename;
+ string dependencies = filename;
+ dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
+
+ string basename = GetBasename ( filename );
+
+ string generatedHeaderFilename = GetIdlHeaderFilename ( basename );
+ CLEAN_FILE(generatedHeaderFilename);
+
+ fprintf ( fMakefile,
+ "%s: %s $(WIDL_TARGET) | %s\n",
+ generatedHeaderFilename.c_str (),
+ dependencies.c_str (),
+ GetDirectory ( generatedHeaderFilename ).c_str () );
+ fprintf ( fMakefile, "\t$(ECHO_WIDL)\n" );
+ fprintf ( fMakefile,
+ "\t%s %s %s -h -H %s %s\n",
+ "$(Q)$(WIDL_TARGET)",
+ GetWidlFlags ( compilationUnit ).c_str (),
+ widlflagsMacro.c_str (),
+ generatedHeaderFilename.c_str (),
+ filename.c_str () );
+}
+
+void
MingwModuleHandler::GenerateWidlCommands (
const CompilationUnit& compilationUnit,
const string& widlflagsMacro )
@@ -1240,9 +1293,12 @@
if ( module.type == RpcServer )
GenerateWidlCommandsServer ( compilationUnit,
widlflagsMacro );
- else
+ else if ( module.type == RpcClient )
GenerateWidlCommandsClient ( compilationUnit,
widlflagsMacro );
+ else if ( module.type == IdlHeader )
+ GenerateWidlCommandsIdlHeader ( compilationUnit,
+ widlflagsMacro );
}
void
@@ -1308,10 +1364,13 @@
{
GenerateWidlCommands ( compilationUnit,
widlflagsMacro );
- GenerateGccCommand ( GetActualSourceFilename ( sourceFileLocation ),
- GetExtraDependencies ( filename ),
- cc,
- cflagsMacro );
+ if ( module.type != IdlHeader )
+ {
+ GenerateGccCommand ( GetActualSourceFilename ( sourceFileLocation ),
+ GetExtraDependencies ( filename ),
+ cc,
+ cflagsMacro );
+ }
return;
}
@@ -1756,7 +1815,8 @@
{
Library& library = *module.non_if_data.libraries[i];
if ( library.importedModule->type == RpcServer ||
- library.importedModule->type == RpcClient )
+ library.importedModule->type == RpcClient ||
+ library.importedModule->type == IdlHeader )
{
for ( size_t j = 0; j <
library.importedModule->non_if_data.compilationUnits.size (); j++ )
{
@@ -1770,6 +1830,8 @@
dependencies.push_back ( GetRpcServerHeaderFilename ( basename ) );
if ( library.importedModule->type == RpcClient )
dependencies.push_back ( GetRpcClientHeaderFilename ( basename ) );
+ if ( library.importedModule->type == IdlHeader )
+ dependencies.push_back ( GetIdlHeaderFilename ( basename ) );
}
}
}
@@ -3248,3 +3310,16 @@
MingwAliasModuleHandler::Process ()
{
}
+
+MingwIdlHeaderModuleHandler::MingwIdlHeaderModuleHandler (
+ const Module& module_ )
+
+ : MingwModuleHandler ( module_ )
+{
+}
+
+void
+MingwIdlHeaderModuleHandler::Process ()
+{
+ GenerateRules ();
+}
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
URL:
http://svn.reactos.ru/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 Sun Jun 18 23:39:13 2006
@@ -166,6 +166,9 @@
const CompilationUnit& compilationUnit,
const std::string& widlflagsMacro );
void GenerateWidlCommandsClient (
+ const CompilationUnit& compilationUnit,
+ const std::string& widlflagsMacro );
+ void GenerateWidlCommandsIdlHeader (
const CompilationUnit& compilationUnit,
const std::string& widlflagsMacro );
void GenerateWidlCommands ( const CompilationUnit& compilationUnit,
@@ -206,6 +209,7 @@
void GetRpcHeaderDependencies ( std::vector<std::string>& dependencies )
const;
std::string GetRpcServerHeaderFilename ( std::string basename ) const;
std::string GetRpcClientHeaderFilename ( std::string basename ) const;
+ std::string GetIdlHeaderFilename ( std::string basename ) const;
std::string GetModuleCleanTarget ( const Module& module ) const;
void GetReferencedObjectLibraryModuleCleanTargets ( std::vector<std::string>&
moduleNames ) const;
public:
@@ -468,4 +472,12 @@
virtual void Process ();
};
+class MingwIdlHeaderModuleHandler : public MingwModuleHandler
+{
+public:
+ MingwIdlHeaderModuleHandler ( const Module& module );
+ virtual HostType DefaultHost() { return HostFalse; }
+ virtual void Process ();
+};
+
#endif /* MINGW_MODULEHANDLER_H */
Modified: trunk/reactos/tools/rbuild/bootstrap.cpp
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/bootstrap.cpp?…
==============================================================================
--- trunk/reactos/tools/rbuild/bootstrap.cpp (original)
+++ trunk/reactos/tools/rbuild/bootstrap.cpp Sun Jun 18 23:39:13 2006
@@ -64,6 +64,7 @@
case RpcServer:
case RpcClient:
case Alias:
+ case IdlHeader:
return false;
}
throw InvalidOperationException ( __FILE__,
Modified: trunk/reactos/tools/rbuild/module.cpp
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/module.cpp?rev…
==============================================================================
--- trunk/reactos/tools/rbuild/module.cpp (original)
+++ trunk/reactos/tools/rbuild/module.cpp Sun Jun 18 23:39:13 2006
@@ -746,7 +746,7 @@
if ( attribute.value == "win32gui" )
return Win32GUI;
if ( attribute.value == "win32scr" )
- return Win32SCR;
+ return Win32SCR;
if ( attribute.value == "bootloader" )
return BootLoader;
if ( attribute.value == "bootsector" )
@@ -765,6 +765,8 @@
return RpcClient;
if ( attribute.value == "alias" )
return Alias;
+ if ( attribute.value == "idlheader" )
+ return IdlHeader;
throw InvalidAttributeValueException ( location,
attribute.name,
attribute.value );
@@ -809,8 +811,8 @@
case RpcClient:
return ".o";
case Alias:
- return "";
case BootProgram:
+ case IdlHeader:
return "";
}
throw InvalidOperationException ( __FILE__,
@@ -857,6 +859,7 @@
case RpcClient:
case Alias:
case BootProgram:
+ case IdlHeader:
return "";
}
throw InvalidOperationException ( __FILE__,
@@ -895,6 +898,7 @@
case RpcClient:
case Alias:
case BootProgram:
+ case IdlHeader:
return "";
}
throw InvalidOperationException ( __FILE__,
@@ -935,6 +939,7 @@
case RpcServer:
case RpcClient:
case Alias:
+ case IdlHeader:
return false;
}
throw InvalidOperationException ( __FILE__,
@@ -969,6 +974,7 @@
case RpcServer:
case RpcClient:
case Alias:
+ case IdlHeader:
return false;
}
throw InvalidOperationException ( __FILE__,
@@ -1422,6 +1428,7 @@
case RpcServer:
case RpcClient:
case Alias:
+ case IdlHeader:
return false;
}
throw InvalidOperationException ( __FILE__,
Modified: trunk/reactos/tools/rbuild/rbuild.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h?rev=2…
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.h (original)
+++ trunk/reactos/tools/rbuild/rbuild.h Sun Jun 18 23:39:13 2006
@@ -265,7 +265,8 @@
Alias = 18,
BootProgram = 19,
Win32SCR = 20,
- ExportDriver = 21
+ ExportDriver = 21,
+ IdlHeader = 22
};
enum HostType