Static library module type.
Modified: branches/xmlbuildsystem/reactos/ReactOS.xml
Modified: branches/xmlbuildsystem/reactos/lib/kjs/module.xml
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/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/exception.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.h
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/include.cpp
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/ReactOS.xml
--- branches/xmlbuildsystem/reactos/ReactOS.xml	2005-01-07 21:46:18 UTC (rev 12876)
+++ branches/xmlbuildsystem/reactos/ReactOS.xml	2005-01-08 00:25:48 UTC (rev 12877)
@@ -1,7 +1,7 @@
 <project name="ReactOS" makefile="Makefile.auto">
 	<define name="_M_IX86"></define>
-	<include>./include</include>
-	<include>./w32api/include</include>
+	<include>include</include>
+	<include>w32api/include</include>
 	<directory name="tools">
 		<module name="depends" type="buildtool">
 			<file>depends.c</file>

Modified: branches/xmlbuildsystem/reactos/lib/kjs/module.xml
--- branches/xmlbuildsystem/reactos/lib/kjs/module.xml	2005-01-07 21:46:18 UTC (rev 12876)
+++ branches/xmlbuildsystem/reactos/lib/kjs/module.xml	2005-01-08 00:25:48 UTC (rev 12877)
@@ -1,7 +1,7 @@
 <module name="kjs" type="staticlibrary">
 	<include>.</include>
-	<include>./src</include>
-	<include>./include</include>
+	<include>src</include>
+	<include>include</include>
 	<directory name="ksrc">
 		<file>setjmp.S</file>
 		<file>longjmp.S</file>
@@ -24,7 +24,6 @@
 		<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>

Modified: branches/xmlbuildsystem/reactos/ntoskrnl/module.xml
--- branches/xmlbuildsystem/reactos/ntoskrnl/module.xml	2005-01-07 21:46:18 UTC (rev 12876)
+++ branches/xmlbuildsystem/reactos/ntoskrnl/module.xml	2005-01-08 00:25:48 UTC (rev 12877)
@@ -1,8 +1,8 @@
-<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>
+<module name="ntoskrnl" type="kernelmodedll" extension=".exe">
+	<define name="_SEH_NO_NATIVE_NLG" />
+	<define name="_DISABLE_TIDENTS" />
+	<define name="__NTOSKRNL__" />
+	<define name="__3GB__" />
 	<include>.</include>
 	<include>./include</include>
 	<include>../lib/kjs/include</include>
@@ -44,12 +44,14 @@
 			</group>
 		</if>
 		<or>
+			<!--
 			<if property="kdbg" value="true">
 				<group>
 					<file>kdb_stabs.c</file>
 					<file>kdb_symbols.c</file>
 				</group>
 			</if>
+			-->
 			<if property="dbg" value="true">
 				<group>
 					<file>kdb_stabs.c</file>

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-01-07 21:46:18 UTC (rev 12876)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-01-08 00:25:48 UTC (rev 12877)
@@ -103,4 +103,5 @@
 MingwBackend::GetModuleHandlers ( MingwModuleHandlerList& moduleHandlers )
 {
 	moduleHandlers.push_back ( new MingwKernelModuleHandler ( fMakefile ) );
+	moduleHandlers.push_back ( new MingwStaticLibraryModuleHandler ( fMakefile ) );
 }

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-01-07 21:46:18 UTC (rev 12876)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-01-08 00:25:48 UTC (rev 12877)
@@ -128,8 +128,21 @@
 }
 
 string
-MingwModuleHandler::GenerateGccIncludeParametersFromVector ( vector<Include*> includes )
+MingwModuleHandler::ConcatenatePaths ( string path1,
+	                                   string path2 )
 {
+	if ( ( path1.length () == 0 ) || ( path1 == "." ) || ( path1 == "./" ) )
+		return path2;
+	if ( path1[path1.length ()] == CSEP )
+		return path1 + path2;
+	else
+		return path1 + CSEP + path2;
+}
+
+string
+MingwModuleHandler::GenerateGccIncludeParametersFromVector ( string basePath,
+	                                                         vector<Include*> includes )
+{
 	string parameters;
 	for (size_t i = 0; i < includes.size (); i++)
 	{
@@ -137,7 +150,8 @@
 		if (parameters.length () > 0)
 			parameters += " ";
 		parameters += "-I";
-		parameters += include.directory;
+		parameters += ConcatenatePaths ( basePath,
+		                                 include.directory );
 	}
 	return parameters;
 }
