Clean referenced object libraries when cleaning a module

svn path=/trunk/; revision=16621
This commit is contained in:
Casper Hornstrup 2005-07-17 15:10:03 +00:00
parent d3d7a7f34b
commit ad59c91e1b
2 changed files with 28 additions and 4 deletions

View file

@ -452,13 +452,35 @@ MingwModuleHandler::GetObjectFilename (
return obj_file; return obj_file;
} }
string
MingwModuleHandler::GetModuleCleanTarget ( const Module& module ) const
{
return module.name + "_clean";
}
void
MingwModuleHandler::GetReferencedObjectLibraryModuleCleanTargets ( vector<string>& moduleNames ) const
{
for ( size_t i = 0; i < module.non_if_data.libraries.size (); i++ )
{
Library& library = *module.non_if_data.libraries[i];
if ( library.importedModule->type == ObjectLibrary )
moduleNames.push_back ( GetModuleCleanTarget ( *library.importedModule ) );
}
}
void void
MingwModuleHandler::GenerateCleanTarget () const MingwModuleHandler::GenerateCleanTarget () const
{ {
if ( 0 == clean_files.size() ) fprintf ( fMakefile,
return; ".PHONY: %s_clean\n",
fprintf ( fMakefile, ".PHONY: %s_clean\n", module.name.c_str() ); module.name.c_str() );
fprintf ( fMakefile, "%s_clean:\n\t-@${rm}", module.name.c_str() ); vector<string> referencedModuleNames;
GetReferencedObjectLibraryModuleCleanTargets ( referencedModuleNames );
fprintf ( fMakefile,
"%s: %s\n\t-@${rm}",
GetModuleCleanTarget ( module ).c_str(),
v2s ( referencedModuleNames, 10 ).c_str () );
for ( size_t i = 0; i < clean_files.size(); i++ ) for ( size_t i = 0; i < clean_files.size(); i++ )
{ {
if ( 9==((i+1)%10) ) if ( 9==((i+1)%10) )

View file

@ -199,6 +199,8 @@ private:
void GetRpcHeaderDependencies ( std::vector<std::string>& dependencies ) const; void GetRpcHeaderDependencies ( std::vector<std::string>& dependencies ) const;
std::string GetRpcServerHeaderFilename ( std::string basename ) const; std::string GetRpcServerHeaderFilename ( std::string basename ) const;
std::string GetRpcClientHeaderFilename ( std::string basename ) const; std::string GetRpcClientHeaderFilename ( std::string basename ) const;
std::string GetModuleCleanTarget ( const Module& module ) const;
void GetReferencedObjectLibraryModuleCleanTargets ( std::vector<std::string>& moduleNames ) const;
public: public:
const Module& module; const Module& module;
string_list clean_files; string_list clean_files;