msvc6 compatibility

svn path=/branches/xmlbuildsystem/; revision=13124
This commit is contained in:
Royce Mitchell III 2005-01-18 17:00:47 +00:00
parent 9b92b2cc9a
commit 6f056ee7ce

View file

@ -10,9 +10,11 @@ using std::vector;
using std::map; using std::map;
using std::set; using std::set;
typedef set<string> set_string;
map<ModuleType,MingwModuleHandler*>* map<ModuleType,MingwModuleHandler*>*
MingwModuleHandler::handler_map = NULL; MingwModuleHandler::handler_map = NULL;
set<string> set_string
MingwModuleHandler::directory_set; MingwModuleHandler::directory_set;
int int
MingwModuleHandler::ref = 0; MingwModuleHandler::ref = 0;
@ -74,8 +76,10 @@ string
MingwModuleHandler::GetDirectory ( const string& filename ) const MingwModuleHandler::GetDirectory ( const string& filename ) const
{ {
size_t index = filename.find_last_of ( '/' ); size_t index = filename.find_last_of ( '/' );
if (index == string::npos) return "."; if (index == string::npos)
else return filename.substr ( 0, index ); return ".";
else
return filename.substr ( 0, index );
} }
string string
@ -218,9 +222,9 @@ MingwModuleHandler::GetObjectFilename ( const string& sourceFilename ) const
newExtension = ".stubs.o"; newExtension = ".stubs.o";
else else
newExtension = ".o"; newExtension = ".o";
return PassThruCacheDirectory return PassThruCacheDirectory (
( FixupTargetFilename ( ReplaceExtension ( sourceFilename, FixupTargetFilename (
newExtension ) ) ); ReplaceExtension ( sourceFilename, newExtension ) ) );
} }
string string
@ -242,19 +246,24 @@ MingwModuleHandler::GetObjectFilenames ( const Module& module ) const
void void
MingwModuleHandler::GenerateDirectoryTargets() const MingwModuleHandler::GenerateDirectoryTargets() const
{ {
set_string::iterator i;
fprintf( fMakefile, "ifneq ($(ROS_INTERMEDIATE),)\ndirectories::" ); fprintf( fMakefile, "ifneq ($(ROS_INTERMEDIATE),)\ndirectories::" );
for( set<string>::iterator i = directory_set.begin(); for ( i = directory_set.begin();
i != directory_set.end(); i != directory_set.end();
i++ ) i++ )
fprintf( fMakefile, " %s", i->c_str() ); {
fprintf ( fMakefile, " %s", i->c_str() );
}
fprintf( fMakefile, "\n\n" ); fprintf( fMakefile, "\n\n" );
for( set<string>::iterator i = directory_set.begin(); for ( i = directory_set.begin();
i != directory_set.end(); i != directory_set.end();
i++ ) i++ )
fprintf( fMakefile, "%s ", i->c_str() ); {
fprintf ( fMakefile, "%s ", i->c_str() );
}
fprintf ( fMakefile, fprintf ( fMakefile,
"::\n\t${mkdir} $@\n\n" "::\n\t${mkdir} $@\n\n"
@ -269,7 +278,7 @@ string
MingwModuleHandler::GenerateGccDefineParametersFromVector ( const vector<Define*>& defines ) const MingwModuleHandler::GenerateGccDefineParametersFromVector ( const vector<Define*>& defines ) const
{ {
string parameters; string parameters;
for (size_t i = 0; i < defines.size (); i++) for ( size_t i = 0; i < defines.size (); i++ )
{ {
Define& define = *defines[i]; Define& define = *defines[i];
if (parameters.length () > 0) if (parameters.length () > 0)
@ -290,7 +299,7 @@ MingwModuleHandler::GenerateGccDefineParameters ( const Module& module ) const
{ {
string parameters = GenerateGccDefineParametersFromVector ( module.project.defines ); string parameters = GenerateGccDefineParametersFromVector ( module.project.defines );
string s = GenerateGccDefineParametersFromVector ( module.defines ); string s = GenerateGccDefineParametersFromVector ( module.defines );
if (s.length () > 0) if ( s.length () > 0 )
{ {
parameters += " "; parameters += " ";
parameters += s; parameters += s;
@ -717,7 +726,7 @@ MingwModuleHandler::GenerateLinkerCommand ( const Module& module,
"\t${dlltool} --dllname %s --base-file %s --def %s --output-exp %s --kill-at\n", "\t${dlltool} --dllname %s --base-file %s --def %s --output-exp %s --kill-at\n",
targetName.c_str (), targetName.c_str (),
base_tmp.c_str (), base_tmp.c_str (),
(module.GetBasePath () + SSEP + module.importLibrary->definition ).c_str (), ( module.GetBasePath () + SSEP + module.importLibrary->definition ).c_str (),
temp_exp.c_str () ); temp_exp.c_str () );
fprintf ( fMakefile, fprintf ( fMakefile,
@ -776,6 +785,7 @@ MingwModuleHandler::GenerateObjectFileTargets ( const Module& module,
} }
for ( i = 0; i < ifs.size(); i++ ) for ( i = 0; i < ifs.size(); i++ )
{
GenerateObjectFileTargets ( module, GenerateObjectFileTargets ( module,
ifs[i]->files, ifs[i]->files,
ifs[i]->ifs, ifs[i]->ifs,
@ -783,6 +793,7 @@ MingwModuleHandler::GenerateObjectFileTargets ( const Module& module,
cflagsMacro, cflagsMacro,
nasmflagsMacro, nasmflagsMacro,
windresflagsMacro ); windresflagsMacro );
}
} }
void void
@ -1002,8 +1013,10 @@ MingwModuleHandler::GenerateInvocations ( const Module& module ) const
const Invoke& invoke = *module.invocations[i]; const Invoke& invoke = *module.invocations[i];
if ( invoke.invokeModule->type != BuildTool ) if ( invoke.invokeModule->type != BuildTool )
{
throw InvalidBuildFileException ( module.node.location, throw InvalidBuildFileException ( module.node.location,
"Only modules of type buildtool can be invoked." ); "Only modules of type buildtool can be invoked." );
}
string invokeTarget = module.GetInvocationTarget ( i ); string invokeTarget = module.GetInvocationTarget ( i );
fprintf ( fMakefile, fprintf ( fMakefile,
@ -1091,7 +1104,7 @@ MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ( const Module& module )
fprintf ( fMakefile, fprintf ( fMakefile,
"\t${dlltool} --dllname %s --def %s --output-lib %s --kill-at\n\n", "\t${dlltool} --dllname %s --def %s --output-lib %s --kill-at\n\n",
module.GetTargetName ().c_str (), module.GetTargetName ().c_str (),
(module.GetBasePath () + SSEP + module.importLibrary->definition).c_str (), ( module.GetBasePath () + SSEP + module.importLibrary->definition ).c_str (),
FixupTargetFilename ( module.GetDependencyPath () ).c_str () ); FixupTargetFilename ( module.GetDependencyPath () ).c_str () );
} }
} }