Modified: branches/xmlbuildsystem/reactos/ReactOS.xml
Added: branches/xmlbuildsystem/reactos/lib/directory.xml
Added: branches/xmlbuildsystem/reactos/lib/kjs/module.xml
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
--- branches/xmlbuildsystem/reactos/ReactOS.xml 2005-01-06 20:38:14 UTC (rev 12855)
+++ branches/xmlbuildsystem/reactos/ReactOS.xml 2005-01-06 22:22:13 UTC (rev 12856)
@@ -4,6 +4,9 @@
<file>depends.c</file>
</module>
</directory>
+ <directory name="lib">
+ <xi:include href="lib/directory.xml" />
+ </directory>
<directory name="ntoskrnl">
<xi:include href="ntoskrnl/module.xml" />
</directory>
--- branches/xmlbuildsystem/reactos/lib/directory.xml 2005-01-06 20:38:14 UTC (rev 12855)
+++ branches/xmlbuildsystem/reactos/lib/directory.xml 2005-01-06 22:22:13 UTC (rev 12856)
@@ -0,0 +1,3 @@
+<directory name="kjs">
+ <xi:include href="kjs/module.xml" />
+</directory>
--- branches/xmlbuildsystem/reactos/lib/kjs/module.xml 2005-01-06 20:38:14 UTC (rev 12855)
+++ branches/xmlbuildsystem/reactos/lib/kjs/module.xml 2005-01-06 22:22:13 UTC (rev 12856)
@@ -0,0 +1,42 @@
+<module name="kjs" type="staticlibrary">
+ <include>.</include>
+ <include>./src</include>
+ <include>./include</include>
+ <directory name="ksrc">
+ <file>setjmp.S</file>
+ <file>longjmp.S</file>
+ <file>alloc.c</file>
+ <file>bc.c</file>
+ <file>b_core.c</file>
+ <file>b_file.c</file>
+ <file>b_func.c</file>
+ <file>b_regexp.c</file>
+ <file>b_system.c</file>
+ <file>compat.c</file>
+ <file>debug.c</file>
+ <file>iostream.c</file>
+ <file>js.c</file>
+ <file>kjs.c</file>
+ <file>mrgsort.c</file>
+ <file>object.c</file>
+ <file>regex.c</file>
+ <file>vm.c</file>
+ <file>vmjumps.c</file>
+ <file>vmswitch.c</file>
+ <file>vmswt0.c</file>
+ <file>longjmp.c</file>
+ </directory>
+ <directory name="src">
+ <file>b_array.c</file>
+ <file>b_bool.c</file>
+ <file>b_object.c</file>
+ <file>b_number.c</file>
+ <file>b_string.c</file>
+ <file>b_vm.c</file>
+ <file>compiler.c</file>
+ <file>crc32.c</file>
+ <file>dl_dummy.c</file>
+ <file>heap.c</file>
+ <file>utils.c</file>
+ </directory>
+</module>
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-06 20:38:14 UTC (rev 12855)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-06 22:22:13 UTC (rev 12856)
@@ -61,9 +61,11 @@
void
MingwBackend::GenerateGlobalVariables ()
{
+ fprintf ( fMakefile, "rm = del /y\n" );
fprintf ( fMakefile, "gcc = gcc\n" );
fprintf ( fMakefile, "ld = ld\n" );
fprintf ( fMakefile, "ar = ar\n" );
+ fprintf ( fMakefile, "dlltool = dlltool\n" );
fprintf ( fMakefile, "\n" );
}
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp 2005-01-06 20:38:14 UTC (rev 12855)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp 2005-01-06 22:22:13 UTC (rev 12856)
@@ -13,6 +13,12 @@
}
string
+MingwModuleHandler::GetWorkingDirectory ()
+{
+ return ".";
+}
+
+string
MingwModuleHandler::ReplaceExtension ( string filename,
string newExtension )
{
@@ -30,7 +36,7 @@
}
string
-MingwModuleHandler::GetModuleLibraryDependencies ( Module& module )
+MingwModuleHandler::GetImportLibraryDependencies ( Module& module )
{
if ( module.libraries.size () == 0 )
return "";
@@ -40,7 +46,9 @@
{
if ( dependencies.size () > 0 )
dependencies += " ";
- dependencies += module.libraries[i]->name;
+ Module* importedModule = module.project->LocateModule ( module.libraries[i]->name );
+ assert ( importedModule != NULL );
+ dependencies += importedModule->GetPath ().c_str ();
}
return dependencies;
}
@@ -96,8 +104,8 @@
string objectFilename = GetObjectFilename ( sourceFilename );
fprintf ( fMakefile,
"%s: %s\n",
- sourceFilename.c_str (),
- objectFilename.c_str() );
+ objectFilename.c_str (),
+ sourceFilename.c_str() );
fprintf ( fMakefile,
"\t${gcc} -c %s -o %s\n",
sourceFilename.c_str (),
@@ -146,10 +154,40 @@
void
MingwKernelModuleHandler::GenerateKernelModuleTarget ( Module& module )
{
- fprintf ( fMakefile, "%s: %s\n",
+ string workingDirectory = GetWorkingDirectory ( );
+ string archiveFilename = GetModuleArchiveFilename ( module );
+ string importLibraryDependencies = GetImportLibraryDependencies ( module );
+ fprintf ( fMakefile, "%s: %s %s\n",
module.GetPath ().c_str (),
- GetModuleLibraryDependencies ( module ).c_str () );
- fprintf ( fMakefile, "\t\n\n" );
+ archiveFilename.c_str (),
+ importLibraryDependencies.c_str () );
+ fprintf ( fMakefile,
+ "\t${gcc} -Wl,--base-file,%s/base.tmp -o %s/junk.tmp %s %s\n",
+ workingDirectory.c_str (),
+ workingDirectory.c_str (),
+ archiveFilename.c_str (),
+ importLibraryDependencies.c_str () );
+ fprintf ( fMakefile,
+ "\t${rm} %s/junk.tmp\n",
+ workingDirectory.c_str () );
+ fprintf ( fMakefile,
+ "\t${dlltool} --dllname %s --base-file %s/base.tmp --output-exp %s/temp.exp --kill-at\n",
+ module.GetPath ().c_str (),
+ workingDirectory.c_str (),
+ workingDirectory.c_str ());
+ fprintf ( fMakefile,
+ "\t${rm} %s/base.tmp\n",
+ workingDirectory.c_str () );
+ fprintf ( fMakefile,
+ "\t${ld} -Wl,%s/temp.exp -o %s %s %s\n",
+ workingDirectory.c_str (),
+ module.GetPath ().c_str (),
+ archiveFilename.c_str (),
+ importLibraryDependencies.c_str () );
+ fprintf ( fMakefile,
+ "\t${rm} %s/temp.exp\n",
+ workingDirectory.c_str () );
+
GenerateArchiveTarget ( module );
GenerateObjectFileTargets ( module );
}
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h 2005-01-06 20:38:14 UTC (rev 12855)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h 2005-01-06 22:22:13 UTC (rev 12856)
@@ -10,10 +10,11 @@
virtual bool CanHandleModule ( Module& module ) = 0;
virtual void Process ( Module& module ) = 0;
protected:
+ std::string MingwModuleHandler::GetWorkingDirectory ();
std::string ReplaceExtension ( std::string filename,
std::string newExtension );
std::string GetModuleArchiveFilename ( Module& module );
- std::string GetModuleLibraryDependencies ( Module& module );
+ std::string GetImportLibraryDependencies ( Module& module );
std::string GetSourceFilenames ( Module& module );
std::string GetObjectFilename ( std::string sourceFilename );
std::string GetObjectFilenames ( Module& module );
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-06 20:38:14 UTC (rev 12855)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-06 22:22:13 UTC (rev 12856)
@@ -40,10 +40,12 @@
}
#endif
-Module::Module ( const XMLElement& moduleNode,
+Module::Module ( Project* project,
+ const XMLElement& moduleNode,
const string& moduleName,
const string& modulePath )
- : node(moduleNode),
+ : project(project),
+ node(moduleNode),
name(moduleName),
path(modulePath)
{
@@ -87,6 +89,8 @@
{
if ( attribute.value == "buildtool" )
return BuildTool;
+ if ( attribute.value == "staticlibrary" )
+ return StaticLibrary;
if ( attribute.value == "kernelmodedll" )
return KernelModeDLL;
throw InvalidAttributeValueException ( attribute.name,
--- branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-06 20:38:14 UTC (rev 12855)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-06 22:22:13 UTC (rev 12856)
@@ -64,7 +64,7 @@
{
att = e.GetAttribute ( "name", true );
assert(att);
- Module* module = new Module ( e, att->value, path );
+ Module* module = new Module ( this, e, att->value, path );
modules.push_back ( module );
module->ProcessXML ( e, path );
return;
@@ -78,3 +78,15 @@
for ( size_t i = 0; i < e.subElements.size (); i++ )
ProcessXML ( *e.subElements[i], subpath );
}
+
+Module*
+Project::LocateModule ( string name )
+{
+ for ( size_t i = 0; i < modules.size (); i++ )
+ {
+ if (modules[i]->name == name)
+ return modules[i];
+ }
+
+ return NULL;
+}
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-06 20:38:14 UTC (rev 12855)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-06 22:22:13 UTC (rev 12856)
@@ -24,6 +24,7 @@
~Project ();
void ProcessXML ( const XMLElement& e,
const std::string& path );
+ Module* LocateModule ( std::string name );
private:
void ReadXml ();
XMLFile xmlfile;
@@ -34,12 +35,14 @@
enum ModuleType
{
BuildTool,
+ StaticLibrary,
KernelModeDLL
};
class Module
{
public:
+ Project* project;
const XMLElement& node;
std::string name;
std::string path;
@@ -47,7 +50,8 @@
std::vector<File*> files;
std::vector<Library*> libraries;
- Module ( const XMLElement& moduleNode,
+ Module ( Project* project,
+ const XMLElement& moduleNode,
const std::string& moduleName,
const std::string& modulePath );
~Module();