- 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).

svn path=/trunk/; revision=18961
This commit is contained in:
Hartmut Birr 2005-11-02 23:24:05 +00:00
parent 05037bcbe6
commit 8bbbecaa87
16 changed files with 251 additions and 132 deletions

View file

@ -115,7 +115,11 @@ all: makefile.auto
ifeq ($(HOST),) ifeq ($(HOST),)
ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32) ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
ifeq ($(OSTYPE),msys)
HOST=mingw32-linux
else
HOST=mingw32-windows HOST=mingw32-windows
endif
else else
HOST=mingw32-linux HOST=mingw32-linux
endif endif
@ -207,9 +211,13 @@ host_ld = $(Q)ld
host_ar = $(Q)ar host_ar = $(Q)ar
host_objcopy = $(Q)objcopy host_objcopy = $(Q)objcopy
ifeq ($(HOST),mingw32-linux) ifeq ($(HOST),mingw32-linux)
EXEPREFIX = ./ export EXEPREFIX = ./
EXEPOSTFIX = ifeq ($(OSTYPE),msys)
SEP = / export EXEPOSTFIX = .exe
else
export EXEPOSTFIX =
endif
export SEP = /
mkdir = -$(Q)mkdir -p mkdir = -$(Q)mkdir -p
gcc = $(Q)$(PREFIX)-gcc gcc = $(Q)$(PREFIX)-gcc
gpp = $(Q)$(PREFIX)-g++ gpp = $(Q)$(PREFIX)-g++
@ -224,10 +232,29 @@ ifeq ($(HOST),mingw32-linux)
cp = $(Q)cp cp = $(Q)cp
NUL = /dev/null NUL = /dev/null
else # mingw32-windows else # mingw32-windows
EXEPREFIX = ifeq ($(OSTYPE),msys)
EXEPOSTFIX = .exe 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 = ROS_EMPTY =
SEP = \$(ROS_EMPTY) export SEP = \$(ROS_EMPTY)
mkdir = -$(Q)mkdir mkdir = -$(Q)mkdir
gcc = $(Q)gcc gcc = $(Q)gcc
gpp = $(Q)g++ gpp = $(Q)g++
@ -241,6 +268,7 @@ else # mingw32-windows
rm = $(Q)del /f /q rm = $(Q)del /f /q
cp = $(Q)copy /y cp = $(Q)copy /y
NUL = NUL NUL = NUL
endif
endif endif
ifneq ($(ROS_INTERMEDIATE),) ifneq ($(ROS_INTERMEDIATE),)

View file