@@ -145,8 +159,10 @@
 string
 MingwModuleHandler::GenerateGccIncludeParameters ( Module& module )
 {
-	string parameters = GenerateGccIncludeParametersFromVector ( module.project->includes );
-	string s = GenerateGccIncludeParametersFromVector ( module.includes );
+	string parameters = GenerateGccIncludeParametersFromVector ( ".",
+	                                                             module.project->includes );
+	string s = GenerateGccIncludeParametersFromVector ( module.path,
+	                                                    module.includes );
 	if (s.length () > 0)
 	{
 		parameters += " ";
@@ -202,7 +218,7 @@
 	fprintf ( fMakefile,
 	          "%s: %s\n",
 	          archiveFilename.c_str (),
-	          sourceFilenames.c_str ());
+	          objectFilenames.c_str ());
 
 	fprintf ( fMakefile,
 	         "\t${ar} -rc %s %s\n\n",
@@ -219,7 +235,7 @@
 bool
 MingwKernelModuleHandler::CanHandleModule ( Module& module )
 {
-	return true;
+	return module.type == KernelModeDLL;
 }
 
 void
@@ -268,3 +284,28 @@
 	GenerateArchiveTarget ( module );
 	GenerateObjectFileTargets ( module );
 }
+
+
+MingwStaticLibraryModuleHandler::MingwStaticLibraryModuleHandler ( FILE* fMakefile )
+	: MingwModuleHandler ( fMakefile )
+{
+}
+
+bool
+MingwStaticLibraryModuleHandler::CanHandleModule ( Module& module )
+{
+	return module.type == StaticLibrary;
+}
+
+void
+MingwStaticLibraryModuleHandler::Process ( Module& module )
+{
+	GenerateStaticLibraryModuleTarget ( module );
+}
+
+void
+MingwStaticLibraryModuleHandler::GenerateStaticLibraryModuleTarget ( Module& module )
+{
+	GenerateArchiveTarget ( module );
+	GenerateObjectFileTargets ( module );
+}

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-01-07 21:46:18 UTC (rev 12876)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-01-08 00:25:48 UTC (rev 12877)
@@ -22,9 +22,12 @@
 	void GenerateArchiveTarget ( Module& module );
 	FILE* fMakefile;
 private:
+	std::string ConcatenatePaths ( std::string path1,
+	                               std::string path2 );
 	std::string GenerateGccDefineParametersFromVector ( std::vector<Define*> defines );
 	std::string GenerateGccDefineParameters ( Module& module );
-	std::string GenerateGccIncludeParametersFromVector ( std::vector<Include*> includes );
+	std::string GenerateGccIncludeParametersFromVector ( std::string basePath,
+	                                                     std::vector<Include*> includes );
 	std::string GenerateGccIncludeParameters ( Module& module );
 	std::string GenerateGccParameters ( Module& module );
 };
@@ -40,4 +43,15 @@
 	void GenerateKernelModuleTarget ( Module& module );
 };
 
+
+class MingwStaticLibraryModuleHandler : public MingwModuleHandler
+{
+public:
+	MingwStaticLibraryModuleHandler ( FILE* fMakefile );
+	virtual bool CanHandleModule ( Module& module );
+	virtual void Process ( Module& module );
+private:
+	void GenerateStaticLibraryModuleTarget ( Module& module );
+};
+
 #endif /* MINGW_MODULEHANDLER_H */

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp	2005-01-07 21:46:18 UTC (rev 12876)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp	2005-01-08 00:25:48 UTC (rev 12877)
@@ -5,58 +5,71 @@
 
 using std::string;
 
-Exception::Exception()
+Exception::Exception ()
 {
 }
 
-Exception::Exception(const string& message)
+Exception::Exception ( const string& message )
 {
 	Message = message;
 }
 
-Exception::Exception(const char* format,
-                     ...)
+Exception::Exception ( const char* format,
+                       ...)
 {
 	va_list args;
-	va_start(args,
-	         format);
-	Message = ssvprintf(format,
-	                    args);
-	va_end(args);
+	va_start ( args,
+	           format);
+	Message = ssvprintf ( format,
+	                      args);
+	va_end ( args );
 }
 
-void Exception::SetMessage(const char* message,
-                           va_list args)
+void Exception::SetMessage ( const char* message,
+                             va_list args)
 {
-	Message = ssvprintf(message,
-	                    args);
+	Message = ssvprintf ( message,
+	                      args);
 }
 
 
