use ROS_TEMPORARY and ROS_INTERMEDIATE to allow builder to override locations for created files. Fix name conflict with temporary files

svn path=/branches/xmlbuildsystem/; revision=12882
This commit is contained in:
Royce Mitchell III 2005-01-08 06:36:03 +00:00
parent 2f837bf69e
commit 3e6eb979d8
4 changed files with 38 additions and 22 deletions

View file

@ -78,7 +78,7 @@ MingwBackend::GenerateAllTarget ()
Module& module = *ProjectNode.modules[i]; Module& module = *ProjectNode.modules[i];
fprintf ( fMakefile, fprintf ( fMakefile,
" %s", " %s",
module.GetPath ().c_str () ); FixupTargetFilename(module.GetPath ()).c_str () );
} }
fprintf ( fMakefile, "\n\t\n\n" ); fprintf ( fMakefile, "\n\t\n\n" );
} }
@ -105,3 +105,9 @@ MingwBackend::GetModuleHandlers ( MingwModuleHandlerList& moduleHandlers ) const
moduleHandlers.push_back ( new MingwKernelModuleHandler ( fMakefile ) ); moduleHandlers.push_back ( new MingwKernelModuleHandler ( fMakefile ) );
moduleHandlers.push_back ( new MingwStaticLibraryModuleHandler ( fMakefile ) ); moduleHandlers.push_back ( new MingwStaticLibraryModuleHandler ( fMakefile ) );
} }
string
FixupTargetFilename ( const string& targetFilename )
{
return string("$(ROS_INTERMEDIATE)") + targetFilename;
}

View file

@ -40,4 +40,6 @@ private:
FILE* fMakefile; FILE* fMakefile;
}; };
std::string FixupTargetFilename ( const std::string& targetFilename );
#endif /* MINGW_H */ #endif /* MINGW_H */

View file

