Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-05 21:29:54 UTC (rev 12839)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-05 22:36:17 UTC (rev 12840)
@@ -103,5 +103,5 @@
void MingwBackend::GetModuleHandlers ( MingwModuleHandlerList& moduleHandlers )
{
- moduleHandlers.push_back ( new MingwKernelModuleHandler () );
+ moduleHandlers.push_back ( new MingwKernelModuleHandler ( fMakefile ) );
}
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp 2005-01-05 21:29:54 UTC (rev 12839)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp 2005-01-05 22:36:17 UTC (rev 12840)
@@ -5,12 +5,29 @@
#include "mingw.h"
#include "modulehandler.h"
-MingwModuleHandler::MingwModuleHandler ()
+using std::string;
+
+MingwModuleHandler::MingwModuleHandler ( FILE* fMakefile )
+ : fMakefile ( fMakefile )
{
}
+string MingwModuleHandler::GetModuleDependencies ( Module& module )
+{
+ string dependencies ( "" );
+
+ for ( size_t i = 0; i < module.libraries.size(); i++ )
+ {
+ if (dependencies.size () > 0)
+ dependencies += " ";
+ dependencies += module.libraries[i]->name;
+ }
+ return dependencies;
+}
-MingwKernelModuleHandler::MingwKernelModuleHandler ()
+
+MingwKernelModuleHandler::MingwKernelModuleHandler ( FILE* fMakefile )
+ : MingwModuleHandler ( fMakefile )
{
}
@@ -21,4 +38,15 @@
void MingwKernelModuleHandler::Process ( Module& module )
{
+ GenerateKernelModuleTarget ( module );
}
+
+void MingwKernelModuleHandler::GenerateKernelModuleTarget ( Module& module )
+{
+ fprintf ( fMakefile, "%s: %s",
+ module.name.c_str (),
+ GetModuleDependencies ( module ).c_str () );
+ fprintf ( fMakefile, "\n" );
+ fprintf ( fMakefile, "\t" );
+ fprintf ( fMakefile, "\n\n" );
+}
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h 2005-01-05 21:29:54 UTC (rev 12839)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h 2005-01-05 22:36:17 UTC (rev 12840)
@@ -6,18 +6,23 @@
class MingwModuleHandler
{
public:
- MingwModuleHandler ();
+ MingwModuleHandler ( FILE* fMakefile );
virtual bool CanHandleModule ( Module& module ) = 0;
virtual void Process ( Module& module ) = 0;
+protected:
+ FILE* fMakefile;
+ std::string GetModuleDependencies ( Module& module );
};
class MingwKernelModuleHandler : public MingwModuleHandler
{
public:
- MingwKernelModuleHandler ();
+ MingwKernelModuleHandler ( FILE* fMakefile );
virtual bool CanHandleModule ( Module& module );
virtual void Process ( Module& module );
+private:
+ void GenerateKernelModuleTarget ( Module& module );
};
#endif /* MINGW_MODULEHANDLER_H */
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-05 21:29:54 UTC (rev 12839)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-05 22:36:17 UTC (rev 12840)
@@ -21,6 +21,8 @@
{
for ( size_t i = 0; i < files.size(); i++ )
delete files[i];
+ for ( size_t i = 0; i < libraries.size(); i++ )
+ delete libraries[i];
}
void Module::ProcessXML ( const XMLElement& e,
@@ -31,6 +33,10 @@
{
files.push_back ( new File ( path + "/" + e.value ) );
}
+ else if ( e.name == "library" && e.value.size () )
+ {
+ libraries.push_back ( new Library ( e.value ) );
+ }
else if ( e.name == "directory" )
{
const XMLAttribute* att = e.GetAttribute ( "name", true );
@@ -50,7 +56,14 @@
attribute.value );
}
+
File::File ( const string& _name )
: name(_name)
{
}
+
+
+Library::Library ( const string& _name )
+ : name(_name)
+{
+}
--- branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-05 21:29:54 UTC (rev 12839)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-05 22:36:17 UTC (rev 12840)
@@ -60,8 +60,6 @@
else if ( e.name == "module" )
{
att = e.GetAttribute ( "name", true );
- if ( !att )
- return;
Module* module = new Module ( e, att->value, path );
modules.push_back ( module );
module->ProcessXML ( e, path );
@@ -69,10 +67,7 @@
}
else if ( e.name == "directory" )
{
- // this code is duplicated between Project::ProcessXML() and Module::ProcessXML() :(
const XMLAttribute* att = e.GetAttribute ( "name", true );
- if ( !att )
- return;
subpath = path + "/" + att->value;
}
for ( size_t i = 0; i < e.subElements.size (); i++ )
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-05 21:29:54 UTC (rev 12839)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-05 22:36:17 UTC (rev 12840)
@@ -10,6 +10,7 @@
class Project;
class Module;
class File;
+class Library;
class Project
{
@@ -42,8 +43,9 @@
const XMLElement& node;
std::string name;
std::string path;
+ ModuleType type;
std::vector<File*> files;
- ModuleType type;
+ std::vector<Library*> libraries;
Module ( const XMLElement& moduleNode,
const std::string& moduleName,
@@ -64,4 +66,13 @@
File ( const std::string& _name );
};
+
+class Library
+{
+public:
+ std::string name;
+
+ Library ( const std::string& _name );
+};
+
#endif /* __RBUILD_H */
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml 2005-01-05 21:29:54 UTC (rev 12839)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml 2005-01-05 22:36:17 UTC (rev 12840)
@@ -7,6 +7,7 @@
</directory>
<directory name="dir2">
<module name="module2" type="kernelmodedll">
+ <library>module1</library>
<file>file3.c</file>
<file>file4.c</file>
</module>
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp 2005-01-05 21:29:54 UTC (rev 12839)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp 2005-01-05 22:36:17 UTC (rev 12840)
@@ -13,10 +13,17 @@
ARE_EQUAL(2, module1.files.size());
ARE_EQUAL("./dir1/file1.c", module1.files[0]->name);
ARE_EQUAL("./dir1/file2.c", module1.files[1]->name);
-
+
+ ARE_EQUAL(0, module1.libraries.size());
+
Module& module2 = *project.modules[1];
IS_TRUE(module2.type == KernelModeDLL);
ARE_EQUAL(2, module2.files.size());
ARE_EQUAL("./dir2/file3.c", module2.files[0]->name);
ARE_EQUAL("./dir2/file4.c", module2.files[1]->name);
+
+ ARE_EQUAL(1, module2.libraries.size());
+ Library& library1 = *module2.libraries[0];
+
+ ARE_EQUAL("module1", library1.name);
}