-FileNotFoundException::FileNotFoundException(const string& filename)
-	: Exception ( "File '%s' not found.", filename.c_str() )
+InvalidOperationException::InvalidOperationException ( const char* filename,
+	                                                   const int linenumber)
 {
+	Message = ssprintf ( "%s:%d",
+	                     filename,
+	                     linenumber );
+}
+
+
+FileNotFoundException::FileNotFoundException ( const string& filename )
+	: Exception ( "File '%s' not found.",
+	              filename.c_str() )
+{
 	Filename = filename;
 }
 
 
-AccessDeniedException::AccessDeniedException(const string& filename)
-	: Exception ( "Access denied to file '%s'.", filename.c_str() )
+AccessDeniedException::AccessDeniedException ( const string& filename)
+	: Exception ( "Access denied to file '%s'.",
+	             filename.c_str() )
 {
 	Filename = filename;
 }
 
 
-InvalidBuildFileException::InvalidBuildFileException(const char* message,
-                                                     ...)
+InvalidBuildFileException::InvalidBuildFileException ( const char* message,
+                                                       ...)
 {
 	va_list args;
-	va_start( args, message);
-	SetMessage(message, args);
-	va_end(args);
+	va_start ( args,
+	           message );
+	SetMessage ( message,
+	            args );
+	va_end ( args );
 }
 
-InvalidBuildFileException::InvalidBuildFileException()
+InvalidBuildFileException::InvalidBuildFileException ()
 {
 }
 
@@ -66,36 +79,39 @@
 	                                               ... )
 {
 	va_list args;
-	va_start ( args, message );
+	va_start ( args,
+	          message );
 	Message = location + ": " + ssvprintf ( message, args );
 	va_end ( args );
 }
 
 
-RequiredAttributeNotFoundException::RequiredAttributeNotFoundException(const string& attributeName,
-                                                                       const string& elementName)
+RequiredAttributeNotFoundException::RequiredAttributeNotFoundException ( const string& attributeName,
+                                                                         const string& elementName )
 	: InvalidBuildFileException ( "Required attribute '%s' not found on '%s'.",
 	                              attributeName.c_str (),
 	                              elementName.c_str ())
 {
 }
 
-InvalidAttributeValueException::InvalidAttributeValueException(const string& name,
-	                                                           const string& value)
+InvalidAttributeValueException::InvalidAttributeValueException ( const string& name,
+	                                                             const string& value )
 	: InvalidBuildFileException ( "Attribute '%s' has an invalid value '%s'.",
 	                              name.c_str (),
-	                              value.c_str ())
+	                              value.c_str () )
 {
 	
 }
 
 BackendNameConflictException::BackendNameConflictException ( const string& name )
-	: Exception ( "Backend name conflict: '%s'", name.c_str() )
+	: Exception ( "Backend name conflict: '%s'",
+	             name.c_str() )
 {
 }
 
 
 UnknownBackendException::UnknownBackendException ( const string& name )
-	: Exception ( "Unknown Backend requested: '%s'", name.c_str() )
+	: Exception ( "Unknown Backend requested: '%s'",
+	             name.c_str() )
 {
 }

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/exception.h	2005-01-07 21:46:18 UTC (rev 12876)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.h	2005-01-08 00:25:48 UTC (rev 12877)
@@ -6,21 +6,29 @@
 class Exception
 {
 public:
-	Exception(const std::string& message);
-	Exception(const char* format,
-	          ...);
+	Exception ( const std::string& message );
+	Exception ( const char* format,
+	            ...);
 	std::string Message;
 protected:
-	Exception();
-	void SetMessage(const char* message,
-	                va_list args);
+	Exception ();
+	void SetMessage ( const char* message,
+	                  va_list args);
 };
 
 
+class InvalidOperationException : public Exception
+{
+public:
+	InvalidOperationException ( const char* filename,
+	                            const int linenumber);
+};
+
+
 class FileNotFoundException : public Exception
 {
 public:
-	FileNotFoundException(const std::string& filename);
+	FileNotFoundException ( const std::string& filename );
 	std::string Filename;
 };
 
@@ -28,7 +36,7 @@
 class AccessDeniedException : public Exception
 {
 public:
-	AccessDeniedException(const std::string& filename);
+	AccessDeniedException ( const std::string& filename );
 	std::string Filename;
 };
 
@@ -39,7 +47,7 @@
 	InvalidBuildFileException ( const char* message,
 	                            ...);
 protected:
-	InvalidBuildFileException();
+	InvalidBuildFileException ();
 };
 
 
