* Run build tools after parsing build files
* Generate roscfg.h
Modified: branches/xmlbuildsystem/reactos/drivers/net/tcpip/tcpip/main.c
Modified: branches/xmlbuildsystem/reactos/lib/kernel32/misc/dllmain.c
Modified: branches/xmlbuildsystem/reactos/subsys/win32k/main/dllmain.c
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h
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/module.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
Property changes on: branches/xmlbuildsystem/reactos
___________________________________________________________________
Name: svn:ignore
   - dist
reactos
*.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.zip
*.iso
*.cab
doxy-doc
   + *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.zip
*.iso
*.cab
doxy-doc

Modified: branches/xmlbuildsystem/reactos/drivers/net/tcpip/tcpip/main.c
--- branches/xmlbuildsystem/reactos/drivers/net/tcpip/tcpip/main.c	2005-02-11 17:04:30 UTC (rev 13495)
+++ branches/xmlbuildsystem/reactos/drivers/net/tcpip/tcpip/main.c	2005-02-11 19:13:01 UTC (rev 13496)
@@ -862,8 +862,6 @@
   DueTime.QuadPart = -(LONGLONG)IP_TIMEOUT * 10000;
   KeSetTimerEx(&IPTimer, DueTime, IP_TIMEOUT, &IPTimeoutDpc);
 
-  PREPARE_TESTS
-
   return STATUS_SUCCESS;
 }
 
Property changes on: branches/xmlbuildsystem/reactos/lib/gdi32/misc
___________________________________________________________________
Name: svn:ignore
   - win32k.c
*.o
.*.d
   + *.o
.*.d

Modified: branches/xmlbuildsystem/reactos/lib/kernel32/misc/dllmain.c
--- branches/xmlbuildsystem/reactos/lib/kernel32/misc/dllmain.c	2005-02-11 17:04:30 UTC (rev 13495)
+++ branches/xmlbuildsystem/reactos/lib/kernel32/misc/dllmain.c	2005-02-11 19:13:01 UTC (rev 13496)
@@ -176,8 +176,6 @@
 	break;
     }
 
-   PREPARE_TESTS
-
    return TRUE;
 }
 
Property changes on: branches/xmlbuildsystem/reactos/lib/ntdll
___________________________________________________________________
Name: svn:ignore
   - temp.exp
napi.asm
napi.c
*.tmp
*.lib
*.sym
*.coff
*.dll
*.o
*.a
*.map
doxy-doc
   + temp.exp
*.tmp
*.lib
*.sym
*.coff
*.dll
*.o
*.a
*.map
doxy-doc
Property changes on: branches/xmlbuildsystem/reactos/lib/user32/misc
___________________________________________________________________
Name: svn:ignore
   - win32k.c
*.d
*.a
*.o
*.sym
   + *.d
*.a
*.o
*.sym
Property changes on: branches/xmlbuildsystem/reactos/ntoskrnl/nt
___________________________________________________________________
Name: svn:ignore
   - *.d
*.o
zw.c
   + *.d
*.o
Property changes on: branches/xmlbuildsystem/reactos/subsys/win32k/main
___________________________________________________________________
Name: svn:ignore
   - svctab.c
*.d
*.o
*.sym
   + *.d
*.o
*.sym

Modified: branches/xmlbuildsystem/reactos/subsys/win32k/main/dllmain.c
--- branches/xmlbuildsystem/reactos/subsys/win32k/main/dllmain.c	2005-02-11 17:04:30 UTC (rev 13495)
+++ branches/xmlbuildsystem/reactos/subsys/win32k/main/dllmain.c	2005-02-11 19:13:01 UTC (rev 13496)
@@ -330,8 +330,6 @@
   CreateStockObjects();
   CreateSysColorObjects();
   
-  PREPARE_TESTS
-
   return STATUS_SUCCESS;
 }
 

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-02-11 17:04:30 UTC (rev 13495)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-02-11 19:13:01 UTC (rev 13496)
@@ -30,6 +30,7 @@
 	GenerateHeader ();
 	GenerateGlobalVariables ();
 	GenerateAllTarget ();
