Clean object files for static libraries
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
Added: branches/xmlbuildsystem/reactos/tools/rsym.mak
Modified: branches/xmlbuildsystem/reactos/tools/tools.mak

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-04-21 21:01:05 UTC (rev 14735)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-04-22 09:19:18 UTC (rev 14736)
@@ -427,6 +427,7 @@
 	GenerateGlobalCFlagsAndProperties (
 		"=",
 		ProjectNode.non_if_data );
+
 	fprintf ( fMakefile, "PROJECT_RCFLAGS := $(PROJECT_CFLAGS)\n" );
 	fprintf ( fMakefile, "PROJECT_WIDLFLAGS := $(PROJECT_CFLAGS)\n" );
 	fprintf ( fMakefile, "PROJECT_LFLAGS := %s\n",

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-04-21 21:01:05 UTC (rev 14735)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-04-22 09:19:18 UTC (rev 14736)
@@ -429,11 +429,11 @@
 	if ( 0 == clean_files.size() )
 		return;
 	fprintf ( fMakefile, ".PHONY: %s_clean\n", module.name.c_str() );
-	fprintf ( fMakefile, "%s_clean:\n\t-@$(rm)", module.name.c_str() );
+	fprintf ( fMakefile, "%s_clean:\n\t-@${rm}", module.name.c_str() );
 	for ( size_t i = 0; i < clean_files.size(); i++ )
 	{
 		if ( 9==((i+1)%10) )
-			fprintf ( fMakefile, " 2>$(NUL)\n\t-@$(rm)" );
+			fprintf ( fMakefile, " 2>$(NUL)\n\t-@${rm}" );
 		fprintf ( fMakefile, " %s", clean_files[i].c_str() );
 	}
 	fprintf ( fMakefile, " 2>$(NUL)\n" );
@@ -1147,13 +1147,58 @@
 }
 
 void
-MingwModuleHandler::GenerateCleanObjectsAsYouGoCode ( const string& files )
+MergeStringVector ( const vector<string>& input,
+	                vector<string>& output )
 {
+	int wrap_at = 25;
+	string s;
+	int wrap_count = -1;
+	for ( size_t i = 0; i < input.size (); i++ )
+	{
+		if ( input[i].size () == 0 )
+			continue;
+		if ( wrap_count++ == wrap_at )
+		{
+			output.push_back ( s );
+			s = "";
+			wrap_count = 0;
+		}
+		else if ( s.size () > 0)
+			s += " ";
+		s += input[i];
+	}
+	if ( s.length () > 0 )
+		output.push_back ( s );
+}
+
+void
+MingwModuleHandler::GetObjectsVector ( const IfableData& data,
+                                       vector<string>& objectFiles ) const
+{
+	for ( size_t i = 0; i < data.files.size (); i++ )
+	{
+		File& file = *data.files[i];
+		objectFiles.push_back ( GetObjectFilename ( file.name, NULL ) );
+	}
+}
+
+void
+MingwModuleHandler::GenerateCleanObjectsAsYouGoCode () const
+{
 	if ( backend->cleanAsYouGo )
 	{
-		fprintf ( fMakefile,
-		          "\t-@${rm} %s 2>$(NUL)\n",
-		          files.c_str () );
+		vector<string> objectFiles;
+		GetObjectsVector ( module.non_if_data,
+                           objectFiles );
+		vector<string> lines;
+		MergeStringVector ( objectFiles,
+	                        lines );
+		for ( size_t i = 0; i < lines.size (); i++ )
+		{
+			fprintf ( fMakefile,
+			          "\t-@${rm} %s 2>$(NUL)\n",
+			          lines[i].c_str () );
+		}
 	}
 }
 
@@ -1226,7 +1271,7 @@
 		          "\t-@${rm} %s 2>$(NUL)\n",
 		          temp_exp.c_str () );
 		
-		GenerateCleanObjectsAsYouGoCode ( objectsMacro );
+		GenerateCleanObjectsAsYouGoCode ();
 	}
 	else
 	{
@@ -1239,7 +1284,7 @@
 		          libsMacro.c_str (),
 		          GetLinkerMacro ().c_str () );
 
-		GenerateCleanObjectsAsYouGoCode ( objectsMacro );
+		GenerateCleanObjectsAsYouGoCode ();
 	}
 
 	GenerateBuildMapCode ();
@@ -1362,6 +1407,8 @@
 	          ar.c_str (),
 	          objs_macro.c_str ());
 
+	GenerateCleanObjectsAsYouGoCode ();
+
 	return archiveFilename;
 }
 

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-04-21 21:01:05 UTC (rev 14735)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-04-22 09:19:18 UTC (rev 14736)
@@ -38,6 +38,8 @@
 		string_list* pclean_files );
 
 	std::string GetModuleTargets ( const Module& module );
+	void GetObjectsVector ( const IfableData& data,
+	                        std::vector<std::string>& objectFiles ) const;
 	void GenerateObjectMacro();
 	void GenerateTargetMacro();
 	void GenerateOtherMacros();
@@ -77,7 +79,7 @@
 	std::string GetLinkingDependenciesMacro () const;
 	std::string GetLibsMacro () const;
 	std::string GetLinkerMacro () const;