@ -33,7 +33,7 @@ MingwModuleHandler::ReplaceExtension ( const string& filename,
string string
MingwModuleHandler::GetModuleArchiveFilename ( const Module& module ) const MingwModuleHandler::GetModuleArchiveFilename ( const Module& module ) const
{ {
return ReplaceExtension ( module.GetPath ().c_str (), return ReplaceExtension ( FixupTargetFilename(module.GetPath ()).c_str (),
".a" ); ".a" );
} }
@ -50,7 +50,7 @@ MingwModuleHandler::GetImportLibraryDependencies ( const Module& module ) const
dependencies += " "; dependencies += " ";
const Module* importedModule = module.project.LocateModule ( module.libraries[i]->name ); const Module* importedModule = module.project.LocateModule ( module.libraries[i]->name );
assert ( importedModule != NULL ); assert ( importedModule != NULL );
dependencies += importedModule->GetPath ().c_str (); dependencies += FixupTargetFilename(importedModule->GetPath ()).c_str ();
} }
return dependencies; return dependencies;
} }
@ -74,8 +74,9 @@ MingwModuleHandler::GetSourceFilenames ( const Module& module ) const
string string
MingwModuleHandler::GetObjectFilename ( const string& sourceFilename ) const MingwModuleHandler::GetObjectFilename ( const string& sourceFilename ) const
{ {
return ReplaceExtension ( sourceFilename, return
".o" ); FixupTargetFilename ( ReplaceExtension ( sourceFilename,
".o" ) );
} }
string string
@ -242,39 +243,45 @@ MingwKernelModuleHandler::Process ( const Module& module )
void void
MingwKernelModuleHandler::GenerateKernelModuleTarget ( const Module& module ) MingwKernelModuleHandler::GenerateKernelModuleTarget ( const Module& module )
{ {
static string ros_junk ( "$(ROS_TEMPORARY)" );
//static string ros_output ( "$(ROS_INTERMEDIATE)" );
string target ( FixupTargetFilename(module.GetPath()) );
string workingDirectory = GetWorkingDirectory ( ); string workingDirectory = GetWorkingDirectory ( );
string archiveFilename = GetModuleArchiveFilename ( module ); string archiveFilename = GetModuleArchiveFilename ( module );
string importLibraryDependencies = GetImportLibraryDependencies ( module ); string importLibraryDependencies = GetImportLibraryDependencies ( module );
string base_tmp = ros_junk + module.name + ".base.tmp";
string junk_tmp = ros_junk + module.name + ".junk.tmp";
string temp_exp = ros_junk + module.name + ".temp.exp";
fprintf ( fMakefile, "%s: %s %s\n", fprintf ( fMakefile, "%s: %s %s\n",
module.GetPath ().c_str (), target.c_str (),
archiveFilename.c_str (), archiveFilename.c_str (),
importLibraryDependencies.c_str () ); importLibraryDependencies.c_str () );
fprintf ( fMakefile, fprintf ( fMakefile,
"\t${gcc} -Wl,--base-file,%s" SSEP "base.tmp -o %s" SSEP "junk.tmp %s %s\n", "\t${gcc} -Wl,--base-file,%s -o %s %s %s\n",
workingDirectory.c_str (), base_tmp.c_str (),
workingDirectory.c_str (), junk_tmp.c_str (),
archiveFilename.c_str (), archiveFilename.c_str (),
importLibraryDependencies.c_str () ); importLibraryDependencies.c_str () );
fprintf ( fMakefile, fprintf ( fMakefile,
"\t${rm} %s" SSEP "junk.tmp\n", "\t${rm} %s\n",
workingDirectory.c_str () ); junk_tmp.c_str () );
fprintf ( fMakefile, fprintf ( fMakefile,
"\t${dlltool} --dllname %s --base-file %s" SSEP "base.tmp --output-exp %s" SSEP "temp.exp --kill-at\n", "\t${dlltool} --dllname %s --base-file %s --output-exp %s --kill-at\n",
module.GetPath ().c_str (), target.c_str (),
workingDirectory.c_str (), base_tmp.c_str (),
workingDirectory.c_str ()); temp_exp.c_str ());
fprintf ( fMakefile, fprintf ( fMakefile,
"\t${rm} %s" SSEP "base.tmp\n", "\t${rm} %s\n",
workingDirectory.c_str () ); base_tmp.c_str () );
fprintf ( fMakefile, fprintf ( fMakefile,
"\t${ld} -Wl,%s" SSEP "temp.exp -o %s %s %s\n", "\t${ld} -Wl,%s -o %s %s %s\n",
workingDirectory.c_str (), temp_exp.c_str (),
module.GetPath ().c_str (), target.c_str (),
archiveFilename.c_str (), archiveFilename.c_str (),
importLibraryDependencies.c_str () ); importLibraryDependencies.c_str () );
fprintf ( fMakefile, fprintf ( fMakefile,
"\t${rm} %s" SSEP "temp.exp\n", "\t${rm} %s\n",
workingDirectory.c_str () ); temp_exp.c_str () );
GenerateArchiveTarget ( module ); GenerateArchiveTarget ( module );
GenerateObjectFileTargets ( module ); GenerateObjectFileTargets ( module );

View file

@ -16,6 +16,7 @@ protected:
std::string GetModuleArchiveFilename ( const Module& module ) const; std::string GetModuleArchiveFilename ( const Module& module ) const;
std::string GetImportLibraryDependencies ( const Module& module ) const; std::string GetImportLibraryDependencies ( const Module& module ) const;
std::string GetSourceFilenames ( const Module& module ) const; std::string GetSourceFilenames ( const Module& module ) const;
std::string GetObjectFilename ( const std::string& sourceFilename ) const; std::string GetObjectFilename ( const std::string& sourceFilename ) const;
std::string GetObjectFilenames ( const Module& module ) const; std::string GetObjectFilenames ( const Module& module ) const;
void GenerateObjectFileTargets ( const Module& module ) const; void GenerateObjectFileTargets ( const Module& module ) const;