+	GenerateInitTarget ();
 	for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
 	{
 		Module& module = *ProjectNode.modules[i];
@@ -167,6 +168,7 @@
 	fprintf ( fMakefile, "host_ar = ar\n" );
 	fprintf ( fMakefile, "host_objcopy = objcopy\n" );
 #ifdef WIN32
+	fprintf ( fMakefile, "nmkdir = mkdir\n" );
 	fprintf ( fMakefile, "rm = del /f /q\n" );
 	fprintf ( fMakefile, "gcc = gcc\n" );
 	fprintf ( fMakefile, "gpp = g++\n" );
@@ -176,6 +178,7 @@
 	fprintf ( fMakefile, "dlltool = dlltool\n" );
 	fprintf ( fMakefile, "windres = windres\n" );
 #else
+	fprintf ( fMakefile, "nmkdir = mkdir -p\n" );
 	fprintf ( fMakefile, "rm = rm -f\n" );
 	fprintf ( fMakefile, "gcc = mingw32-gcc\n" );
 	fprintf ( fMakefile, "gpp = mingw32-g++\n" );
@@ -235,7 +238,54 @@
 	fprintf ( fMakefile, "\n\t\n\n" );
 }
 
+string
+MingwBackend::GetBuildToolDependencies () const
+{
+	string dependencies;
+	for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
+	{
+		Module& module = *ProjectNode.modules[i];
+		if ( module.type == BuildTool )
+		{
+			if ( dependencies.length () > 0 )
+				dependencies += " ";
+			dependencies += module.GetDependencyPath ();
+		}
+	}
+	return dependencies;
+}
+	
 void
+MingwBackend::GenerateInitTarget () const
+{
+	fprintf ( fMakefile,
+	          "init:");
+	fprintf ( fMakefile,
+	          " $(ROS_INTERMEDIATE)." SSEP "tools" );
+	fprintf ( fMakefile,
+	          " %s",
+	          GetBuildToolDependencies ().c_str () );
+	fprintf ( fMakefile,
+	          " %s",
+	          "include" SSEP "reactos" SSEP "buildno.h" );
+	fprintf ( fMakefile,
+	          "\n\t\n\n" );
+
+	fprintf ( fMakefile,
+	          "$(ROS_INTERMEDIATE)." SSEP "tools:\n" );
+	fprintf ( fMakefile,
+	          "ifneq ($(ROS_INTERMEDIATE),)\n" );
+	fprintf ( fMakefile,
+	          "\t${nmkdir} $(ROS_INTERMEDIATE)\n" );
+	fprintf ( fMakefile,
+	          "endif\n" );
+	fprintf ( fMakefile,
+	          "\t${nmkdir} $(ROS_INTERMEDIATE)." SSEP "tools\n" );
+	fprintf ( fMakefile,
+	          "\n" );
+}
+
+void
 MingwBackend::CheckAutomaticDependencies ()
 {
 	AutomaticDependency automaticDependency ( ProjectNode );

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h	2005-02-11 17:04:30 UTC (rev 13495)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h	2005-02-11 19:13:01 UTC (rev 13496)
@@ -28,6 +28,8 @@
 	void GenerateGlobalVariables () const;
 	bool IncludeInAllTarget ( const Module& module ) const;
 	void GenerateAllTarget () const;
+	std::string GetBuildToolDependencies () const;
+	void GenerateInitTarget () const;
 	void CheckAutomaticDependencies ();
 	FILE* fMakefile;
 };

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-02-11 17:04:30 UTC (rev 13495)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-02-11 19:13:01 UTC (rev 13496)
@@ -257,6 +257,15 @@
 	return objectFilenames;
 }
 
+bool
+MingwModuleHandler::IncludeDirectoryTarget ( const string& directory ) const
+{
+	if ( directory == "$(ROS_INTERMEDIATE)." SSEP "tools")
+		return false;
+	else
+		return true;
+}
+
 void
 MingwModuleHandler::GenerateDirectoryTargets () const
 {
@@ -270,7 +279,12 @@
 	      i != directory_set.end ();
 	      i++ )
 	{
-		fprintf ( fMakefile, " %s", i->c_str () );
+		if ( IncludeDirectoryTarget ( *i ) )
+		{
+			fprintf ( fMakefile,
+			          " %s",
+			          i->c_str () );
+		}
 	}
 
 	fprintf ( fMakefile, "\n\n" );
