Generate reactos.cab
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/rbuild.h
Modified: branches/xmlbuildsystem/reactos/tools/rmkdir.c
Modified: branches/xmlbuildsystem/reactos/tools/tools.xml

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-02-08 22:11:27 UTC (rev 13469)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-02-08 22:21:16 UTC (rev 13470)
@@ -161,12 +161,12 @@
 void
 MingwBackend::GenerateGlobalVariables () const
 {
-#ifdef WIN32
 	fprintf ( fMakefile, "host_gcc = gcc\n" );
 	fprintf ( fMakefile, "host_gpp = g++\n" );
 	fprintf ( fMakefile, "host_ld = ld\n" );
 	fprintf ( fMakefile, "host_ar = ar\n" );
 	fprintf ( fMakefile, "host_objcopy = objcopy\n" );
+#ifdef WIN32
 	fprintf ( fMakefile, "rm = del /f /q\n" );
 	fprintf ( fMakefile, "gcc = gcc\n" );
 	fprintf ( fMakefile, "gpp = g++\n" );
@@ -176,11 +176,6 @@
 	fprintf ( fMakefile, "dlltool = dlltool\n" );
 	fprintf ( fMakefile, "windres = windres\n" );
 #else
-	fprintf ( fMakefile, "host_gcc = gcc\n" );
-	fprintf ( fMakefile, "host_gpp = g++\n" );
-	fprintf ( fMakefile, "host_ld = ld\n" );
-	fprintf ( fMakefile, "host_ar = ar\n" );
-	fprintf ( fMakefile, "host_objcopy = objcopy\n" );
 	fprintf ( fMakefile, "rm = rm -f\n" );
 	fprintf ( fMakefile, "gcc = mingw32-gcc\n" );
 	fprintf ( fMakefile, "gpp = mingw32-g++\n" );
@@ -190,12 +185,12 @@
 	fprintf ( fMakefile, "dlltool = mingw32-dlltool\n" );
 	fprintf ( fMakefile, "windres = mingw32-windres\n" );
 #endif
-	fprintf ( fMakefile, "mkdir = tools%crmkdir\n", CSEP );
+	fprintf ( fMakefile, "mkdir = tools" SSEP "rmkdir" EXEPOSTFIX "\n" );
 	fprintf ( fMakefile, "NUL=NUL\n" );
-	fprintf ( fMakefile, "winebuild = tools" SSEP "winebuild" SSEP "winebuild\n" );
-	fprintf ( fMakefile, "bin2res = tools" SSEP "bin2res" SSEP "bin2res\n" );
-	fprintf ( fMakefile, "cabman = tools" SSEP "cabman" SSEP "cabman\n" );
-	fprintf ( fMakefile, "cdmake = tools" SSEP "cdmake" SSEP "cdmake\n" );
+	fprintf ( fMakefile, "winebuild = tools" SSEP "winebuild" SSEP "winebuild" EXEPOSTFIX "\n" );
+	fprintf ( fMakefile, "bin2res = tools" SSEP "bin2res" SSEP "bin2res" EXEPOSTFIX "\n" );
+	fprintf ( fMakefile, "cabman = tools" SSEP "cabman" SSEP "cabman" EXEPOSTFIX "\n" );
+	fprintf ( fMakefile, "cdmake = tools" SSEP "cdmake" SSEP "cdmake" EXEPOSTFIX "\n" );
 	fprintf ( fMakefile, "\n" );
 	GenerateGlobalCFlagsAndProperties (
 		"=",

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-02-08 22:11:27 UTC (rev 13469)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-02-08 22:21:16 UTC (rev 13470)
@@ -53,10 +53,10 @@
 }
 
 const string &
-MingwModuleHandler::PassThruCacheDirectory( const string &file ) const 
+MingwModuleHandler::PassThruCacheDirectory ( const string &file ) const 
 {
-    directory_set.insert( ReplaceExtension( GetDirectory( file ), "" ) );
-    return file;
+	directory_set.insert ( GetDirectory ( file ) );
+	return file;
 }
 
 void
@@ -87,20 +87,10 @@
 }
 
 string
-MingwModuleHandler::GetDirectory ( const string& filename )
-{
-	size_t index = filename.find_last_of ( CSEP );
-	if (index == string::npos)
-		return ".";
-	else
-		return filename.substr ( 0, index );
-}
-
-string
 MingwModuleHandler::GetBasename ( const string& filename ) const
 {
 	size_t index = filename.find_last_of ( '.' );
-	if (index != string::npos)
+	if ( index != string::npos )
 		return filename.substr ( 0, index );
 	return "";
 }
@@ -111,7 +101,7 @@
 	string extension = GetExtension ( filename );
 	if ( extension == ".spec" || extension == "SPEC" )
 	{
-		string basename = GetBasename( filename );
+		string basename = GetBasename ( filename );
 		return basename + ".stubs.c";
 	}
 	else