@@ -55,16 +63,16 @@
 class RequiredAttributeNotFoundException : public InvalidBuildFileException
 {
 public:
-	RequiredAttributeNotFoundException(const std::string& attributeName,
-	                                   const std::string& elementName);
+	RequiredAttributeNotFoundException ( const std::string& attributeName,
+	                                     const std::string& elementName );
 };
 
 
 class InvalidAttributeValueException : public InvalidBuildFileException
 {
 public:
-	InvalidAttributeValueException(const std::string& name,
-	                               const std::string& value);
+	InvalidAttributeValueException ( const std::string& name,
+	                                 const std::string& value );
 };
 
 

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/include.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/include.cpp	2005-01-07 21:46:18 UTC (rev 12876)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/include.cpp	2005-01-08 00:25:48 UTC (rev 12877)
@@ -30,7 +30,7 @@
 void
 Include::Initialize ( const XMLElement& includeNode )
 {
-	directory = includeNode.value;
+	directory = FixSeparator ( includeNode.value );
 }
 
 void

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-01-07 21:46:18 UTC (rev 12876)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-01-08 00:25:48 UTC (rev 12877)
@@ -23,14 +23,25 @@
 
 Module::Module ( Project* project,
                  const XMLElement& moduleNode,
-                 const string& moduleName,
                  const string& modulePath )
 	: project(project),
-	  node(moduleNode),
-	  name(moduleName),
-	  path(modulePath)
+	  node(moduleNode)
 {
-	type = GetModuleType ( *moduleNode.GetAttribute ( "type", true ) );
+  	path = FixSeparator ( modulePath );
+
+	const XMLAttribute* att = moduleNode.GetAttribute ( "name", true );
+	assert(att);
+	name = att->value;
+
+	att = moduleNode.GetAttribute ( "type", true );
+	assert(att);
+	type = GetModuleType ( *att );
+
+	att = moduleNode.GetAttribute ( "extension", false );
+	if (att != NULL)
+		extension = att->value;
+	else
+		extension = GetDefaultModuleExtension ();
 }
 
 Module::~Module ()
@@ -49,7 +60,7 @@
 	string subpath ( path );
 	if ( e.name == "file" && e.value.size () )
 	{
-		files.push_back ( new File ( path + CSEP + e.value ) );
+		files.push_back ( new File ( FixSeparator ( path + CSEP + e.value ) ) );
 	}
 	else if ( e.name == "library" && e.value.size () )
 	{
@@ -59,7 +70,7 @@
 	{
 		const XMLAttribute* att = e.GetAttribute ( "name", true );
 		assert(att);
-		subpath = path + CSEP + att->value;
+		subpath = FixSeparator ( path + CSEP + att->value );
 	}
 	else if ( e.name == "include" )
 	{
@@ -91,9 +102,25 @@
 }
 
 string
+Module::GetDefaultModuleExtension ()
+{
+	switch (type)
+	{
+		case BuildTool:
+			return EXEPOSTFIX;
+		case StaticLibrary:
+			return ".a";
+		case KernelModeDLL:
+			return ".dll";
+	}
+	throw InvalidOperationException (__FILE__,
+	                                 __LINE__);
+}
+
+string
 Module::GetPath ()
 {
-	return FixSeparator (path) + CSEP + name + EXEPOSTFIX;
+	return FixSeparator (path) + CSEP + name + extension;
 }
 
 

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp	2005-01-07 21:46:18 UTC (rev 12876)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp	2005-01-08 00:25:48 UTC (rev 12877)
@@ -59,9 +59,7 @@
 	}
 	else if ( e.name == "module" )
 	{
-		att = e.GetAttribute ( "name", true );
-		assert(att);
-		Module* module = new Module ( this, e, att->value, path );
+		Module* module = new Module ( this, e, path );
 		modules.push_back ( module );
 		module->ProcessXML ( e, path );
 		return;

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-01-07 21:46:18 UTC (rev 12876)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-01-08 00:25:48 UTC (rev 12877)
@@ -64,6 +64,7 @@
 	Project* project;
 	const XMLElement& node;
 	std::string name;
+	std::string extension;
 	std::string path;
 	ModuleType type;
 	std::vector<File*> files;
@@ -73,12 +74,13 @@
 
 	Module ( Project* project,
 	         const XMLElement& moduleNode,
-	         const std::string& moduleName,
 	         const std::string& modulePath );
 	~Module ();
 	ModuleType GetModuleType (const XMLAttribute& attribute );
 	std::string GetPath ();
 	void ProcessXML ( const XMLElement& e, const std::string& path );
+private:
+	std::string GetDefaultModuleExtension ();
 };