@@ -279,7 +293,12 @@
 	      i != directory_set.end ();
 	      i++ )
 	{
-		fprintf ( fMakefile, "%s ", i->c_str () );
+		if ( IncludeDirectoryTarget ( *i ) )
+		{
+			fprintf ( fMakefile,
+			          "%s ",
+			          i->c_str () );
+		}
 	}
 
 	fprintf ( fMakefile, 
@@ -1069,40 +1088,6 @@
 	return dependencies;
 }
 
-string
-MingwModuleHandler::GetInvocationParameters ( const Invoke& invoke ) const
-{
-	string parameters ( "" );
-	size_t i;
-	for (i = 0; i < invoke.output.size (); i++)
-	{
-		if (parameters.length () > 0)
-			parameters += " ";
-		InvokeFile& invokeFile = *invoke.output[i];
-		if (invokeFile.switches.length () > 0)
-		{
-			parameters += invokeFile.switches;
-			parameters += " ";
-		}
-		parameters += invokeFile.name;
-	}
-
-	for (i = 0; i < invoke.input.size (); i++)
-	{
-		if (parameters.length () > 0)
-			parameters += " ";
-		InvokeFile& invokeFile = *invoke.input[i];
-		if (invokeFile.switches.length () > 0)
-		{
-			parameters += invokeFile.switches;
-			parameters += " ";
-		}
-		parameters += invokeFile.name ;
-	}
-
-	return parameters;
-}
-
 void
 MingwModuleHandler::GenerateInvocations ( const Module& module ) const
 {
@@ -1134,7 +1119,7 @@
 		fprintf ( fMakefile,
 		          "\t%s %s\n\n",
 		          FixupTargetFilename ( invoke.invokeModule->GetPath () ).c_str (),
-		          GetInvocationParameters ( invoke ).c_str () );
+		          invoke.GetParameters ().c_str () );
 	}
 }
 
@@ -1145,19 +1130,37 @@
 	                  module.name.c_str () );
 }
 
+string
+MingwModuleHandler::GetDefaultDependencies ( const Module& module ) const
+{
+	/* Avoid circular dependency */
+	if ( module.type == BuildTool || module.name == "zlib" )
+		return "$(ROS_INTERMEDIATE)." SSEP "tools $(ROS_INTERMEDIATE)." SSEP "lib" SSEP "zlib";
+	else
+		return "init";
+}
+
 void
 MingwModuleHandler::GeneratePreconditionDependencies ( const Module& module ) const
 {
 	string preconditionDependenciesName = GetPreconditionDependenciesName ( module );
 	string sourceFilenames = GetSourceFilenamesWithoutGeneratedFiles ( module );
-	string dependencies = GetModuleDependencies ( module );
-	string s = GetInvocationDependencies ( module );
+	string dependencies = GetDefaultDependencies ( module );
+	string s = GetModuleDependencies ( module );
 	if ( s.length () > 0 )
 	{
 		if ( dependencies.length () > 0 )
 			dependencies += " ";
 		dependencies += s;
 	}
+
+	s = GetInvocationDependencies ( module );
+	if ( s.length () > 0 )
+	{
+		if ( dependencies.length () > 0 )
+			dependencies += " ";
+		dependencies += s;
+	}
 	
 	fprintf ( fMakefile,
 	          ".PHONY: %s\n\n",
@@ -1223,6 +1226,9 @@
 MingwModuleHandler::GetDefinitionDependencies ( const Module& module ) const
 {
 	string dependencies;
+	string dkNkmLibNoFixup = "dk/nkm/lib";
+	dependencies += FixupTargetFilename ( dkNkmLibNoFixup );
+	PassThruCacheDirectory ( dkNkmLibNoFixup + SSEP );
 	for ( size_t i = 0; i < module.files.size (); i++ )
 	{
 		File& file = *module.files[i];

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-02-11 17:04:30 UTC (rev 13495)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-02-11 19:13:01 UTC (rev 13496)
@@ -21,6 +21,7 @@
 	static MingwModuleHandler* LookupHandler ( const std::string& location,
 	                                           ModuleType moduletype_ );
 	virtual void Process ( const Module& module ) = 0;
+	bool IncludeDirectoryTarget ( const std::string& directory ) const;
 	void GenerateDirectoryTargets () const;
 	static std::string GetObjectFilename ( const std::string& sourceFilename );
 protected:
@@ -46,7 +47,6 @@
 	                                      const std::string* cflags,
 	                                      const std::string* nasmflags ) const;
 	std::string GetInvocationDependencies ( const Module& module ) const;
-	std::string GetInvocationParameters ( const Invoke& invoke ) const;
 	void GenerateInvocations ( const Module& module ) const;
 	
 	std::string GetPreconditionDependenciesName ( const Module& module ) const;
@@ -149,6 +149,7 @@
 	                                const std::string* clags,
 	                                const std::string* nasmflags ) const;
 	std::string GetSpecObjectDependencies ( const std::string& filename ) const;
+	std::string GetDefaultDependencies ( const Module& module ) const;
 };
 
 

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp	2005-02-11 17:04:30 UTC (rev 13495)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp	2005-02-11 19:13:01 UTC (rev 13496)
@@ -33,6 +33,12 @@
 }
 
 
