--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-13 04:17:53 UTC (rev 13018)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-13 05:01:22 UTC (rev 13019)
@@ -147,6 +147,9 @@
ProjectNode.defines,
ProjectNode.ifs );
fprintf ( fMakefile, "\n" );
+
+ fprintf ( fMakefile, ".PHONY: clean\n\n" );
+ //fprintf ( fMakefile, "clean:\n\t-@${rm} $(PROJECT_CLEAN)\n\n" );
}
void
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp 2005-01-13 04:17:53 UTC (rev 13018)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp 2005-01-13 05:01:22 UTC (rev 13019)
@@ -139,15 +139,20 @@
string
MingwModuleHandler::GetSourceFilenames ( const Module& module ) const
{
- if ( module.files.size () == 0 )
- return "";
-
+ size_t i;
+
string sourceFilenames ( "" );
- for ( size_t i = 0; i < module.files.size (); i++ )
+ for ( i = 0; i < module.files.size (); i++ )
+ sourceFilenames += " " + module.files[i]->name;
+ vector<If*> ifs = module.ifs;
+ for ( i = 0; i < ifs.size(); i++ )
{
- if ( sourceFilenames.size () > 0 )
- sourceFilenames += " ";
- sourceFilenames += module.files[i]->name;
+ size_t j;
+ If& rIf = *ifs[i];
+ for ( j = 0; j < rIf.ifs.size(); j++ )
+ ifs.push_back ( rIf.ifs[j] );
+ for ( j = 0; j < rIf.files.size(); j++ )
+ sourceFilenames += " " + rIf.files[j]->name;
}
return sourceFilenames;
}
@@ -484,12 +489,25 @@
}
void
+MingwModuleHandler::GetCleanTargets ( vector<string>& out,
+ const vector<File*>& files,
+ const vector<If*>& ifs ) const
+{
+ size_t i;
+
+ for ( i = 0; i < files.size(); i++ )
+ out.push_back ( GetObjectFilename(files[i]->name) );
+
+ for ( i = 0; i < ifs.size(); i++ )
+ GetCleanTargets ( out, ifs[i]->files, ifs[i]->ifs );
+}
+
+string
MingwModuleHandler::GenerateArchiveTarget ( const Module& module,
const string& ar,
const string& objs_macro ) const
{
string archiveFilename = GetModuleArchiveFilename ( module );
- string sourceFilenames = GetSourceFilenames ( module );
fprintf ( fMakefile,
"%s: %s\n",
@@ -501,6 +519,8 @@
ar.c_str (),
archiveFilename.c_str (),
objs_macro.c_str ());
+
+ return archiveFilename;
}
void
@@ -527,8 +547,21 @@
nasmflagsMacro = ssprintf("$(%s)",nasmflagsMacro.c_str());
objectsMacro = ssprintf("$(%s)",objectsMacro.c_str());
- GenerateArchiveTarget ( module, ar, objectsMacro );
+ string ar_target = GenerateArchiveTarget ( module, ar, objectsMacro );
GenerateObjectFileTargets ( module, cc, cflagsMacro, nasmflagsMacro );
+
+ vector<string> clean_files;
+ clean_files.push_back ( ar_target );
+ GetCleanTargets ( clean_files, module.files, module.ifs );
+
+ fprintf ( fMakefile, "clean::\n\t-@$(rm)" );
+ for ( size_t i = 0; i < clean_files.size(); i++ )
+ {
+ if ( 9==(i%10) )
+ fprintf ( fMakefile, " 2>NUL\n\t-@$(rm)" );
+ fprintf ( fMakefile, " %s", clean_files[i].c_str() );
+ }
+ fprintf ( fMakefile, " 2>NUL\n\n" );
}
void
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h 2005-01-13 04:17:53 UTC (rev 13018)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h 2005-01-13 05:01:22 UTC (rev 13019)
@@ -88,9 +88,12 @@
const std::string& cc,
const std::string& cflagsMacro,
const std::string& nasmflagsMacro ) const;
- void GenerateArchiveTarget ( const Module& module,
- const std::string& ar,
- const std::string& objs_macro ) const;
+ void GetCleanTargets ( std::vector<std::string>& out,
+ const std::vector<File*>& files,
+ const std::vector<If*>& ifs ) const;
+ std::string GenerateArchiveTarget ( const Module& module,
+ const std::string& ar,
+ const std::string& objs_macro ) const;
void GenerateMacrosAndTargets ( const Module& module,
const std::string& cc,
const std::string& ar ) const;