@ -37,8 +37,12 @@
#if defined(WIN32) #if defined(WIN32)
#define DIR_SEPARATOR "\\" #define DIR_SEPARATOR "\\"
#define C_SEP '\\'
#define C_BAD_SEP '/'
#else #else
#define DIR_SEPARATOR "/" #define DIR_SEPARATOR "/"
#define C_SEP '/'
#define C_BAD_SEP '\\'
#endif #endif
extern int mkstemps(char *template, int suffix_len); extern int mkstemps(char *template, int suffix_len);
@ -275,6 +279,22 @@ int process_resources(const char* input_file_name, const char* specific_file_nam
return c == EOF; 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 main(int argc, char **argv)
{ {
int convert_dir = 0, optc; int convert_dir = 0, optc;
@ -295,14 +315,14 @@ int main(int argc, char **argv)
case 'i': case 'i':
case 'o': case 'o':
if (specific_file_name) usage(); if (specific_file_name) usage();
specific_file_name = optarg; specific_file_name = fix_path_sep(optarg);
optc = ((optc == 'i') ? 'a' : 'x'); optc = ((optc == 'i') ? 'a' : 'x');
if (convert_dir && convert_dir != optc) usage(); if (convert_dir && convert_dir != optc) usage();
convert_dir = optc; convert_dir = optc;
break; break;
case 'b': case 'b':
if (relative_path) usage(); if (relative_path) usage();
relative_path = optarg; relative_path = fix_path_sep(optarg);
break; break;
case 'f': case 'f':
force_overwrite = 1; force_overwrite = 1;
@ -320,7 +340,7 @@ int main(int argc, char **argv)
} }
if (optind + 1 != argc) usage(); if (optind + 1 != argc) usage();
input_file_name = argv[optind]; input_file_name = fix_path_sep(argv[optind]);
if (!convert_dir) usage(); if (!convert_dir) usage();

View file

@ -46,7 +46,7 @@ SourceFile::SourceFile ( AutomaticDependency* automaticDependency,
void void
SourceFile::GetDirectoryAndFilenameParts () SourceFile::GetDirectoryAndFilenameParts ()
{ {
size_t index = filename.find_last_of ( CSEP ); size_t index = filename.find_last_of ( cSep );
if ( index != string::npos ) if ( index != string::npos )
{ {
directoryPart = filename.substr ( 0, index ); directoryPart = filename.substr ( 0, index );
@ -347,7 +347,7 @@ AutomaticDependency::LocateIncludedFile ( const string& directory,
const string& includedFilename, const string& includedFilename,
string& resolvedFilename ) string& resolvedFilename )
{ {
string normalizedFilename = NormalizeFilename ( directory + SSEP + includedFilename ); string normalizedFilename = NormalizeFilename ( directory + sSep + includedFilename );
FILE* f = fopen ( normalizedFilename.c_str (), "rb" ); FILE* f = fopen ( normalizedFilename.c_str (), "rb" );
if ( f != NULL ) if ( f != NULL )
{ {
@ -362,7 +362,7 @@ AutomaticDependency::LocateIncludedFile ( const string& directory,
string string
AutomaticDependency::GetFilename ( const string& filename ) 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) if (index == string::npos)
return filename; return filename;
else else

View file

@ -119,17 +119,17 @@ Directory::CreateDirectory ( string path )
{ {
size_t index = 0; size_t index = 0;
size_t nextIndex; 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 else
nextIndex = path.find ( CSEP ); nextIndex = path.find ( cSep );
bool directoryWasCreated = false; bool directoryWasCreated = false;
while ( nextIndex != string::npos ) 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 () ); directoryWasCreated = mkdir_p ( path.substr ( 0, nextIndex ).c_str () );
index = nextIndex; index = nextIndex;
} }
@ -168,7 +168,7 @@ Directory::GenerateTree ( const string& parent,
{ {
char buf[256]; char buf[256];
path = parent + SSEP + name; path = parent + sSep + name;
ResolveVariablesInPath ( buf, path ); ResolveVariablesInPath ( buf, path );
if ( CreateDirectory ( buf ) && verbose ) if ( CreateDirectory ( buf ) && verbose )
printf ( "Created %s\n", buf ); printf ( "Created %s\n", buf );
@ -212,7 +212,7 @@ Directory::CreateRule ( FILE* f,
fprintf ( f, fprintf ( f,
"%s%c%s: | %s\n", "%s%c%s: | %s\n",
escapedParent.c_str (), escapedParent.c_str (),
CSEP, cSep,
EscapeSpaces ( name ).c_str (), EscapeSpaces ( name ).c_str (),
escapedParent.c_str () ); escapedParent.c_str () );
@ -222,7 +222,7 @@ Directory::CreateRule ( FILE* f,
fprintf ( f, fprintf ( f,
"\t${mkdir} $@\n" ); "\t${mkdir} $@\n" );
path = parent + SSEP + name; path = parent + sSep + name;
} }
else else
path = name; path = name;
@ -687,7 +687,7 @@ MingwBackend::GenerateXmlBuildFilesMacro() const
string string
MingwBackend::GetBin2ResExecutable () MingwBackend::GetBin2ResExecutable ()
{ {
return NormalizeFilename ( Environment::GetOutputPath () + SSEP + "tools/bin2res/bin2res" + EXEPOSTFIX ); return NormalizeFilename ( Environment::GetOutputPath () + sSep + "tools/bin2res/bin2res" + ExePostfix );
} }
void void
@ -743,7 +743,7 @@ MingwBackend::CheckAutomaticDependencies ()
bool bool
MingwBackend::IncludeDirectoryTarget ( const string& directory ) const MingwBackend::IncludeDirectoryTarget ( const string& directory ) const
{ {
if ( directory == "$(INTERMEDIATE)" SSEP "tools") if ( directory == "$(INTERMEDIATE)" + sSep + "tools")
return false; return false;
else else
return true; return true;
@ -765,7 +765,7 @@ MingwBackend::TryToDetectThisCompiler ( const string& compiler )
{ {
string command = ssprintf ( string command = ssprintf (
"%s -v 1>%s 2>%s", "%s -v 1>%s 2>%s",
compiler.c_str (), FixSeparatorForSystemCommand(compiler).c_str (),
NUL, NUL,
NUL ); NUL );
int exitcode = system ( command.c_str () ); int exitcode = system ( command.c_str () );
@ -810,7 +810,7 @@ MingwBackend::TryToDetectThisNetwideAssembler ( const string& assembler )
{ {
string command = ssprintf ( string command = ssprintf (
"%s -h 1>%s 2>%s", "%s -h 1>%s 2>%s",
assembler.c_str (), FixSeparatorForSystemCommand(assembler).c_str (),
NUL, NUL,
NUL ); NUL );
int exitcode = system ( command.c_str () ); int exitcode = system ( command.c_str () );
@ -822,7 +822,7 @@ MingwBackend::TryToDetectThisBinutils ( const string& binutils )
{ {
string command = ssprintf ( string command = ssprintf (
"%s -v 1>%s", "%s -v 1>%s",
binutils.c_str (), FixSeparatorForSystemCommand(binutils).c_str (),
NUL, NUL,
NUL ); NUL );
int exitcode = system ( command.c_str () ); int exitcode = system ( command.c_str () );
@ -955,12 +955,12 @@ MingwBackend::DetectPipeSupport ()
{ {
printf ( "Detecting compiler -pipe support..." ); 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, string pipe_detectionObjectFilename = ReplaceExtension ( pipe_detection,
".o" ); ".o" );
string command = ssprintf ( string command = ssprintf (
"%s -pipe -c %s -o %s 1>%s 2>%s", "%s -pipe -c %s -o %s 1>%s 2>%s",
compilerCommand.c_str (), FixSeparatorForSystemCommand(compilerCommand).c_str (),
pipe_detection.c_str (), pipe_detection.c_str (),
pipe_detectionObjectFilename.c_str (), pipe_detectionObjectFilename.c_str (),
NUL, NUL,
@ -987,10 +987,10 @@ MingwBackend::DetectPCHSupport ()
{ {
printf ( "Detecting compiler pre-compiled header support..." ); 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 ( string cmd = ssprintf (
"%s -c %s 1>%s 2>%s", "%s -c %s 1>%s 2>%s",
compilerCommand.c_str (), FixSeparatorForSystemCommand(compilerCommand).c_str (),
path.c_str (), path.c_str (),
NUL, NUL,
NUL ); NUL );
@ -1020,7 +1020,7 @@ MingwBackend::GetNonModuleInstallTargetFiles (
for ( size_t i = 0; i < ProjectNode.installfiles.size (); i++ ) for ( size_t i = 0; i < ProjectNode.installfiles.size (); i++ )
{ {
const InstallFile& installfile = *ProjectNode.installfiles[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 ( string targetFilename = MingwModuleHandler::PassThruCacheDirectory (
NormalizeFilename ( targetFilenameNoFixup ), NormalizeFilename ( targetFilenameNoFixup ),
installDirectory ); installDirectory );
@ -1041,7 +1041,7 @@ MingwBackend::GetModuleInstallTargetFiles (
{ {
string targetFilenameNoFixup; string targetFilenameNoFixup;
if ( module.installBase.length () > 0 ) if ( module.installBase.length () > 0 )
targetFilenameNoFixup = module.installBase + SSEP + module.installName; targetFilenameNoFixup = module.installBase + sSep + module.installName;
else else
targetFilenameNoFixup = module.installName; targetFilenameNoFixup = module.installName;
string targetFilename = MingwModuleHandler::PassThruCacheDirectory ( string targetFilename = MingwModuleHandler::PassThruCacheDirectory (
@ -1067,7 +1067,7 @@ MingwBackend::OutputInstallTarget ( const string& sourceFilename,
{ {
string fullTargetFilename; string fullTargetFilename;
if ( targetDirectory.length () > 0) if ( targetDirectory.length () > 0)
fullTargetFilename = targetDirectory + SSEP + targetFilename; fullTargetFilename = targetDirectory + sSep + targetFilename;
else else
fullTargetFilename = targetFilename; fullTargetFilename = targetFilename;
string normalizedTargetFilename = MingwModuleHandler::PassThruCacheDirectory ( string normalizedTargetFilename = MingwModuleHandler::PassThruCacheDirectory (
@ -1138,11 +1138,11 @@ MingwBackend::OutputModuleInstallTargets ()
string string
MingwBackend::GetRegistrySourceFiles () MingwBackend::GetRegistrySourceFiles ()
{ {
return "bootdata" SSEP "hivecls.inf " return "bootdata" + sSep + "hivecls.inf "
"bootdata" SSEP "hivedef.inf " "bootdata" + sSep + "hivedef.inf "
"bootdata" SSEP "hiveinst.inf " "bootdata" + sSep + "hiveinst.inf "
"bootdata" SSEP "hivesft.inf " "bootdata" + sSep + "hivesft.inf "
"bootdata" SSEP "hivesys.inf"; "bootdata" + sSep + "hivesys.inf";
} }
string string
@ -1150,13 +1150,13 @@ MingwBackend::GetRegistryTargetFiles ()
{ {
string system32ConfigDirectory = NormalizeFilename ( string system32ConfigDirectory = NormalizeFilename (
MingwModuleHandler::PassThruCacheDirectory ( MingwModuleHandler::PassThruCacheDirectory (
"system32" SSEP "config" SSEP, "system32" + sSep + "config" + sSep,
installDirectory ) ); installDirectory ) );
return system32ConfigDirectory + SSEP "default " + return system32ConfigDirectory + sSep + "default " +
system32ConfigDirectory + SSEP "sam " + system32ConfigDirectory + sSep + "sam " +
system32ConfigDirectory + SSEP "security " + system32ConfigDirectory + sSep + "security " +
system32ConfigDirectory + SSEP "software " + system32ConfigDirectory + sSep + "software " +
system32ConfigDirectory + SSEP "system"; system32ConfigDirectory + sSep + "system";
} }
void void
@ -1164,7 +1164,7 @@ MingwBackend::OutputRegistryInstallTarget ()
{ {
string system32ConfigDirectory = NormalizeFilename ( string system32ConfigDirectory = NormalizeFilename (
MingwModuleHandler::PassThruCacheDirectory ( MingwModuleHandler::PassThruCacheDirectory (
"system32" SSEP "config" SSEP, "system32" + sSep + "config" + sSep,
installDirectory ) ); installDirectory ) );
string registrySourceFiles = GetRegistrySourceFiles (); string registrySourceFiles = GetRegistrySourceFiles ();
@ -1180,8 +1180,9 @@ MingwBackend::OutputRegistryInstallTarget ()
fprintf ( fMakefile, fprintf ( fMakefile,
"\t$(ECHO_MKHIVE)\n" ); "\t$(ECHO_MKHIVE)\n" );
fprintf ( fMakefile, fprintf ( fMakefile,
"\t$(MKHIVE_TARGET) bootdata %s bootdata" SSEP "hiveinst.inf\n", "\t$(MKHIVE_TARGET) bootdata %s bootdata%chiveinst.inf\n",
system32ConfigDirectory.c_str () ); system32ConfigDirectory.c_str (),
cSep );
fprintf ( fMakefile, fprintf ( fMakefile,
"\n" ); "\n" );
} }

View file

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

View file

@ -62,7 +62,7 @@ ProxyMakefile::GeneratePathToParentDirectory ( int numberOfParentDirectories )
for ( int i = 0; i < numberOfParentDirectories; i++ ) for ( int i = 0; i < numberOfParentDirectories; i++ )
{ {
if ( path != "" ) if ( path != "" )
path += SSEP; path += sSep;
path += ".."; path += "..";
} }
return path; return path;
@ -75,7 +75,7 @@ ProxyMakefile::GetPathToTopDirectory ( Module& module )
string basePath = NormalizeFilename ( module.GetBasePath () ); string basePath = NormalizeFilename ( module.GetBasePath () );
for ( size_t i = 0; i < basePath.length (); i++ ) for ( size_t i = 0; i < basePath.length (); i++ )
{ {
if ( basePath[i] == CSEP ) if ( basePath[i] == cSep )
numberOfDirectories++; numberOfDirectories++;
} }
return GeneratePathToParentDirectory ( numberOfDirectories ); return GeneratePathToParentDirectory ( numberOfDirectories );
@ -99,7 +99,7 @@ ProxyMakefile::GenerateProxyMakefileForModule ( Module& module,
string pathToTopDirectory; string pathToTopDirectory;
if ( outputTree.length () > 0 ) if ( outputTree.length () > 0 )
{ {
base = outputTree + SSEP + module.GetBasePath (); base = outputTree + sSep + module.GetBasePath ();
Path path; Path path;
pathToTopDirectory = working_directory; pathToTopDirectory = working_directory;
} }
@ -108,7 +108,7 @@ ProxyMakefile::GenerateProxyMakefileForModule ( Module& module,
base = module.GetBasePath (); base = module.GetBasePath ();
pathToTopDirectory = GetPathToTopDirectory ( module ); pathToTopDirectory = GetPathToTopDirectory ( module );
} }
string proxyMakefile = NormalizeFilename ( base + SSEP "GNUmakefile" ); string proxyMakefile = NormalizeFilename ( base + sSep + "GNUmakefile" );
string defaultTarget = module.name; string defaultTarget = module.name;
buf = (char*) malloc ( 10*1024 ); buf = (char*) malloc ( 10*1024 );

View file

@ -50,7 +50,7 @@ CDFile::~CDFile ()
string string
CDFile::GetPath () const CDFile::GetPath () const
{ {
return path + SSEP + name; return path + sSep + name;
} }
void void

View file

@ -50,7 +50,7 @@ Include::Include ( const Project& project,
node ( NULL ), node ( NULL ),
baseModule ( NULL ) baseModule ( NULL )
{ {
this->directory = NormalizeFilename ( basePath + SSEP + directory ); this->directory = NormalizeFilename ( basePath + sSep + directory );
this->basePath = NormalizeFilename ( basePath ); this->basePath = NormalizeFilename ( basePath );
} }
@ -91,7 +91,7 @@ Include::ProcessXML()
node->location, node->location,
"<include> attribute 'base' references non-existant project or module '%s'", "<include> attribute 'base' references non-existant project or module '%s'",
att->value.c_str() ); att->value.c_str() );
directory = NormalizeFilename ( basePath + SSEP + node->value ); directory = NormalizeFilename ( basePath + sSep + node->value );
} }
else else
directory = NormalizeFilename ( node->value ); directory = NormalizeFilename ( node->value );

View file

@ -50,7 +50,7 @@ InstallFile::~InstallFile ()
string string
InstallFile::GetPath () const InstallFile::GetPath () const
{ {
return path + SSEP + name; return path + sSep + name;
} }
void void

View file

@ -66,7 +66,7 @@ LinkerScript::ProcessXML()
node.location, node.location,
"<linkerscript> attribute 'base' references non-existant project or module '%s'", "<linkerscript> attribute 'base' references non-existant project or module '%s'",
att->value.c_str() ); att->value.c_str() );
directory = NormalizeFilename ( basePath + SSEP + node.value ); directory = NormalizeFilename ( basePath + sSep + node.value );
} }
else else
directory = NormalizeFilename ( node.value ); directory = NormalizeFilename ( node.value );

View file

@ -55,11 +55,24 @@ string
FixSeparator ( const string& s ) FixSeparator ( const string& s )
{ {
string s2(s); string s2(s);
char* p = strchr ( &s2[0], CBAD_SEP ); char* p = strchr ( &s2[0], cBadSep );
while ( p ) while ( p )
{ {
*p++ = CSEP; *p++ = cSep;
p = strchr ( p, CBAD_SEP ); 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; return s2;
} }
@ -111,7 +124,7 @@ GetSubPath (
"<directory> tag has invalid characters in 'name' attribute" ); "<directory> tag has invalid characters in 'name' attribute" );
if ( !path.size() ) if ( !path.size() )
return att_value; return att_value;
return FixSeparator(path + CSEP + att_value); return FixSeparator(path + cSep + att_value);
} }
string string
@ -129,7 +142,7 @@ GetExtension ( const string& filename )
string string
GetDirectory ( const string& filename ) GetDirectory ( const string& filename )
{ {
size_t index = filename.find_last_of ( CSEP ); size_t index = filename.find_last_of ( cSep );
if ( index == string::npos ) if ( index == string::npos )
return ""; return "";
else else
@ -139,7 +152,7 @@ GetDirectory ( const string& filename )
string string
GetFilename ( const string& filename ) GetFilename ( const string& filename )
{ {
size_t index = filename.find_last_of ( CSEP ); size_t index = filename.find_last_of ( cSep );
if ( index == string::npos ) if ( index == string::npos )
return filename; return filename;
else else
@ -453,7 +466,7 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
else if ( !stricmp ( ext.c_str(), ".cxx" ) ) else if ( !stricmp ( ext.c_str(), ".cxx" ) )
cplusplus = true; cplusplus = true;
} }
File* pFile = new File ( FixSeparator ( path + CSEP + e.value ), File* pFile = new File ( FixSeparator ( path + cSep + e.value ),
first, first,
switches, switches,
false ); false );
@ -597,7 +610,7 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
e.location, e.location,
"Only one <pch> is valid per module" ); "Only one <pch> is valid per module" );
pch = new PchFile ( 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; subs_invalid = true;
} }
if ( subs_invalid && e.subElements.size() > 0 ) if ( subs_invalid && e.subElements.size() > 0 )
@ -661,7 +674,7 @@ Module::GetDefaultModuleExtension () const
switch (type) switch (type)
{ {
case BuildTool: case BuildTool:
return EXEPOSTFIX; return ExePostfix;
case StaticLibrary: case StaticLibrary:
return ".a"; return ".a";
case ObjectLibrary: case ObjectLibrary:
@ -868,7 +881,7 @@ string
Module::GetPath () const Module::GetPath () const
{ {
if ( path.length() > 0 ) if ( path.length() > 0 )
return path + CSEP + GetTargetName (); return path + cSep + GetTargetName ();
else else
return GetTargetName (); return GetTargetName ();
} }
@ -876,7 +889,7 @@ Module::GetPath () const
string string
Module::GetPathWithPrefix ( const string& prefix ) const Module::GetPathWithPrefix ( const string& prefix ) const
{ {
return path + CSEP + prefix + GetTargetName (); return path + cSep + prefix + GetTargetName ();
} }
string string
@ -914,7 +927,7 @@ Module::InvokeModule () const
for ( size_t i = 0; i < invocations.size (); i++ ) for ( size_t i = 0; i < invocations.size (); i++ )
{ {
Invoke& invoke = *invocations[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 () ); printf ( "Executing '%s'\n\n", command.c_str () );
int exitcode = system ( command.c_str () ); int exitcode = system ( command.c_str () );
if ( exitcode != 0 ) if ( exitcode != 0 )
@ -1034,7 +1047,7 @@ Invoke::ProcessXMLSubElementInput ( const XMLElement& e )
bool subs_invalid = false; bool subs_invalid = false;
if ( e.name == "inputfile" && e.value.size () > 0 ) 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; subs_invalid = true;
} }
if ( subs_invalid && e.subElements.size() > 0 ) if ( subs_invalid && e.subElements.size() > 0 )
@ -1049,7 +1062,7 @@ Invoke::ProcessXMLSubElementOutput ( const XMLElement& e )
bool subs_invalid = false; bool subs_invalid = false;
if ( e.name == "outputfile" && e.value.size () > 0 ) 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; subs_invalid = true;
} }
if ( subs_invalid && e.subElements.size() > 0 ) if ( subs_invalid && e.subElements.size() > 0 )

View file

@ -198,7 +198,7 @@ Project::WriteConfigurationFile ()
s = s + sprintf ( s, "#endif /* __INCLUDE_CONFIG_H */\n" ); 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 ); free ( buf );
} }

View file

@ -35,6 +35,13 @@ static string BuildSystem;
static string RootXmlFile = "ReactOS.xml"; static string RootXmlFile = "ReactOS.xml";
static Configuration configuration; static Configuration configuration;
string ExePrefix;
string ExePostfix;
string sSep;
string sBadSep;
char cSep;
char cBadSep;
bool bool
ParseAutomaticDependencySwitch ( char switchChar2, ParseAutomaticDependencySwitch ( char switchChar2,
char* switchStart ) char* switchStart )
@ -186,6 +193,43 @@ ParseArguments ( int argc, char** argv )
int int
main ( int argc, char** argv ) 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 ) ) if ( !ParseArguments ( argc, argv ) )
{ {
printf ( "Generates project files for buildsystems\n\n" ); printf ( "Generates project files for buildsystems\n\n" );

View file

@ -41,20 +41,27 @@
typedef std::vector<std::string> string_list; 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 #ifdef WIN32
#define EXEPREFIX "" #define DEF_EXEPREFIX ""
#define EXEPOSTFIX ".exe" #define DEF_EXEPOSTFIX ".exe"
#define CSEP '\\' #define DEF_CSEP '\\'
#define CBAD_SEP '/' #define DEF_CBAD_SEP '/'
#define SSEP "\\" #define DEF_SSEP "\\"
#define SBAD_SEP "/" #define DEF_SBAD_SEP "/"
#else #else
#define EXEPREFIX "./" #define DEF_EXEPREFIX "./"
#define EXEPOSTFIX "" #define DEF_EXEPOSTFIX ""
#define CSEP '/' #define DEF_CSEP '/'
#define CBAD_SEP '\\' #define DEF_CBAD_SEP '\\'
#define SSEP "/" #define DEF_SSEP "/"
#define SBAD_SEP "\\" #define DEF_SBAD_SEP "\\"
#endif #endif
#define MS_VS_DEF_VERSION "7.10" #define MS_VS_DEF_VERSION "7.10"
@ -773,6 +780,9 @@ Replace ( const std::string& s, const std::string& find, const std::string& with
extern std::string extern std::string
FixSeparator ( const std::string& s ); FixSeparator ( const std::string& s );
extern std::string
FixSeparatorForSystemCommand ( const std::string& s );
extern std::string extern std::string
DosSeparator ( const std::string& s ); DosSeparator ( const std::string& s );

View file

@ -69,7 +69,7 @@ TestSupportCode::GenerateTestSupportCodeForModule ( Module& module,
string string
TestSupportCode::GetHooksFilename ( Module& module ) TestSupportCode::GetHooksFilename ( Module& module )
{ {
return NormalizeFilename ( Environment::GetIntermediatePath () + SSEP + module.GetBasePath () + SSEP + "_hooks.c" ); return NormalizeFilename ( Environment::GetIntermediatePath () + sSep + module.GetBasePath () + sSep + "_hooks.c" );
} }
char* char*
@ -135,7 +135,7 @@ TestSupportCode::WriteHooksFile ( Module& module )
string string
TestSupportCode::GetStubsFilename ( Module& module ) TestSupportCode::GetStubsFilename ( Module& module )
{ {
return NormalizeFilename ( Environment::GetIntermediatePath () + SSEP + module.GetBasePath () + SSEP + "_stubs.S" ); return NormalizeFilename ( Environment::GetIntermediatePath () + sSep + module.GetBasePath () + sSep + "_stubs.S" );
} }
string string
@ -226,7 +226,7 @@ TestSupportCode::WriteStubsFile ( Module& module )
string string
TestSupportCode::GetStartupFilename ( Module& module ) TestSupportCode::GetStartupFilename ( Module& module )
{ {
return NormalizeFilename ( Environment::GetIntermediatePath () + SSEP + module.GetBasePath () + SSEP + "_startup.c" ); return NormalizeFilename ( Environment::GetIntermediatePath () + sSep + module.GetBasePath () + sSep + "_startup.c" );
} }
bool bool

View file

@ -104,10 +104,10 @@ WineResource::UnpackResourcesInModule ( Module& module,
} }
string outputDirectory = module.GetBasePath (); string outputDirectory = module.GetBasePath ();
string parameters = ssprintf ( "-b %s -f -x %s", string parameters = ssprintf ( "-b %s -f -x %s",
NormalizeFilename ( outputDirectory ).c_str (), NormalizeFilename ( outputDirectory ).c_str (),
NormalizeFilename ( resourceFilename ).c_str () ); NormalizeFilename ( resourceFilename ).c_str () );
string command = bin2res + " " + parameters; string command = FixSeparatorForSystemCommand(bin2res) + " " + parameters;
int exitcode = system ( command.c_str () ); int exitcode = system ( command.c_str () );
if ( exitcode != 0 ) if ( exitcode != 0 )
{ {