+OutOfMemoryException::OutOfMemoryException ()
+	: Exception ( "Out of memory" )
+{
+}
+
+
 InvalidOperationException::InvalidOperationException ( const char* filename,
 	                                                   const int linenumber )
 {
@@ -147,6 +153,7 @@
 {
 }
 
+
 UnknownModuleTypeException::UnknownModuleTypeException ( const string& location,
                                                          int moduletype )
 	: InvalidBuildFileException ( location,
@@ -154,3 +161,14 @@
 	                              moduletype )
 {
 }
+
+
+InvocationFailedException::InvocationFailedException ( const std::string& command,
+                                                       int exitcode )
+	: Exception ( "Failed to execute '%s' (exit code %d)",
+	              command.c_str (),
+	              exitcode )
+{
+	Command = command;
+	ExitCode = exitcode;
+}

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/exception.h	2005-02-11 17:04:30 UTC (rev 13495)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.h	2005-02-11 19:13:01 UTC (rev 13496)
@@ -29,6 +29,13 @@
 };
 
 
+class OutOfMemoryException : public Exception
+{
+public:
+	OutOfMemoryException ();
+};
+
+
 class FileNotFoundException : public Exception
 {
 public:
@@ -105,4 +112,14 @@
 	                             int moduletype );
 };
 
+
+class InvocationFailedException : public Exception
+{
+public:
+	InvocationFailedException ( const std::string& command,
+	                            int exitcode );
+	std::string Command;
+	int ExitCode;
+};
+
 #endif /* __EXCEPTION_H */

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-02-11 17:04:30 UTC (rev 13495)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-02-11 19:13:01 UTC (rev 13496)
@@ -451,7 +451,22 @@
 	return false;
 }
 
+void
+Module::InvokeModule () const
+{
+	for ( size_t i = 0; i < invocations.size (); i++ )
+	{
+		Invoke& invoke = *invocations[i];
+		string command = invoke.invokeModule->GetPath () + " " + invoke.GetParameters ();
+		printf ( "Executing '%s'\n\n", command.c_str () );
+		int exitcode = system ( command.c_str () );
+		if ( exitcode != 0 )
+			throw InvocationFailedException ( command,
+			                                  exitcode );
+	}
+}
 
+
 File::File ( const string& _name, bool _first )
 	: name(_name), first(_first)
 {
@@ -581,7 +596,41 @@
 	return targets;
 }
 
+string
+Invoke::GetParameters () const
+{
+	string parameters ( "" );
+	size_t i;
+	for ( i = 0; i < output.size (); i++ )
+	{
+		if ( parameters.length () > 0)
+			parameters += " ";
+		InvokeFile& invokeFile = *output[i];
+		if ( invokeFile.switches.length () > 0 )
+		{
+			parameters += invokeFile.switches;
+			parameters += " ";
+		}
+		parameters += invokeFile.name;
+	}
 
+	for ( i = 0; i < input.size (); i++ )
+	{
+		if ( parameters.length () > 0 )
+			parameters += " ";
+		InvokeFile& invokeFile = *input[i];
+		if ( invokeFile.switches.length () > 0 )
+		{
+			parameters += invokeFile.switches;
+			parameters += " ";
+		}
+		parameters += invokeFile.name ;
+	}
+
+	return parameters;
+}
+
+
 InvokeFile::InvokeFile ( const XMLElement& _node,
                          const string& _name )
 	: node (_node),

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp	2005-02-11 17:04:30 UTC (rev 13495)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp	2005-02-11 19:13:01 UTC (rev 13496)
@@ -7,15 +7,10 @@
 using std::string;
 using std::vector;
 