@@ -187,7 +177,7 @@
 {
 	string dependencies = GetImportLibraryDependencies ( module );
 	string s = GetModuleDependencies ( module );
-	if (s.length () > 0)
+	if ( s.length () > 0 )
 	{
 		dependencies += " ";
 		dependencies += s;
@@ -208,13 +198,13 @@
 			sourceFilenames += " " + GetActualSourceFilename ( module.files[i]->name );
 	}
 	vector<If*> ifs = module.ifs;
-	for ( i = 0; i < ifs.size(); i++ )
+	for ( i = 0; i < ifs.size (); i++ )
 	{
 		size_t j;
 		If& rIf = *ifs[i];
-		for ( j = 0; j < rIf.ifs.size(); j++ )
+		for ( j = 0; j < rIf.ifs.size (); j++ )
 			ifs.push_back ( rIf.ifs[j] );
-		for ( j = 0; j < rIf.files.size(); j++ )
+		for ( j = 0; j < rIf.files.size (); j++ )
 		{
 			if ( includeGeneratedFiles || !IsGeneratedFile ( *rIf.files[j] ) )
 				sourceFilenames += " " + GetActualSourceFilename ( rIf.files[j]->name );
@@ -248,8 +238,7 @@
 		newExtension = ".stubs.o";
 	else
 		newExtension = ".o";
-	return FixupTargetFilename (
-			ReplaceExtension ( sourceFilename, newExtension ) );
+	return FixupTargetFilename ( ReplaceExtension ( sourceFilename, newExtension ) );
 }
 
 string
@@ -269,34 +258,34 @@
 }
 
 void
-MingwModuleHandler::GenerateDirectoryTargets() const 
+MingwModuleHandler::GenerateDirectoryTargets () const
 {
+	if ( directory_set.size () == 0 )
+		return;
+	
 	set_string::iterator i;
-	fprintf( fMakefile, "ifneq ($(ROS_INTERMEDIATE),)\ndirectories::" );
+	fprintf ( fMakefile, "directories::" );
 
-	for ( i = directory_set.begin();
-	      i != directory_set.end();
+	for ( i = directory_set.begin ();
+	      i != directory_set.end ();
 	      i++ )
 	{
-		fprintf ( fMakefile, " %s", i->c_str() );
+		fprintf ( fMakefile, " %s", i->c_str () );
 	}
 
-	fprintf( fMakefile, "\n\n" );
+	fprintf ( fMakefile, "\n\n" );
 
-	for ( i = directory_set.begin();
-	      i != directory_set.end();
+	for ( i = directory_set.begin ();
+	      i != directory_set.end ();
 	      i++ )
 	{
-		fprintf ( fMakefile, "%s ", i->c_str() );
+		fprintf ( fMakefile, "%s ", i->c_str () );
 	}
 
 	fprintf ( fMakefile, 
-	          "::\n\t${mkdir} $@\n\n"
-	          "else\n"
-	          "directories::\n\n"
-	          "endif\n\n" );
+	          "::\n\t${mkdir} $@\n\n" );
 
-	directory_set.clear();
+	directory_set.clear ();
 }
 
 string
@@ -351,7 +340,7 @@
 	for ( size_t i = 0; i < includes.size (); i++ )
 	{
 		Include& include = *includes[i];
-		if (parameters.length () > 0)
+		if ( parameters.length () > 0 )
 			parameters += " ";
 		parameters += "-I" + include.directory;
 	}
@@ -1264,6 +1253,8 @@
 bool
 MingwModuleHandler::IsCPlusPlusModule ( const Module& module ) const
 {
+	if ( module.HasFileWithExtensions ( ".cc", ".CC" ) )
+		return true;
 	if ( module.HasFileWithExtensions ( ".cxx", ".CXX" ) )
 		return true;
 	if ( module.HasFileWithExtensions ( ".cpp", ".CPP" ) )
@@ -1949,28 +1940,37 @@
 void
 MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module )
 {
-	string isoboot = "$(ROS_INTERMEDIATE)" + FixupTargetFilename ( "boot/freeldr/bootsect/isoboot.o" );
+	string bootcdDirectory = "cd";
+	string isoboot = FixupTargetFilename ( "boot/freeldr/bootsect/isoboot.o" );
+	string bootcdReactosNoFixup = bootcdDirectory + "/reactos";
+	string bootcdReactos = FixupTargetFilename ( bootcdReactosNoFixup );
+	PassThruCacheDirectory ( bootcdReactos + SSEP );
+	string reactosInf = FixupTargetFilename ( bootcdReactosNoFixup + "/reactos.inf" );
+	string reactosDff = NormalizeFilename ( "bootdata/packages/reactos.dff" );
 
 	fprintf ( fMakefile, ".PHONY: %s\n\n",
 		      module.name.c_str ());
 	fprintf ( fMakefile,
-	          "%s: all %s\n",
+	          "%s: all %s %s\n",
 	          module.name.c_str (),
-	          isoboot.c_str () );
+	          isoboot.c_str (),
+	          bootcdReactos.c_str () );
 	fprintf ( fMakefile,
-	          "\t${cabman} /C %s /L $(ROS_INTERMEDIATE)%s /I\n",
-	          FixupTargetFilename ( "bootdata/packages/reactos.dff" ).c_str (),
-	          FixupTargetFilename ( "bootcd/reactos" ).c_str () );
+	          "\t${cabman} /C %s /L %s /I\n",
+	          reactosDff.c_str (),
+	          bootcdReactos.c_str () );
 	fprintf ( fMakefile,
-	          "\t${cabman} /C %s /RC $(ROS_INTERMEDIATE)%s /L $(BOOTCD_DIR)reactos /N\n",
-	          FixupTargetFilename ( "bootdata/packages/reactos.dff" ).c_str (),
-	          FixupTargetFilename ( "bootcd/reactos/reactos.inf" ).c_str () );
+	          "\t${cabman} /C %s /RC %s /L %s /N\n",
+	          reactosDff.c_str (),
+	          reactosInf.c_str (),
+	          bootcdReactos.c_str () );
 	fprintf ( fMakefile,
-	          "\t- ${rm} $(ROS_INTERMEDIATE)%s\n",
-	          FixupTargetFilename ( "bootcd/reactos/reactos.inf" ).c_str () );
+	          "\t- ${rm} %s\n",
+	          reactosInf.c_str () );
 	fprintf ( fMakefile,
-	          "\t${cdmake} -v -m -b %s $(ROS_INTERMEDIATE)bootcd REACTOS ReactOS.iso\n",
-	          isoboot.c_str () );
+	          "\t${cdmake} -v -m -b %s %s REACTOS ReactOS.iso\n",
+	          isoboot.c_str (),
+	          bootcdDirectory.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-02-08 22:11:27 UTC (rev 13469)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-02-08 22:21:16 UTC (rev 13470)
@@ -23,7 +23,6 @@
 	virtual void Process ( const Module& module ) = 0;
 	void GenerateDirectoryTargets () const;
 	static std::string GetObjectFilename ( const std::string& sourceFilename );
