- The separator (slash or back slash), exepostfix and exeprefix are initialized from environment variables.
- The separators in the path for the system command are always converted for the host system.
- Our own build utilities must convert paths itself (bin2res).
Modified: trunk/reactos/Makefile
Modified: trunk/reactos/tools/bin2res/bin2res.c
Modified: trunk/reactos/tools/rbuild/automaticdependency.cpp
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: trunk/reactos/tools/rbuild/backend/mingw/proxymakefile.cpp
Modified: trunk/reactos/tools/rbuild/cdfile.cpp
Modified: trunk/reactos/tools/rbuild/include.cpp
Modified: trunk/reactos/tools/rbuild/installfile.cpp
Modified: trunk/reactos/tools/rbuild/linkerscript.cpp
Modified: trunk/reactos/tools/rbuild/module.cpp
Modified: trunk/reactos/tools/rbuild/project.cpp
Modified: trunk/reactos/tools/rbuild/rbuild.cpp
Modified: trunk/reactos/tools/rbuild/rbuild.h
Modified: trunk/reactos/tools/rbuild/testsupportcode.cpp
Modified: trunk/reactos/tools/rbuild/wineresource.cpp

Modified: trunk/reactos/Makefile
--- trunk/reactos/Makefile	2005-11-02 23:15:40 UTC (rev 18960)
+++ trunk/reactos/Makefile	2005-11-02 23:24:05 UTC (rev 18961)
@@ -115,7 +115,11 @@
 
 ifeq ($(HOST),)
 ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
+ifeq ($(OSTYPE),msys)
+HOST=mingw32-linux
+else
 HOST=mingw32-windows
+endif
 else
 HOST=mingw32-linux
 endif
@@ -207,9 +211,13 @@
 host_ar = $(Q)ar
 host_objcopy = $(Q)objcopy
 ifeq ($(HOST),mingw32-linux)
-	EXEPREFIX = ./
-	EXEPOSTFIX =
-	SEP = /
+	export EXEPREFIX = ./
+ifeq ($(OSTYPE),msys)
+	export EXEPOSTFIX = .exe
+else	
+	export EXEPOSTFIX =
+endif
+	export SEP = /
 	mkdir = -$(Q)mkdir -p
 	gcc = $(Q)$(PREFIX)-gcc
 	gpp = $(Q)$(PREFIX)-g++
@@ -224,10 +232,29 @@
 	cp = $(Q)cp
 	NUL = /dev/null
 else # mingw32-windows
-	EXEPREFIX =
-	EXEPOSTFIX = .exe
+  ifeq ($(OSTYPE),msys)
+	HOST=mingw32-linux
+	export EXEPREFIX = ./
+	export EXEPOSTFIX = .exe
+	export SEP = /
+	mkdir = -$(Q)mkdir -p
+	gcc = $(Q)gcc
+	gpp = $(Q)g++
+	ld = $(Q)ld
+	nm = $(Q)nm
+	objdump = $(Q)objdump
+	ar = $(Q)ar
+	objcopy = $(Q)objcopy
+	dlltool = $(Q)dlltool
+	windres = $(Q)windres
+	rm = $(Q)rm -f
+	cp = $(Q)cp
+	NUL = /dev/null
+  else
+	export EXEPREFIX =
+	export EXEPOSTFIX = .exe
 	ROS_EMPTY =
-	SEP = \$(ROS_EMPTY)
+	export SEP = \$(ROS_EMPTY)
 	mkdir = -$(Q)mkdir
 	gcc = $(Q)gcc
 	gpp = $(Q)g++
@@ -241,6 +268,7 @@
 	rm = $(Q)del /f /q
 	cp = $(Q)copy /y
 	NUL = NUL
+  endif
 endif
 
 ifneq ($(ROS_INTERMEDIATE),)

Modified: trunk/reactos/tools/bin2res/bin2res.c
--- trunk/reactos/tools/bin2res/bin2res.c	2005-11-02 23:15:40 UTC (rev 18960)
+++ trunk/reactos/tools/bin2res/bin2res.c	2005-11-02 23:24:05 UTC (rev 18961)
@@ -37,8 +37,12 @@
 
 #if defined(WIN32)
 #define DIR_SEPARATOR "\\"
+#define C_SEP '\\'
+#define C_BAD_SEP '/'
 #else
 #define DIR_SEPARATOR "/"
+#define C_SEP '/'
+#define C_BAD_SEP '\\'
 #endif
 
 extern int mkstemps(char *template, int suffix_len);
@@ -275,6 +279,22 @@
     return c == EOF;
 }
 
+char* fix_path_sep(char* name)
+{
+    char *new_name, *ptr;
+
+    ptr = new_name = strdup(name);
+    while(*ptr)
+    {
+        if (*ptr == C_BAD_SEP)
+        {
+            *ptr = C_SEP;
+        }
+        ptr++;
+    }
+    return new_name;
+}
+
 int main(int argc, char **argv)
 {
     int convert_dir = 0, optc;
@@ -295,14 +315,14 @@
 	case 'i':
 	case 'o':
 	    if (specific_file_name) usage();
-	    specific_file_name = optarg;
+	    specific_file_name = fix_path_sep(optarg);
 	    optc = ((optc == 'i') ? 'a' : 'x');
 	    if (convert_dir && convert_dir != optc) usage();
 	    convert_dir = optc;
 	break;
 	case 'b':
 	    if (relative_path) usage();
-	    relative_path = optarg;
+	    relative_path = fix_path_sep(optarg);
 	break;
 	case 'f':
 	    force_overwrite = 1;
@@ -320,7 +340,7 @@
     }
 
     if (optind + 1 != argc) usage();