-/*Project::Project()
-	: node(NULL), head(NULL)
-{
-}*/
-
 Project::Project ( const string& filename )
-	: xmlfile(filename),
-	  node(NULL),
-	  head(NULL)
+	: xmlfile (filename),
+	  node (NULL),
+	  head (NULL)
 {
 	ReadXml();
 }
@@ -25,26 +20,170 @@
 	size_t i;
 	for ( i = 0; i < modules.size (); i++ )
 		delete modules[i];
-	for ( i = 0; i < includes.size(); i++ )
+	for ( i = 0; i < includes.size (); i++ )
 		delete includes[i];
-	for ( i = 0; i < defines.size(); i++ )
+	for ( i = 0; i < defines.size (); i++ )
 		delete defines[i];
-	for ( i = 0; i < linkerFlags.size(); i++ )
+	for ( i = 0; i < linkerFlags.size (); i++ )
 		delete linkerFlags[i];
-	for ( i = 0; i < properties.size(); i++ )
+	for ( i = 0; i < properties.size (); i++ )
 		delete properties[i];
-	for ( i = 0; i < ifs.size(); i++ )
+	for ( i = 0; i < ifs.size (); i++ )
 		delete ifs[i];
 	delete head;
 }
 
+const Property*
+Project::LookupProperty ( const string& name ) const
+{
+	for ( size_t i = 0; i < properties.size (); i++ )
+	{
+		const Property* property = properties[i];
+		if ( property->name == name )
+			return property;
+	}
+	return NULL;
+}
+
 void