-	static std::string GetDirectory ( const std::string& filename );
 protected:
 	const std::string &PassThruCacheDirectory ( const std::string &f ) const;
 	std::string GetWorkingDirectory () const;

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-02-08 22:11:27 UTC (rev 13469)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-02-08 22:21:16 UTC (rev 13470)
@@ -32,6 +32,16 @@
 }
 
 string
+GetDirectory ( const string& filename )
+{
+	size_t index = filename.find_last_of ( CSEP );
+	if ( index == string::npos )
+		return filename;
+	else
+		return filename.substr ( 0, index );
+}
+
+string
 NormalizeFilename ( const string& filename )
 {
 	Path path;

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-02-08 22:11:27 UTC (rev 13469)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-02-08 22:21:16 UTC (rev 13470)
@@ -440,6 +440,9 @@
 GetExtension ( const std::string& filename );
 
 extern std::string
+GetDirectory ( const std::string& filename );
+
+extern std::string
 NormalizeFilename ( const std::string& filename );
 
 #endif /* __RBUILD_H */

Modified: branches/xmlbuildsystem/reactos/tools/rmkdir.c
--- branches/xmlbuildsystem/reactos/tools/rmkdir.c	2005-02-08 22:11:27 UTC (rev 13469)
+++ branches/xmlbuildsystem/reactos/tools/rmkdir.c	2005-02-08 22:21:16 UTC (rev 13470)
@@ -10,15 +10,13 @@
 #include <sys/types.h>
 #endif
 
-#ifdef UNIX_PATHS
-#define DIR_SEPARATOR_CHAR '/'
-#define DIR_SEPARATOR_STRING "/"
-#else
-#ifdef DOS_PATHS
+#if defined(WIN32)
 #define DIR_SEPARATOR_CHAR '\\'
 #define DIR_SEPARATOR_STRING "\\"
+#else
+#define DIR_SEPARATOR_CHAR '/'
+#define DIR_SEPARATOR_STRING "/"
 #endif	
-#endif	
 
 char* convert_path(char* origpath)
 {

Modified: branches/xmlbuildsystem/reactos/tools/tools.xml
--- branches/xmlbuildsystem/reactos/tools/tools.xml	2005-02-08 22:11:27 UTC (rev 13469)
+++ branches/xmlbuildsystem/reactos/tools/tools.xml	2005-02-08 22:21:16 UTC (rev 13470)
@@ -19,3 +19,6 @@
 <directory name="winebuild">
 	<xi:include href="winebuild/winebuild.xml" />
 </directory>
+<module name="rmkdir" type="buildtool">
+	<file>rmkdir.c</file>
+</module>