-	void GenerateCleanObjectsAsYouGoCode ( const std::string& files );
+	void GenerateCleanObjectsAsYouGoCode () const;
 	void GenerateLinkerCommand ( const std::string& dependencies,
 	                             const std::string& linker,
 	                             const std::string& linkerParameters,

Added: branches/xmlbuildsystem/reactos/tools/rsym.mak
--- branches/xmlbuildsystem/reactos/tools/rsym.mak	2005-04-21 21:01:05 UTC (rev 14735)
+++ branches/xmlbuildsystem/reactos/tools/rsym.mak	2005-04-22 09:19:18 UTC (rev 14736)
@@ -0,0 +1,41 @@
+RSYM_BASE = $(TOOLS_BASE)
+RSYM_BASE_ = $(RSYM_BASE)$(SEP)
+
+RSYM_INT = $(INTERMEDIATE_)$(RSYM_BASE)
+RSYM_INT_ = $(RSYM_INT)$(SEP)
+RSYM_OUT = $(OUTPUT_)$(RSYM_BASE)
+RSYM_OUT_ = $(RSYM_OUT)$(SEP)
+
+RSYM_TARGET = \
+	$(EXEPREFIX)$(RSYM_OUT_)rsym$(EXEPOSTFIX)
+
+RSYM_SOURCES = \
+	$(RSYM_BASE_)rsym.c \
+	$(RSYM_BASE_)rsym_common.c
+
+RSYM_OBJECTS = \
+	$(addprefix $(INTERMEDIATE_), $(RSYM_SOURCES:.c=.o))
+
+RSYM_HOST_CFLAGS = -g -Werror -Wall
+
+RSYM_HOST_LFLAGS = -g
+
+.PHONY: rsym
+rsym: $(RSYM_TARGET)
+
+$(RSYM_TARGET): $(RSYM_OBJECTS) | $(RSYM_OUT)
+	$(ECHO_LD)
+	${host_gcc} $(RSYM_OBJECTS) $(RSYM_HOST_LFLAGS) -o $@
+
+$(RSYM_INT_)rsym.o: $(RSYM_BASE_)rsym.c | $(RSYM_INT)
+	$(ECHO_CC)
+	${host_gcc} $(RSYM_HOST_CFLAGS) -c $< -o $@
+
+$(RSYM_INT_)rsym_common.o: $(RSYM_BASE_)rsym_common.c | $(RSYM_INT)
+	$(ECHO_CC)
+	${host_gcc} $(RSYM_HOST_CFLAGS) -c $< -o $@
+
+.PHONY: rsym_clean
+rsym_clean:
+	-@$(nrm) $(RSYM_TARGET) $(RSYM_OBJECTS) 2>$(NUL)
+clean: rsym_clean
Property changes on: branches/xmlbuildsystem/reactos/tools/rsym.mak
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: branches/xmlbuildsystem/reactos/tools/tools.mak
--- branches/xmlbuildsystem/reactos/tools/tools.mak	2005-04-21 21:01:05 UTC (rev 14735)
+++ branches/xmlbuildsystem/reactos/tools/tools.mak	2005-04-22 09:19:18 UTC (rev 14736)
@@ -15,49 +15,8 @@
 	${mkdir} $@
 endif
 
-RSYM_BASE = $(TOOLS_BASE)
-RSYM_BASE_ = $(RSYM_BASE)$(SEP)
 
-RSYM_INT = $(INTERMEDIATE_)$(RSYM_BASE)
-RSYM_INT_ = $(RSYM_INT)$(SEP)
-RSYM_OUT = $(OUTPUT_)$(RSYM_BASE)
-RSYM_OUT_ = $(RSYM_OUT)$(SEP)
-
-RSYM_TARGET = \
-	$(EXEPREFIX)$(RSYM_OUT_)rsym$(EXEPOSTFIX)
-
-RSYM_SOURCES = \
-	$(RSYM_BASE_)rsym.c \
-	$(RSYM_BASE_)rsym_common.c
-
-RSYM_OBJECTS = \
-	$(addprefix $(INTERMEDIATE_), $(RSYM_SOURCES:.c=.o))
-
-RSYM_HOST_CFLAGS = -g -Werror -Wall
-
-RSYM_HOST_LFLAGS = -g
-
-.PHONY: rsym
-rsym: $(RSYM_TARGET)
-
-$(RSYM_TARGET): $(RSYM_OBJECTS) | $(RSYM_OUT)
-	$(ECHO_LD)
-	${host_gcc} $(RSYM_OBJECTS) $(RSYM_HOST_LFLAGS) -o $@
-
-$(RSYM_INT_)rsym.o: $(RSYM_BASE_)rsym.c | $(RSYM_INT)
-	$(ECHO_CC)
-	${host_gcc} $(RSYM_HOST_CFLAGS) -c $< -o $@
-
-$(RSYM_INT_)rsym_common.o: $(RSYM_BASE_)rsym_common.c | $(RSYM_INT)
-	$(ECHO_CC)
-	${host_gcc} $(RSYM_HOST_CFLAGS) -c $< -o $@
-
-.PHONY: rsym_clean
-rsym_clean:
-	-@$(rm) $(RSYM_TARGET) $(RSYM_OBJECTS) 2>$(NUL)
-clean: rsym_clean
-
-
+include tools/rsym.mak
 include tools/bin2res/bin2res.mak
 include tools/buildno/buildno.mak
 include tools/cabman/cabman.mak