-Project::ReadXml()
+Project::WriteIfChanged ( char* outbuf,
+	                      string filename )
 {
+	FILE* out;
+	unsigned int end;
+	char* cmpbuf;
+	unsigned int stat;
+	
+	out = fopen ( filename.c_str (), "rb" );
+	if ( out == NULL )
+	{
+		out = fopen ( filename.c_str (), "wb" );
+		if ( out == NULL )
+			throw AccessDeniedException ( filename );
+		fputs ( outbuf, out );
+		fclose ( out );
+		return;
+	}
+	
+	fseek ( out, 0, SEEK_END );
+	end = ftell ( out );
+	cmpbuf = (char*) malloc ( end );
+	if ( cmpbuf == NULL )
+	{
+		fclose ( out );
+		throw OutOfMemoryException ();
+	}
+	
+	fseek ( out, 0, SEEK_SET );
+	stat = fread ( cmpbuf, 1, end, out );
+	if ( stat != end )
+	{
+		free ( cmpbuf );
+		fclose ( out );
+		throw AccessDeniedException ( filename );
+	}
+	if ( end == strlen ( outbuf ) && memcmp ( cmpbuf, outbuf, end ) == 0 )
+	{
+		free ( cmpbuf );
+		fclose ( out );
+		return;
+	}
+	
+	free ( cmpbuf );
+	fclose ( out );
+	out = fopen ( filename.c_str (), "wb" );
+	if ( out == NULL )
+	{
+		throw AccessDeniedException ( filename );
+	}
+	
+	stat = fwrite ( outbuf, 1, strlen ( outbuf ), out);
+	if ( strlen ( outbuf ) != stat )
+	{
+		fclose ( out );
+		throw AccessDeniedException ( filename );
+	}
+
+	fclose ( out );
+}
+
+void
+Project::SetConfigurationOption ( char* s,
+	                              string name,
+	                              string* alternativeName )
+{
+	const Property* property = LookupProperty ( name );
+	if ( property != NULL && property->value.length () > 0 )
+	{
+		s = s + sprintf ( s,
+		                  "#define %s=%s\n",
+		                  property->name.c_str (),
+		                  property->value.c_str () );
+	}
+	else if ( property != NULL )
+	{
+		s = s + sprintf ( s,
+		                  "#define %s\n",
+		                  property->name.c_str () );
+	}
+	else if ( alternativeName != NULL )
+	{
+		s = s + sprintf ( s,
+		                  "#define %s\n",
+		                  alternativeName->c_str () );
+	}
+}
+
+void
+Project::SetConfigurationOption ( char* s,
+	                              string name )
+{
+	SetConfigurationOption ( s, name, NULL );
+}
+
+void
+Project::WriteConfigurationFile ()
+{
+	char* buf;
+	char* s;
+
+	buf = (char*) malloc ( 10*1024 );
+	if ( buf == NULL )
+		throw OutOfMemoryException ();
+	
+	s = buf;
+	s = s + sprintf ( s, "/* Automatically generated. " );
+	s = s + sprintf ( s, "Edit config.xml to change configuration */\n" );
+	s = s + sprintf ( s, "#ifndef __INCLUDE_CONFIG_H\n" );
+	s = s + sprintf ( s, "#define __INCLUDE_CONFIG_H\n" );
+
+	SetConfigurationOption ( s, "ARCH" );
+	SetConfigurationOption ( s, "OPTIMIZED" );
+	SetConfigurationOption ( s, "MP", new string ( "UP" ) );
+	SetConfigurationOption ( s, "ACPI" );
+	SetConfigurationOption ( s, "_3GB" );
+
+	s = s + sprintf ( s, "#endif /* __INCLUDE_CONFIG_H */\n" );
+
+	WriteIfChanged ( buf, "include" SSEP "roscfg.h" );
+
+	free ( buf );
+}
+
+void
+Project::ExecuteInvocations ()
+{
+	for ( size_t i = 0; i < modules.size (); i++ )
+		modules[i]->InvokeModule ();
+}
+
+void
+Project::ReadXml ()
+{
 	Path path;
 	head = XMLLoadFile ( xmlfile, path );
 	node = NULL;
-	for ( size_t i = 0; i < head->subElements.size(); i++ )
+	for ( size_t i = 0; i < head->subElements.size (); i++ )
 	{
 		if ( head->subElements[i]->name == "project" )
 		{
@@ -189,7 +328,7 @@
 {
 	for ( size_t i = 0; i < modules.size (); i++ )
 	{
-		if (modules[i]->name == name)
+		if ( modules[i]->name == name )
 			return modules[i];
 	}
 

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp	2005-02-11 17:04:30 UTC (rev 13495)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp	2005-02-11 19:13:01 UTC (rev 13496)
@@ -30,6 +30,8 @@
 	{
 		string projectFilename ( "ReactOS.xml" );
 		Project project ( projectFilename );
+		project.WriteConfigurationFile ();
+		project.ExecuteInvocations ();
 		Backend* backend = Backend::Factory::Create ( buildtarget,
 		                                              project );
 		backend->Process ();

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-02-11 17:04:30 UTC (rev 13495)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-02-11 19:13:01 UTC (rev 13496)
@@ -13,6 +13,7 @@
 #include <sys/utime.h>
 #else
 #include <utime.h>
+#include <process.h>
 #endif
 
 #include "ssprintf.h"
@@ -67,10 +68,20 @@
 
 	Project ( const std::string& filename );
 	~Project ();
+	void WriteConfigurationFile ();
+	void ExecuteInvocations ();
 	void ProcessXML ( const std::string& path );
 	Module* LocateModule ( const std::string& name );
 	const Module* LocateModule ( const std::string& name ) const;
 private:
+	const Property* LookupProperty ( const std::string& name ) const;
+	void SetConfigurationOption ( char* s,
+	                              std::string name,
+	                              std::string* alternativeName );
+	void SetConfigurationOption ( char* s,
+	                              std::string name );
+	void WriteIfChanged ( char* outbuf,
+	                      std::string filename );
 	void ReadXml ();
 	void ProcessXMLSubElement ( const XMLElement& e,
 	                            const std::string& path,
@@ -139,7 +150,8 @@
 	std::string GetInvocationTarget ( const int index ) const;
 	bool HasFileWithExtensions ( const std::string& extension1,
 	                             const std::string& extension2 ) const;
-	void ProcessXML();
+	void InvokeModule () const;
+	void ProcessXML ();
 private:
 	std::string GetDefaultModuleExtension () const;
 	std::string GetDefaultModuleEntrypoint () const;
@@ -232,6 +244,7 @@
 
 	void ProcessXML();
 	std::string GetTargets () const;
+	std::string GetParameters () const;
 private:
 	void ProcessXMLSubElement ( const XMLElement& e );
 	void ProcessXMLSubElementInput ( const XMLElement& e );