-    input_file_name = argv[optind];
+    input_file_name = fix_path_sep(argv[optind]);
 
     if (!convert_dir) usage();
 

Modified: trunk/reactos/tools/rbuild/automaticdependency.cpp
--- trunk/reactos/tools/rbuild/automaticdependency.cpp	2005-11-02 23:15:40 UTC (rev 18960)
+++ trunk/reactos/tools/rbuild/automaticdependency.cpp	2005-11-02 23:24:05 UTC (rev 18961)
@@ -46,7 +46,7 @@
 void
 SourceFile::GetDirectoryAndFilenameParts ()
 {
-	size_t index = filename.find_last_of ( CSEP );
+	size_t index = filename.find_last_of ( cSep );
 	if ( index != string::npos )
 	{
 		directoryPart = filename.substr ( 0, index );
@@ -347,7 +347,7 @@
                                           const string& includedFilename,
                                           string& resolvedFilename )
 {
-	string normalizedFilename = NormalizeFilename ( directory + SSEP + includedFilename );
+	string normalizedFilename = NormalizeFilename ( directory + sSep + includedFilename );
 	FILE* f = fopen ( normalizedFilename.c_str (), "rb" );
 	if ( f != NULL )
 	{
@@ -362,7 +362,7 @@
 string
 AutomaticDependency::GetFilename ( const string& filename )
 {
-	size_t index = filename.find_last_of ( CSEP );
+	size_t index = filename.find_last_of ( cSep );
 	if (index == string::npos)
 		return filename;
 	else

Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
--- trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-11-02 23:15:40 UTC (rev 18960)
+++ trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-11-02 23:24:05 UTC (rev 18961)
@@ -119,17 +119,17 @@
 {
 	size_t index = 0;
 	size_t nextIndex;
-	if ( isalpha ( path[0] ) && path[1] == ':' && path[2] == CSEP )
+	if ( isalpha ( path[0] ) && path[1] == ':' && path[2] == cSep )
 	{
-		nextIndex = path.find ( CSEP, 3);
+		nextIndex = path.find ( cSep, 3);
 	}
 	else
-		nextIndex = path.find ( CSEP );
+		nextIndex = path.find ( cSep );
 
 	bool directoryWasCreated = false;
 	while ( nextIndex != string::npos )
 	{
-		nextIndex = path.find ( CSEP, index + 1 );
+		nextIndex = path.find ( cSep, index + 1 );
 		directoryWasCreated = mkdir_p ( path.substr ( 0, nextIndex ).c_str () );
 		index = nextIndex;
 	}
@@ -168,7 +168,7 @@
 	{
 		char buf[256];
 		
-		path = parent + SSEP + name;
+		path = parent + sSep + name;
 		ResolveVariablesInPath ( buf, path );
 		if ( CreateDirectory ( buf ) && verbose )
 			printf ( "Created %s\n", buf );
@@ -212,7 +212,7 @@
 		fprintf ( f,
 			"%s%c%s: | %s\n",
 			escapedParent.c_str (),
-			CSEP,
+			cSep,
 			EscapeSpaces ( name ).c_str (),
 			escapedParent.c_str () );
 
@@ -222,7 +222,7 @@
 		fprintf ( f,
 			"\t${mkdir} $@\n" );
 
-		path = parent + SSEP + name;
+		path = parent + sSep + name;
 	}
 	else
 		path = name;
@@ -687,7 +687,7 @@
 string
 MingwBackend::GetBin2ResExecutable ()
 {
-	return NormalizeFilename ( Environment::GetOutputPath () + SSEP + "tools/bin2res/bin2res" + EXEPOSTFIX );
+	return NormalizeFilename ( Environment::GetOutputPath () + sSep + "tools/bin2res/bin2res" + ExePostfix );
 }
 
 void
@@ -743,7 +743,7 @@
 bool
 MingwBackend::IncludeDirectoryTarget ( const string& directory ) const
 {
-	if ( directory == "$(INTERMEDIATE)" SSEP "tools")
+	if ( directory == "$(INTERMEDIATE)" + sSep + "tools")
 		return false;
 	else
 		return true;
@@ -765,7 +765,7 @@
 {
 	string command = ssprintf (
 		"%s -v 1>%s 2>%s",
-		compiler.c_str (),
+		FixSeparatorForSystemCommand(compiler).c_str (),
 		NUL,
 		NUL );
 	int exitcode = system ( command.c_str () );
@@ -810,7 +810,7 @@
 {
 	string command = ssprintf (
 		"%s -h 1>%s 2>%s",
-		assembler.c_str (),
+		FixSeparatorForSystemCommand(assembler).c_str (),
 		NUL,
 		NUL );
 	int exitcode = system ( command.c_str () );
@@ -822,7 +822,7 @@
 {
 	string command = ssprintf (
 		"%s -v 1>%s",
-		binutils.c_str (),
+		FixSeparatorForSystemCommand(binutils).c_str (),
 		NUL,
 		NUL );
 	int exitcode = system ( command.c_str () );
@@ -955,12 +955,12 @@
 {
 	printf ( "Detecting compiler -pipe support..." );
 
-	string pipe_detection = "tools" SSEP "rbuild" SSEP "backend" SSEP "mingw" SSEP "pipe_detection.c";
+	string pipe_detection = "tools" + sSep + "rbuild" + sSep + "backend" + sSep + "mingw" + sSep + "pipe_detection.c";
 	string pipe_detectionObjectFilename = ReplaceExtension ( pipe_detection,
 	                                                         ".o" );
 	string command = ssprintf (
 		"%s -pipe -c %s -o %s 1>%s 2>%s",
-		compilerCommand.c_str (),
+		FixSeparatorForSystemCommand(compilerCommand).c_str (),
 		pipe_detection.c_str (),
 		pipe_detectionObjectFilename.c_str (),
 		NUL,
@@ -987,10 +987,10 @@
 {
 	printf ( "Detecting compiler pre-compiled header support..." );
 
-	string path = "tools" SSEP "rbuild" SSEP "backend" SSEP "mingw" SSEP "pch_detection.h";
+	string path = "tools" + sSep + "rbuild" + sSep + "backend" + sSep + "mingw" + sSep + "pch_detection.h";
 	string cmd = ssprintf (
 		"%s -c %s 1>%s 2>%s",
-		compilerCommand.c_str (),
+		FixSeparatorForSystemCommand(compilerCommand).c_str (),
 		path.c_str (),
 		NUL,
 		NUL );
@@ -1020,7 +1020,7 @@
 	for ( size_t i = 0; i < ProjectNode.installfiles.size (); i++ )
 	{
 		const InstallFile& installfile = *ProjectNode.installfiles[i];
-		string targetFilenameNoFixup = installfile.base + SSEP + installfile.newname;
+		string targetFilenameNoFixup = installfile.base + sSep + installfile.newname;
 		string targetFilename = MingwModuleHandler::PassThruCacheDirectory (
 			NormalizeFilename ( targetFilenameNoFixup ),
 			installDirectory );
@@ -1041,7 +1041,7 @@
 		{
 			string targetFilenameNoFixup;
 			if ( module.installBase.length () > 0 )
-				targetFilenameNoFixup = module.installBase + SSEP + module.installName;
+				targetFilenameNoFixup = module.installBase + sSep + module.installName;
 			else
 				targetFilenameNoFixup = module.installName;
 			string targetFilename = MingwModuleHandler::PassThruCacheDirectory (
@@ -1067,7 +1067,7 @@
 {
 	string fullTargetFilename;
 	if ( targetDirectory.length () > 0)
-		fullTargetFilename = targetDirectory + SSEP + targetFilename;
+		fullTargetFilename = targetDirectory + sSep + targetFilename;
 	else
 		fullTargetFilename = targetFilename;
 	string normalizedTargetFilename = MingwModuleHandler::PassThruCacheDirectory (
@@ -1138,11 +1138,11 @@
 string
 MingwBackend::GetRegistrySourceFiles ()
 {
-	return "bootdata" SSEP "hivecls.inf "
-		"bootdata" SSEP "hivedef.inf "
-		"bootdata" SSEP "hiveinst.inf "
-		"bootdata" SSEP "hivesft.inf "
-		"bootdata" SSEP "hivesys.inf";
+	return "bootdata" + sSep + "hivecls.inf "
+		"bootdata" + sSep + "hivedef.inf "
+		"bootdata" + sSep + "hiveinst.inf "
+		"bootdata" + sSep + "hivesft.inf "
+		"bootdata" + sSep + "hivesys.inf";
 }
 
 string
@@ -1150,13 +1150,13 @@
 {
 	string system32ConfigDirectory = NormalizeFilename (
 		MingwModuleHandler::PassThruCacheDirectory (
-		"system32" SSEP "config" SSEP,
+		"system32" + sSep + "config" + sSep,
 		installDirectory ) );
-	return system32ConfigDirectory + SSEP "default " +
-		system32ConfigDirectory + SSEP "sam " +
-		system32ConfigDirectory + SSEP "security " +
-		system32ConfigDirectory + SSEP "software " +
-		system32ConfigDirectory + SSEP "system";
+	return system32ConfigDirectory + sSep + "default " +
+		system32ConfigDirectory + sSep + "sam " +
+                system32ConfigDirectory + sSep + "security " +
+		system32ConfigDirectory + sSep + "software " +
+		system32ConfigDirectory + sSep + "system";
 }
 
 void
@@ -1164,7 +1164,7 @@
 {
 	string system32ConfigDirectory = NormalizeFilename (
 		MingwModuleHandler::PassThruCacheDirectory (
-		"system32" SSEP "config" SSEP,
+		"system32" + sSep + "config" + sSep,
 		installDirectory ) );
 
 	string registrySourceFiles = GetRegistrySourceFiles ();
@@ -1180,8 +1180,9 @@
 	fprintf ( fMakefile,
 	          "\t$(ECHO_MKHIVE)\n" );
 	fprintf ( fMakefile,
-	          "\t$(MKHIVE_TARGET) bootdata %s bootdata" SSEP "hiveinst.inf\n",
-	          system32ConfigDirectory.c_str () );
+	          "\t$(MKHIVE_TARGET) bootdata %s bootdata%chiveinst.inf\n",
+	          system32ConfigDirectory.c_str (),
+                  cSep );
 	fprintf ( fMakefile,
 	          "\n" );
 }

Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-11-02 23:15:40 UTC (rev 18960)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-11-02 23:24:05 UTC (rev 18961)
@@ -50,7 +50,7 @@
 	{
 		if ( p2 > p1 )
 			p1 = p2;
-		out += string(pfilename,p1-pfilename) + CSEP;
+		out += string(pfilename,p1-pfilename) + cSep;
 		pfilename = p1 + 1;
 	}
 	out += prefix + pfilename;
@@ -106,7 +106,7 @@
 		size_t j = path.find ( ')', i );
 		if ( j != string::npos )
 		{
-			if ( j + 2 < path.length () && path[j + 1] == CSEP )
+			if ( j + 2 < path.length () && path[j + 1] == cSep )
 				return path.substr ( j + 2);
 			else
 				return path.substr ( j + 1);
@@ -130,7 +130,7 @@
 	{
 		if ( file == "" )
 			return generatedFilesDirectory;
-		return generatedFilesDirectory + SSEP + file;
+		return generatedFilesDirectory + sSep + file;
 	}
 }
 
@@ -518,7 +518,7 @@
 		return;
 	fprintf ( fMakefile, ".PHONY: %s_install\n", module.name.c_str() );
 	string normalizedTargetFilename = MingwModuleHandler::PassThruCacheDirectory (
-		NormalizeFilename ( module.installBase + SSEP + module.installName ),
+		NormalizeFilename ( module.installBase + sSep + module.installName ),
 		backend->installDirectory );
 	fprintf ( fMakefile,
 	          "%s_install: %s\n",
@@ -581,7 +581,7 @@
 	return parameters;
 }
 
-string
+string  
 MingwModuleHandler::GenerateGccDefineParameters () const
 {
 	string parameters = GenerateGccDefineParametersFromVector ( module.project.non_if_data.defines );
@@ -601,10 +601,10 @@
 {
 	if ( ( path1.length () == 0 ) || ( path1 == "." ) || ( path1 == "./" ) )
 		return path2;
-	if ( path1[path1.length ()] == CSEP )
+	if ( path1[path1.length ()] == cSep )
 		return path1 + path2;
 	else
-		return path1 + CSEP + path2;
+		return path1 + cSep + path2;
 }
 
 /* static */ string
@@ -1838,7 +1838,7 @@
 	if ( module.name != "zlib" ) /* Avoid make warning */
 	{
 		string proxyMakefile = PassThruCacheDirectory (
-			NormalizeFilename ( module.GetBasePath () + SSEP + "makefile" ),
+			NormalizeFilename ( module.GetBasePath () + sSep + "makefile" ),
 			backend->outputDirectory );
 		CLEAN_FILE ( proxyMakefile );
 	}
@@ -2009,7 +2009,7 @@
 {
 	if ( module.importLibrary != NULL )
 	{
-		string defFilename = module.GetBasePath () + SSEP + module.importLibrary->definition;
+		string defFilename = module.GetBasePath () + sSep + module.importLibrary->definition;
 		if ( IsWineModule () )
 			return PassThruCacheDirectory ( NormalizeFilename ( defFilename ),
 			                                backend->intermediateDirectory );
@@ -2017,7 +2017,7 @@
 			return defFilename;
 	}
 	else
-		return "tools" SSEP "rbuild" SSEP "empty.def";
+		return "tools" + sSep + "rbuild" + sSep + "empty.def";
 }
 
 void
@@ -2181,8 +2181,9 @@
 
 		string dependencies = linkDepsMacro + " " + objectsMacro;
 
-		string linkerParameters = ssprintf ( "-Wl,-T,%s" SSEP "ntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared",
+		string linkerParameters = ssprintf ( "-Wl,-T,%s%cntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared",
 		                                     module.GetBasePath ().c_str (),
+                                                     cSep,
 		                                     module.entrypoint.c_str (),
 		                                     module.baseaddress.c_str () );
 		GenerateLinkerCommand ( dependencies,
@@ -2693,7 +2694,7 @@
 			string sourceFilename = PassThruCacheDirectory (
 				NormalizeFilename ( m.GetPath () ),
 				backend->outputDirectory );
-			string targetFilenameNoFixup ( bootcdDirectory + SSEP + m.bootstrap->base + SSEP + m.bootstrap->nameoncd );
+			string targetFilenameNoFixup ( bootcdDirectory + sSep + m.bootstrap->base + sSep + m.bootstrap->nameoncd );
 			string targetFilename = MingwModuleHandler::PassThruCacheDirectory (
 				NormalizeFilename ( targetFilenameNoFixup ),
 				backend->outputDirectory );
@@ -2714,7 +2715,7 @@
 	for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )
 	{
 		const CDFile& cdfile = *module.project.cdfiles[i];
-		string targetFilenameNoFixup = bootcdDirectory + SSEP + cdfile.base + SSEP + cdfile.nameoncd;
+		string targetFilenameNoFixup = bootcdDirectory + sSep + cdfile.base + sSep + cdfile.nameoncd;
 		string targetFilename = MingwModuleHandler::PassThruCacheDirectory (
 			NormalizeFilename ( targetFilenameNoFixup ),
 			backend->outputDirectory );
@@ -2738,7 +2739,7 @@
 			continue;
 		if ( m.bootstrap != NULL )
 		{
-			string targetDirectory ( bootcdDirectory + SSEP + m.bootstrap->base );
+			string targetDirectory ( bootcdDirectory + sSep + m.bootstrap->base );
 			if ( directories.size () > 0 )
 				directories += " ";
 			directories += PassThruCacheDirectory (
@@ -2756,7 +2757,7 @@
 	for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )
 	{
 		const CDFile& cdfile = *module.project.cdfiles[i];
-		string targetDirectory ( bootcdDirectory + SSEP + cdfile.base );
+		string targetDirectory ( bootcdDirectory + sSep + cdfile.base );
 		if ( directories.size () > 0 )
 			directories += " ";
 		directories += PassThruCacheDirectory (
@@ -2817,20 +2818,20 @@
 {
 	string bootcdDirectory = "cd";
 	string bootcd = PassThruCacheDirectory (
-		NormalizeFilename ( bootcdDirectory + SSEP ),
+		NormalizeFilename ( bootcdDirectory + sSep ),
 		backend->outputDirectory );
 	string isoboot = PassThruCacheDirectory (
-		NormalizeFilename ( "boot" SSEP "freeldr" SSEP "bootsect" SSEP "isoboot.o" ),
+		NormalizeFilename ( "boot" + sSep + "freeldr" + sSep + "bootsect" + sSep + "isoboot.o" ),
 		backend->outputDirectory );
-	string bootcdReactosNoFixup = bootcdDirectory + SSEP "reactos";
+	string bootcdReactosNoFixup = bootcdDirectory + sSep + "reactos";
 	string bootcdReactos = PassThruCacheDirectory (
-		NormalizeFilename ( bootcdReactosNoFixup + SSEP ),
+		NormalizeFilename ( bootcdReactosNoFixup + sSep ),
 		backend->outputDirectory );
 	CLEAN_FILE ( bootcdReactos );
 	string reactosInf = PassThruCacheDirectory (
-		NormalizeFilename ( bootcdReactosNoFixup + SSEP "reactos.inf" ),
+		NormalizeFilename ( bootcdReactosNoFixup + sSep + "reactos.inf" ),
 		backend->outputDirectory );
-	string reactosDff = NormalizeFilename ( "bootdata" SSEP "packages" SSEP "reactos.dff" );
+	string reactosDff = NormalizeFilename ( "bootdata" + sSep + "packages" + sSep + "reactos.dff" );
 	string cdDirectories = GetCdDirectories ( bootcdDirectory );
 	vector<string> vCdFiles;
 	GetCdFiles ( vCdFiles );
@@ -2887,7 +2888,7 @@
 MingwLiveIsoModuleHandler::CreateDirectory ( const string& directory )
 {
 	string normalizedDirectory = MingwModuleHandler::PassThruCacheDirectory (
-		NormalizeFilename ( directory ) + SSEP,
+		NormalizeFilename ( directory ) + sSep,
 		backend->outputDirectory );
 }
 
@@ -2897,7 +2898,7 @@
                                                const string& targetDirectory )
 {
 	string normalizedTargetFilename = MingwModuleHandler::PassThruCacheDirectory (
-		NormalizeFilename ( targetDirectory + SSEP + targetFilename ),
+		NormalizeFilename ( targetDirectory + sSep + targetFilename ),
 		backend->outputDirectory );
 	fprintf ( fMakefile,
 	          "\t$(ECHO_CP)\n" );
@@ -2924,7 +2925,7 @@
 				backend->outputDirectory );
 			OutputCopyCommand ( sourceFilename,
 			                    m.installName,
-			                    livecdDirectory + SSEP + reactosDirectory + SSEP + m.installBase );
+			                    livecdDirectory + sSep + reactosDirectory + sSep + m.installBase );
 		}
 	}
 }
@@ -2938,21 +2939,21 @@
 		const InstallFile& installfile = *module.project.installfiles[i];
 		OutputCopyCommand ( installfile.GetPath (),
 	                        installfile.newname,
-	                        livecdDirectory + SSEP + reactosDirectory + SSEP + installfile.base );
+	                        livecdDirectory + sSep + reactosDirectory + sSep + installfile.base );
 	}
 }
 
 void
 MingwLiveIsoModuleHandler::OutputProfilesDirectoryCommands ( string& livecdDirectory )
 {
-	CreateDirectory ( livecdDirectory + SSEP "Profiles" );
-	CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "All Users") ;
-	CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "All Users" SSEP "Desktop" );
-	CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "Default User" );
-	CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "Default User" SSEP "Desktop" );
-	CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "Default User" SSEP "My Documents" );
+	CreateDirectory ( livecdDirectory + sSep + "Profiles" );
+	CreateDirectory ( livecdDirectory + sSep + "Profiles" + sSep + "All Users") ;
+	CreateDirectory ( livecdDirectory + sSep + "Profiles" + sSep + "All Users" + sSep + "Desktop" );
+	CreateDirectory ( livecdDirectory + sSep + "Profiles" + sSep + "Default User" );
+	CreateDirectory ( livecdDirectory + sSep + "Profiles" + sSep + "Default User" + sSep + "Desktop" );
+	CreateDirectory ( livecdDirectory + sSep + "Profiles" + sSep + "Default User" + sSep + "My Documents" );
 
-	string livecdIni = "bootdata" SSEP "livecd.ini";
+	string livecdIni = "bootdata" + sSep + "livecd.ini";
 	OutputCopyCommand ( livecdIni,
                         "freeldr.ini",
                         livecdDirectory );
@@ -2962,12 +2963,12 @@
 MingwLiveIsoModuleHandler::OutputLoaderCommands ( string& livecdDirectory )
 {
 	string freeldr = PassThruCacheDirectory (
-		NormalizeFilename ( "boot" SSEP "freeldr" SSEP "freeldr" SSEP "freeldr.sys" ),
+		NormalizeFilename ( "boot" + sSep + "freeldr" + sSep + "freeldr" + sSep + "freeldr.sys" ),
 		backend->outputDirectory );
-	CreateDirectory ( livecdDirectory + SSEP "loader" );
+	CreateDirectory ( livecdDirectory + sSep + "loader" );
 	OutputCopyCommand ( freeldr,
                         "setupldr.sys",
-                        livecdDirectory + SSEP + "loader" );
+                        livecdDirectory + sSep + "loader" );
 }
 
 void
@@ -2975,13 +2976,15 @@
 {
 	string reactosSystem32ConfigDirectory = NormalizeFilename (
 		MingwModuleHandler::PassThruCacheDirectory (
-		livecdDirectory + SSEP "reactos" SSEP "system32" SSEP "config" SSEP,
+		livecdDirectory + sSep + "reactos" + sSep + "system32" + sSep + "config" + sSep,
 		backend->outputDirectory ) );
 	fprintf ( fMakefile,
 	          "\t$(ECHO_MKHIVE)\n" );
 	fprintf ( fMakefile,
-	          "\t$(MKHIVE_TARGET) bootdata %s bootdata" SSEP "livecd.inf bootdata" SSEP "hiveinst.inf\n",
-	          reactosSystem32ConfigDirectory.c_str () );
+	          "\t$(MKHIVE_TARGET) bootdata %s bootdata%clivecd.inf bootdata%chiveinst.inf\n",
+	          reactosSystem32ConfigDirectory.c_str (),
+                  cSep,
+                  cSep );
 }
 
 void
@@ -2989,15 +2992,15 @@
 {
 	string livecdDirectory = "livecd";
 	string livecd = PassThruCacheDirectory (
-		NormalizeFilename ( livecdDirectory + SSEP ),
+		NormalizeFilename ( livecdDirectory + sSep ),
 		backend->outputDirectory );
 	string isoboot = PassThruCacheDirectory (
-		NormalizeFilename ( "boot" SSEP "freeldr" SSEP "bootsect" SSEP "isoboot.o" ),
+		NormalizeFilename ( "boot" + sSep + "freeldr" + sSep + "bootsect" + sSep + "isoboot.o" ),
 		backend->outputDirectory );
 	string reactosDirectory = "reactos";
-	string livecdReactosNoFixup = livecdDirectory + SSEP + reactosDirectory;
+	string livecdReactosNoFixup = livecdDirectory + sSep + reactosDirectory;
 	string livecdReactos = NormalizeFilename ( PassThruCacheDirectory (
-		NormalizeFilename ( livecdReactosNoFixup + SSEP ),
+		NormalizeFilename ( livecdReactosNoFixup + sSep ),
 		backend->outputDirectory ) );
 	CLEAN_FILE ( livecdReactos );
 
@@ -3041,10 +3044,10 @@
 void
 MingwTestModuleHandler::GetModuleSpecificSourceFiles ( vector<File*>& sourceFiles )
 {
-	string basePath = "$(INTERMEDIATE)" SSEP + module.GetBasePath ();
-	sourceFiles.push_back ( new File ( basePath + SSEP "_hooks.c", false, "", false ) );
-	sourceFiles.push_back ( new File ( basePath + SSEP "_stubs.S", false, "", false ) );
-	sourceFiles.push_back ( new File ( basePath + SSEP "_startup.c", false, "", false ) );
+	string basePath = "$(INTERMEDIATE)" + sSep + module.GetBasePath ();
+	sourceFiles.push_back ( new File ( basePath + sSep + "_hooks.c", false, "", false ) );
+	sourceFiles.push_back ( new File ( basePath + sSep + "_stubs.S", false, "", false ) );
+	sourceFiles.push_back ( new File ( basePath + sSep + "_startup.c", false, "", false ) );
 }
 
 void

Modified: trunk/reactos/tools/rbuild/backend/mingw/proxymakefile.cpp
--- trunk/reactos/tools/rbuild/backend/mingw/proxymakefile.cpp	2005-11-02 23:15:40 UTC (rev 18960)
+++ trunk/reactos/tools/rbuild/backend/mingw/proxymakefile.cpp	2005-11-02 23:24:05 UTC (rev 18961)
@@ -62,7 +62,7 @@
 	for ( int i = 0; i < numberOfParentDirectories; i++ )
 	{
 		if ( path != "" )
-			path += SSEP;
+			path += sSep;
 		path += "..";
 	}
 	return path;
@@ -75,7 +75,7 @@
 	string basePath = NormalizeFilename ( module.GetBasePath () );
 	for ( size_t i = 0; i < basePath.length (); i++ )
 	{
-		if ( basePath[i] == CSEP )
+		if ( basePath[i] == cSep )
 			numberOfDirectories++;
 	}
 	return GeneratePathToParentDirectory ( numberOfDirectories );
@@ -99,7 +99,7 @@
 	string pathToTopDirectory;
 	if ( outputTree.length () > 0 )
 	{
-		base = outputTree + SSEP + module.GetBasePath ();
+		base = outputTree + sSep + module.GetBasePath ();
 		Path path;
 		pathToTopDirectory = working_directory;
 	}
@@ -108,7 +108,7 @@
 		base = module.GetBasePath ();
 		pathToTopDirectory = GetPathToTopDirectory ( module );
 	}
-	string proxyMakefile = NormalizeFilename ( base + SSEP "GNUmakefile" );
+	string proxyMakefile = NormalizeFilename ( base + sSep + "GNUmakefile" );
 	string defaultTarget = module.name;
 
 	buf = (char*) malloc ( 10*1024 );

Modified: trunk/reactos/tools/rbuild/cdfile.cpp
--- trunk/reactos/tools/rbuild/cdfile.cpp	2005-11-02 23:15:40 UTC (rev 18960)
+++ trunk/reactos/tools/rbuild/cdfile.cpp	2005-11-02 23:24:05 UTC (rev 18961)
@@ -50,7 +50,7 @@
 string
 CDFile::GetPath () const
 {
-	return path + SSEP + name;
+	return path + sSep + name;
 }
 
 void

Modified: trunk/reactos/tools/rbuild/include.cpp
--- trunk/reactos/tools/rbuild/include.cpp	2005-11-02 23:15:40 UTC (rev 18960)
+++ trunk/reactos/tools/rbuild/include.cpp	2005-11-02 23:24:05 UTC (rev 18961)
@@ -50,7 +50,7 @@
 	  node ( NULL ),
 	  baseModule ( NULL )
 {
-	this->directory = NormalizeFilename ( basePath + SSEP + directory );
+	this->directory = NormalizeFilename ( basePath + sSep + directory );
 	this->basePath = NormalizeFilename ( basePath );
 }
 
@@ -91,7 +91,7 @@
 				node->location,
 				"<include> attribute 'base' references non-existant project or module '%s'",
 				att->value.c_str() );
-		directory = NormalizeFilename ( basePath + SSEP + node->value );
+		directory = NormalizeFilename ( basePath + sSep + node->value );
 	}
 	else
 		directory = NormalizeFilename ( node->value );

Modified: trunk/reactos/tools/rbuild/installfile.cpp
--- trunk/reactos/tools/rbuild/installfile.cpp	2005-11-02 23:15:40 UTC (rev 18960)
+++ trunk/reactos/tools/rbuild/installfile.cpp	2005-11-02 23:24:05 UTC (rev 18961)
@@ -50,7 +50,7 @@
 string
 InstallFile::GetPath () const
 {
-	return path + SSEP + name;
+	return path + sSep + name;
 }
 
 void

Modified: trunk/reactos/tools/rbuild/linkerscript.cpp
--- trunk/reactos/tools/rbuild/linkerscript.cpp	2005-11-02 23:15:40 UTC (rev 18960)
+++ trunk/reactos/tools/rbuild/linkerscript.cpp	2005-11-02 23:24:05 UTC (rev 18961)
@@ -66,7 +66,7 @@
 				node.location,
 				"<linkerscript> attribute 'base' references non-existant project or module '%s'",
 				att->value.c_str() );
-		directory = NormalizeFilename ( basePath + SSEP + node.value );
+		directory = NormalizeFilename ( basePath + sSep + node.value );
 	}
 	else
 		directory = NormalizeFilename ( node.value );

Modified: trunk/reactos/tools/rbuild/module.cpp
--- trunk/reactos/tools/rbuild/module.cpp	2005-11-02 23:15:40 UTC (rev 18960)
+++ trunk/reactos/tools/rbuild/module.cpp	2005-11-02 23:24:05 UTC (rev 18961)
@@ -55,16 +55,29 @@
 FixSeparator ( const string& s )
 {
 	string s2(s);
-	char* p = strchr ( &s2[0], CBAD_SEP );
+	char* p = strchr ( &s2[0], cBadSep );
 	while ( p )
 	{
-		*p++ = CSEP;
-		p = strchr ( p, CBAD_SEP );
+		*p++ = cSep;
+		p = strchr ( p, cBadSep );
 	}
 	return s2;
 }
 
 string
+FixSeparatorForSystemCommand ( const string& s )
+{
+	string s2(s);
+	char* p = strchr ( &s2[0], DEF_CBAD_SEP );
+	while ( p )
+	{
+		*p++ = DEF_CSEP;
+		p = strchr ( p, DEF_CBAD_SEP );
+	}
+	return s2;
+}
+
+string
 DosSeparator ( const string& s )
 {
 	string s2(s);
@@ -111,7 +124,7 @@
 			"<directory> tag has invalid characters in 'name' attribute" );
 	if ( !path.size() )
 		return att_value;
-	return FixSeparator(path + CSEP + att_value);
+	return FixSeparator(path + cSep + att_value);
 }
 
 string
@@ -129,7 +142,7 @@
 string
 GetDirectory ( const string& filename )
 {
-	size_t index = filename.find_last_of ( CSEP );
+	size_t index = filename.find_last_of ( cSep );
 	if ( index == string::npos )
 		return "";
 	else
@@ -139,7 +152,7 @@
 string
 GetFilename ( const string& filename )
 {
-	size_t index = filename.find_last_of ( CSEP );
+	size_t index = filename.find_last_of ( cSep );
 	if ( index == string::npos )
 		return filename;
 	else
@@ -453,7 +466,7 @@
 			else if ( !stricmp ( ext.c_str(), ".cxx" ) )
 				cplusplus = true;
 		}
-		File* pFile = new File ( FixSeparator ( path + CSEP + e.value ),
+		File* pFile = new File ( FixSeparator ( path + cSep + e.value ),
 		                         first,
 		                         switches,
 		                         false );
@@ -597,7 +610,7 @@
 				e.location,
 				"Only one <pch> is valid per module" );
 		pch = new PchFile (
-			e, *this, File ( FixSeparator ( path + CSEP + e.value ), false, "", true ) );
+			e, *this, File ( FixSeparator ( path + cSep + e.value ), false, "", true ) );
 		subs_invalid = true;
 	}
 	if ( subs_invalid && e.subElements.size() > 0 )
@@ -661,7 +674,7 @@
 	switch (type)
 	{
 		case BuildTool:
-			return EXEPOSTFIX;
+			return ExePostfix;
 		case StaticLibrary:
 			return ".a";
 		case ObjectLibrary:
@@ -868,7 +881,7 @@
 Module::GetPath () const
 {
 	if ( path.length() > 0 )
-		return path + CSEP + GetTargetName ();
+		return path + cSep + GetTargetName ();
 	else
 		return GetTargetName ();
 }
@@ -876,7 +889,7 @@
 string
 Module::GetPathWithPrefix ( const string& prefix ) const
 {
-	return path + CSEP + prefix + GetTargetName ();
+	return path + cSep + prefix + GetTargetName ();
 }
 
 string
@@ -914,7 +927,7 @@
 	for ( size_t i = 0; i < invocations.size (); i++ )
 	{
 		Invoke& invoke = *invocations[i];
-		string command = invoke.invokeModule->GetPath () + " " + invoke.GetParameters ();
+		string command = FixSeparatorForSystemCommand(invoke.invokeModule->GetPath ()) + " " + invoke.GetParameters ();
 		printf ( "Executing '%s'\n\n", command.c_str () );
 		int exitcode = system ( command.c_str () );
 		if ( exitcode != 0 )
@@ -1034,7 +1047,7 @@
 	bool subs_invalid = false;
 	if ( e.name == "inputfile" && e.value.size () > 0 )
 	{
-		input.push_back ( new InvokeFile ( e, FixSeparator ( module.path + CSEP + e.value ) ) );
+		input.push_back ( new InvokeFile ( e, FixSeparator ( module.path + cSep + e.value ) ) );
 		subs_invalid = true;
 	}
 	if ( subs_invalid && e.subElements.size() > 0 )
@@ -1049,7 +1062,7 @@
 	bool subs_invalid = false;
 	if ( e.name == "outputfile" && e.value.size () > 0 )
 	{
-		output.push_back ( new InvokeFile ( e, FixSeparator ( module.path + CSEP + e.value ) ) );
+		output.push_back ( new InvokeFile ( e, FixSeparator ( module.path + cSep + e.value ) ) );
 		subs_invalid = true;
 	}
 	if ( subs_invalid && e.subElements.size() > 0 )

Modified: trunk/reactos/tools/rbuild/project.cpp
--- trunk/reactos/tools/rbuild/project.cpp	2005-11-02 23:15:40 UTC (rev 18960)
+++ trunk/reactos/tools/rbuild/project.cpp	2005-11-02 23:24:05 UTC (rev 18961)
@@ -198,7 +198,7 @@
 
 	s = s + sprintf ( s, "#endif /* __INCLUDE_CONFIG_H */\n" );
 
-	FileSupportCode::WriteIfChanged ( buf, "include" SSEP "roscfg.h" );
+	FileSupportCode::WriteIfChanged ( buf, "include" + sSep + "roscfg.h" );
 
 	free ( buf );
 }

Modified: trunk/reactos/tools/rbuild/rbuild.cpp
--- trunk/reactos/tools/rbuild/rbuild.cpp	2005-11-02 23:15:40 UTC (rev 18960)
+++ trunk/reactos/tools/rbuild/rbuild.cpp	2005-11-02 23:24:05 UTC (rev 18961)
@@ -35,6 +35,13 @@
 static string RootXmlFile = "ReactOS.xml";
 static Configuration configuration;
 
+string ExePrefix;
+string ExePostfix;
+string sSep;
+string sBadSep;
+char cSep;
+char cBadSep;
+
 bool
 ParseAutomaticDependencySwitch ( char switchChar2,
 	                             char* switchStart )
@@ -186,6 +193,43 @@
 int
 main ( int argc, char** argv )
 {
+        char *SepValue, *ExePostfixValue, *ExePrefixValue;;
+
+        SepValue = getenv("SEP");
+        if (SepValue && (0 == strcmp(SepValue, DEF_SSEP) || 0 == strcmp(SepValue, DEF_SBAD_SEP)))
+        {
+            cSep = SepValue[0];
+            sSep = SepValue;
+        }
+        else
+        {
+            cSep = DEF_CSEP;
+            sSep = DEF_SSEP;
+        }
+        if (cSep == DEF_CSEP)
+        {
+            cBadSep = DEF_CBAD_SEP;
+            sBadSep = DEF_SBAD_SEP;
+        }
+        else
+        {
+            cBadSep = DEF_CSEP;
+            sBadSep = DEF_SSEP;
+        }
+        ExePostfixValue = getenv("EXEPOSTFIX");
+        ExePrefixValue = getenv("EXEPREFIX");
+        if ((ExePostfixValue == NULL || 0 == strlen(ExePostfixValue)) &&
+            (ExePrefixValue == NULL || 0 == strlen(ExePrefixValue)))
+        {
+            ExePostfix = DEF_EXEPOSTFIX;
+            ExePrefix = DEF_EXEPREFIX;
+        }
+        else
+        {
+            ExePostfix = ExePostfixValue ? ExePostfixValue : "";
+            ExePrefix = ExePrefixValue ? ExePrefixValue : "";
+        }
+
 	if ( !ParseArguments ( argc, argv ) )
 	{
 		printf ( "Generates project files for buildsystems\n\n" );

Modified: trunk/reactos/tools/rbuild/rbuild.h
--- trunk/reactos/tools/rbuild/rbuild.h	2005-11-02 23:15:40 UTC (rev 18960)
+++ trunk/reactos/tools/rbuild/rbuild.h	2005-11-02 23:24:05 UTC (rev 18961)
@@ -41,20 +41,27 @@
 
 typedef std::vector<std::string> string_list;
 
+extern std::string ExePrefix;
+extern std::string ExePostfix;
+extern std::string sSep;
+extern std::string sBadSep;
+extern char cSep;
+extern char cBadSep;
+
 #ifdef WIN32
[truncated at 1000 lines; 86 more skipped]