Include and define support.
Modified: branches/xmlbuildsystem/reactos/ReactOS.xml
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/module.xml
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.h
Added: branches/xmlbuildsystem/reactos/tools/rbuild/define.cpp
Added: branches/xmlbuildsystem/reactos/tools/rbuild/include.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile
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/test.h
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp
Added:
branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/define.xml
Added:
branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/include.xml
Added: branches/xmlbuildsystem/reactos/tools/rbuild/tests/definetest.cpp
Added:
branches/xmlbuildsystem/reactos/tools/rbuild/tests/includetest.cpp
_____
Modified: branches/xmlbuildsystem/reactos/ReactOS.xml
--- branches/xmlbuildsystem/reactos/ReactOS.xml 2005-01-07 19:24:54 UTC
(rev 12875)
+++ branches/xmlbuildsystem/reactos/ReactOS.xml 2005-01-07 21:46:18 UTC
(rev 12876)
@@ -1,4 +1,7 @@
<project name="ReactOS" makefile="Makefile.auto">
+ <define name="_M_IX86"></define>
+ <include>./include</include>
+ <include>./w32api/include</include>
<directory name="tools">
<module name="depends" type="buildtool">
<file>depends.c</file>
_____
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/module.xml
--- branches/xmlbuildsystem/reactos/ntoskrnl/module.xml 2005-01-07
19:24:54 UTC (rev 12875)
+++ branches/xmlbuildsystem/reactos/ntoskrnl/module.xml 2005-01-07
21:46:18 UTC (rev 12876)
@@ -1,4 +1,9 @@
<module name="ntoskrnl" type="kernelmodedll">
+ <define name="_SEH_NO_NATIVE_NLG"></define>
+ <define name="_DISABLE_TIDENTS"></define>
+ <define name="__NTOSKRNL__"></define>
+ <define name="__3GB__"></define>
+ <include>.</include>
<include>./include</include>
<include>../lib/kjs/include</include>
<library>kjs</library>
@@ -7,7 +12,6 @@
<file>copy.c</file>
<file>fs.c</file>
<file>mdl.c</file>
- <file>misc.c</file>
<file>pin.c</file>
<file>view.c</file>
</directory>
@@ -35,8 +39,8 @@
<file>kdb.c</file>
<file>kdb_keyboard.c</file>
<file>kdb_serial.c</file>
+ <file>rdebug.c</file>
<file>profile.c</file>
- <file>rdebug.c</file>
</group>
</if>
<or>
@@ -53,10 +57,10 @@
</group>
</if>
</or>
- <file>user.c</file>
<file>dbgctrl.c</file>
<file>errinfo.c</file>
<file>print.c</file>
+ <file>user.c</file>
</directory>
<directory name="ex">
<if property="arch" value="i386">
@@ -100,10 +104,6 @@
<file>util.c</file>
</directory>
<directory name="inbv">
- <if property="arch" value="i386">
- <directory name="i386">
- </directory>
- </if>
<file>inbv.c</file>
</directory>
<directory name="io">
@@ -177,9 +177,8 @@
<file>i386-mcount.S</file>
<file>idt.c</file>
<file>irq.c</file>
- <file>irqhand.S</file>
+ <file>irqhand.s</file>
<file>kernel.c</file>
- <file>kernel.c</file>
<file>ldt.c</file>
<file>multiboot.S</file>
<file>stkswitch.S</file>
@@ -251,6 +250,9 @@
<file>balance.c</file>
<file>cont.c</file>
<file>drvlck.c</file>
+ <file>elf32.c</file>
+ <file>elf64.c</file>
+ <file>elf.c</file>
<file>freelist.c</file>
<file>iospace.c</file>
<file>kmap.c</file>
@@ -266,6 +268,7 @@
<file>pager.c</file>
<file>pagfault.c</file>
<file>paging.c</file>
+ <file>pe.c</file>
<file>physical.c</file>
<file>pool.c</file>
<file>ppool.c</file>
Property changes on: branches/xmlbuildsystem/reactos/tools/rbuild
___________________________________________________________________
Name: svn:ignore
+ *.exe
_____
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp
---
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp 2005-01-07 19:24:54 UTC (rev 12875)
+++
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp 2005-01-07 21:46:18 UTC (rev 12876)
@@ -7,6 +7,7 @@
#include "modulehandler.h"
using std::string;
+using std::vector;
MingwModuleHandler::MingwModuleHandler ( FILE* fMakefile )
: fMakefile ( fMakefile )
@@ -93,6 +94,80 @@
return objectFilenames;
}
+string
+MingwModuleHandler::GenerateGccDefineParametersFromVector (
vector<Define*> defines )
+{
+ string parameters;
+ for (size_t i = 0; i < defines.size (); i++)
+ {
+ Define& define = *defines[i];
+ if (parameters.length () > 0)
+ parameters += " ";
+ parameters += "-D";
+ parameters += define.name;
+ if (define.value.length () > 0)
+ {
+ parameters += "=";
+ parameters += define.value;
+ }
+ }
+ return parameters;
+}
+
+string
+MingwModuleHandler::GenerateGccDefineParameters ( Module& module )
+{
+ string parameters = GenerateGccDefineParametersFromVector (
module.project->defines );
+ string s = GenerateGccDefineParametersFromVector (
module.defines );
+ if (s.length () > 0)
+ {
+ parameters += " ";
+ parameters += s;
+ }
+ return parameters;
+}
+
+string
+MingwModuleHandler::GenerateGccIncludeParametersFromVector (
vector<Include*> includes )
+{
+ string parameters;
+ for (size_t i = 0; i < includes.size (); i++)
+ {
+ Include& include = *includes[i];
+ if (parameters.length () > 0)
+ parameters += " ";
+ parameters += "-I";
+ parameters += include.directory;
+ }
+ return parameters;
+}
+
+string
+MingwModuleHandler::GenerateGccIncludeParameters ( Module& module )
+{
+ string parameters = GenerateGccIncludeParametersFromVector (
module.project->includes );
+ string s = GenerateGccIncludeParametersFromVector (
module.includes );
+ if (s.length () > 0)
+ {
+ parameters += " ";
+ parameters += s;
+ }
+ return parameters;
+}
+
+string
+MingwModuleHandler::GenerateGccParameters ( Module& module )
+{
+ string parameters = GenerateGccDefineParameters ( module );
+ string s = GenerateGccIncludeParameters ( module );
+ if (s.length () > 0)
+ {
+ parameters += " ";
+ parameters += s;
+ }
+ return parameters;
+}
+
void
MingwModuleHandler::GenerateObjectFileTargets ( Module& module )
{
@@ -108,9 +183,10 @@
objectFilename.c_str (),
sourceFilename.c_str() );
fprintf ( fMakefile,
- "\t${gcc} -c %s -o %s\n",
+ "\t${gcc} -c %s -o %s %s\n",
sourceFilename.c_str (),
- objectFilename.c_str () );
+ objectFilename.c_str (),
+ GenerateGccParameters ( module ).c_str () );
}
fprintf ( fMakefile, "\n" );
_____
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.h
---
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.h 2005-01-07 19:24:54 UTC (rev 12875)
+++
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.h 2005-01-07 21:46:18 UTC (rev 12876)
@@ -21,6 +21,12 @@
void GenerateObjectFileTargets ( Module& module );
void GenerateArchiveTarget ( Module& module );
FILE* fMakefile;
+private:
+ std::string GenerateGccDefineParametersFromVector (
std::vector<Define*> defines );
+ std::string GenerateGccDefineParameters ( Module& module );
+ std::string GenerateGccIncludeParametersFromVector (
std::vector<Include*> includes );
+ std::string GenerateGccIncludeParameters ( Module& module );
+ std::string GenerateGccParameters ( Module& module );
};
_____
Added: branches/xmlbuildsystem/reactos/tools/rbuild/define.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/define.cpp
2005-01-07 19:24:54 UTC (rev 12875)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/define.cpp
2005-01-07 21:46:18 UTC (rev 12876)
@@ -0,0 +1,44 @@
+#include "pch.h"
+#include <assert.h>
+
+#include "rbuild.h"
+
+using std::string;
+using std::vector;
+
+Define::Define ( Project* project,
+ const XMLElement& defineNode )
+ : project(project),
+ module(NULL),
+ node(defineNode)
+{
+ Initialize (defineNode);
+}
+
+Define::Define ( Project* project,
+ Module* module,
+ const XMLElement& defineNode )
+ : project(project),
+ module(module),
+ node(defineNode)
+{
+ Initialize (defineNode);
+}
+
+Define::~Define ()
+{
+}
+
+void
+Define::Initialize ( const XMLElement& defineNode )
+{
+ const XMLAttribute* att = defineNode.GetAttribute ( "name", true
);
+ assert(att);
+ name = att->value;
+ value = defineNode.value;
+}
+
+void
+Define::ProcessXML ( const XMLElement& e )
+{
+}
_____
Added: branches/xmlbuildsystem/reactos/tools/rbuild/include.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/include.cpp
2005-01-07 19:24:54 UTC (rev 12875)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/include.cpp
2005-01-07 21:46:18 UTC (rev 12876)
@@ -0,0 +1,39 @@
+#include "pch.h"
+#include <assert.h>
+
+#include "rbuild.h"
+
+using std::string;
+using std::vector;
+
+Include::Include ( Project* project,
+ const XMLElement& includeNode )
+ : project(project),
+ node(includeNode)
+{
+ Initialize ( includeNode );
+}
+
+Include::Include ( Project* project,
+ Module* module,
+ const XMLElement& includeNode )
+ : project(project),
+ node(includeNode)
+{
+ Initialize ( includeNode );
+}
+
+Include::~Include ()
+{
+}
+
+void
+Include::Initialize ( const XMLElement& includeNode )
+{
+ directory = includeNode.value;
+}
+
+void
+Include::ProcessXML ( const XMLElement& e )
+{
+}
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile
--- branches/xmlbuildsystem/reactos/tools/rbuild/makefile
2005-01-07 19:24:54 UTC (rev 12875)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/makefile
2005-01-07 21:46:18 UTC (rev 12876)
@@ -14,7 +14,9 @@
BASE_OBJECTS = \
$(BACKEND_BASE_OBJECTS) \
+ define.o \
exception.o \
+ include.o \
module.o \
project.o \
ssprintf.o \
@@ -23,6 +25,8 @@
OBJECTS = $(BASE_OBJECTS) rbuild.o
TESTS = \
+ tests/definetest.o \
+ tests/includetest.o \
tests/moduletest.o \
tests/projecttest.o
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
2005-01-07 19:24:54 UTC (rev 12875)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
2005-01-07 21:46:18 UTC (rev 12876)
@@ -61,6 +61,18 @@
assert(att);
subpath = path + CSEP + att->value;
}
+ else if ( e.name == "include" )
+ {
+ Include* include = new Include ( project, this, e );
+ includes.push_back ( include );
+ include->ProcessXML ( e );
+ }
+ else if ( e.name == "define" )
+ {
+ Define* define = new Define ( project, this, e );
+ defines.push_back ( define );
+ define->ProcessXML ( e );
+ }
for ( size_t i = 0; i < e.subElements.size (); i++ )
ProcessXML ( *e.subElements[i], subpath );
}
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp
2005-01-07 19:24:54 UTC (rev 12875)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp
2005-01-07 21:46:18 UTC (rev 12876)
@@ -72,6 +72,18 @@
assert(att);
subpath = path + CSEP + att->value;
}
+ else if ( e.name == "include" )
+ {
+ Include* include = new Include ( this, e );
+ includes.push_back ( include );
+ include->ProcessXML ( e );
+ }
+ else if ( e.name == "define" )
+ {
+ Define* define = new Define ( this, e );
+ defines.push_back ( define );
+ define->ProcessXML ( e );
+ }
for ( size_t i = 0; i < e.subElements.size (); i++ )
ProcessXML ( *e.subElements[i], subpath );
}
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
2005-01-07 19:24:54 UTC (rev 12875)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
2005-01-07 21:46:18 UTC (rev 12876)
@@ -23,6 +23,8 @@
class Project;
class Module;
+class Include;
+class Define;
class File;
class Library;
@@ -32,7 +34,9 @@
std::string name;
std::string makefile;
std::vector<Module*> modules;
-
+ std::vector<Include*> includes;
+ std::vector<Define*> defines;
+
Project ();
Project ( const std::string& filename );
~Project ();
@@ -53,6 +57,7 @@
KernelModeDLL
};
+
class Module
{
public:
@@ -63,18 +68,61 @@
ModuleType type;
std::vector<File*> files;
std::vector<Library*> libraries;
+ std::vector<Include*> includes;
+ std::vector<Define*> defines;
Module ( Project* project,
const XMLElement& moduleNode,
const std::string& moduleName,
const std::string& modulePath );
- ~Module();
+ ~Module ();
ModuleType GetModuleType (const XMLAttribute& attribute );
std::string GetPath ();
void ProcessXML ( const XMLElement& e, const std::string& path
);
};
+class Include
+{
+public:
+ Project* project;
+ Module* module;
+ const XMLElement& node;
+ std::string directory;
+
+ Include ( Project* project,
+ const XMLElement& includeNode );
+ Include ( Project* project,
+ Module* module,
+ const XMLElement& includeNode );
+ ~Include ();
+ void ProcessXML ( const XMLElement& e );
+private:
+ void Initialize ( const XMLElement& includeNode );
+};
+
+
+class Define
+{
+public:
+ Project* project;
+ Module* module;
+ const XMLElement& node;
+ std::string name;
+ std::string value;
+
+ Define ( Project* project,
+ const XMLElement& defineNode );
+ Define ( Project* project,
+ Module* module,
+ const XMLElement& defineNode );
+ ~Define();
+ void ProcessXML ( const XMLElement& e );
+private:
+ void Initialize ( const XMLElement& defineNode );
+};
+
+
class File
{
public:
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/test.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/test.h 2005-01-07
19:24:54 UTC (rev 12875)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/test.h 2005-01-07
21:46:18 UTC (rev 12876)
@@ -52,4 +52,18 @@
void Run();
};
+
+class DefineTest : public BaseTest
+{
+public:
+ void Run();
+};
+
+
+class IncludeTest : public BaseTest
+{
+public:
+ void Run();
+};
+
#endif /* __TEST_H */
_____
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp
2005-01-07 19:24:54 UTC (rev 12875)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp
2005-01-07 21:46:18 UTC (rev 12876)
@@ -147,6 +147,8 @@
{
tests.push_back(new ProjectTest());
tests.push_back(new ModuleTest());
+ tests.push_back(new DefineTest());
+ tests.push_back(new IncludeTest());
}
};
_____
Added:
branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/define.xml
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/define.xml
2005-01-07 19:24:54 UTC (rev 12875)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/define.xml
2005-01-07 21:46:18 UTC (rev 12876)
@@ -0,0 +1,9 @@
+<?xml version="1.0" ?>
+<project name="Project" makefile="Makefile">
+ <define name="define1">value1</define>
+ <directory name="dir1">
+ <module name="module1" type="buildtool">
+ <define name="define2">value2</define>
+ </module>
+ </directory>
+</project>
_____
Added:
branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/include.xml
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/include.xml
2005-01-07 19:24:54 UTC (rev 12875)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/include.xml
2005-01-07 21:46:18 UTC (rev 12876)
@@ -0,0 +1,9 @@
+<?xml version="1.0" ?>
+<project name="Project" makefile="Makefile">
+ <include>include1</include>
+ <directory name="dir1">
+ <module name="module1" type="buildtool">
+ <include>include2</include>
+ </module>
+ </directory>
+</project>
_____
Added: branches/xmlbuildsystem/reactos/tools/rbuild/tests/definetest.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/definetest.cpp
2005-01-07 19:24:54 UTC (rev 12875)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/definetest.cpp
2005-01-07 21:46:18 UTC (rev 12876)
@@ -0,0 +1,21 @@
+#include "test.h"
+
+using std::string;
+
+void DefineTest::Run()
+{
+ string projectFilename ( "tests/data/define.xml" );
+ Project project ( projectFilename );
+ ARE_EQUAL(1, project.defines.size());
+ Define& define1 = *project.defines[0];
+ ARE_EQUAL("define1", define1.name);
+ ARE_EQUAL("value1", define1.value);
+
+ ARE_EQUAL(1, project.modules.size());
+ Module& module1 = *project.modules[0];
+
+ ARE_EQUAL(1, module1.defines.size());
+ Define& define2 = *module1.defines[0];
+ ARE_EQUAL("define2", define2.name);
+ ARE_EQUAL("value2", define2.value);
+}
_____
Added:
branches/xmlbuildsystem/reactos/tools/rbuild/tests/includetest.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/includetest.cpp
2005-01-07 19:24:54 UTC (rev 12875)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/includetest.cpp
2005-01-07 21:46:18 UTC (rev 12876)
@@ -0,0 +1,19 @@
+#include "test.h"
+
+using std::string;
+
+void IncludeTest::Run()
+{
+ string projectFilename ( "tests/data/include.xml" );
+ Project project ( projectFilename );
+ ARE_EQUAL(1, project.includes.size());
+ Include& include1 = *project.includes[0];
+ ARE_EQUAL("include1", include1.directory);
+
+ ARE_EQUAL(1, project.modules.size());
+ Module& module1 = *project.modules[0];
+
+ ARE_EQUAL(1, module1.includes.size());
+ Include& include2 = *module1.includes[0];
+ ARE_EQUAL("include2", include2.directory);
+}