Only pass GCC specific options to GCC
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-05-14 14:14:01 UTC (rev 15278)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-05-14 15:07:11 UTC (rev 15279)
@@ -383,46 +383,27 @@
 	fprintf ( fMakefile, "# THIS FILE IS AUTOMATICALLY GENERATED, EDIT 'ReactOS.xml' INSTEAD\n\n" );
 }
 
+string
+MingwBackend::GenerateIncludesAndDefines ( IfableData& data ) const
+{
+	string includeParameters = MingwModuleHandler::GenerateGccIncludeParametersFromVector ( data.includes );
+	string defineParameters = MingwModuleHandler::GenerateGccDefineParametersFromVector ( data.defines );
+	return includeParameters + " " + defineParameters;
+}
+
 void
 MingwBackend::GenerateProjectCFlagsMacro ( const char* assignmentOperation,
                                            IfableData& data ) const
 {
-	size_t i;
-
 	fprintf (
 		fMakefile,
 		"PROJECT_CFLAGS %s",
 		assignmentOperation );
 	
-	for ( i = 0; i < data.compilerFlags.size(); i++ )
-	{
-		fprintf (
-			fMakefile,
-			" %s",
-			data.compilerFlags[i]->flag.c_str() );
-	}
+	fprintf ( fMakefile,
+	          " %s",
+	          GenerateIncludesAndDefines ( data ).c_str() );
 
-	for ( i = 0; i < data.includes.size(); i++ )
-	{
-		fprintf (
-			fMakefile,
-			" -I%s",
-			data.includes[i]->directory.c_str() );
-	}
-
-	for ( i = 0; i < data.defines.size(); i++ )
-	{
-		Define& d = *data.defines[i];
-		fprintf (
-			fMakefile,
-			" -D%s",
-			d.name.c_str() );
-		if ( d.value.size() )
-			fprintf (
-				fMakefile,
-				"=%s",
-				d.value.c_str() );
-	}
 	fprintf ( fMakefile, "\n" );
 }
 
@@ -441,7 +422,7 @@
 			prop.value.c_str() );
 	}
 
-	if ( data.includes.size() || data.defines.size() || data.compilerFlags.size() )
+	if ( data.includes.size() || data.defines.size() )
 	{
 		GenerateProjectCFlagsMacro ( assignmentOperation,
 		                             data );
@@ -452,7 +433,6 @@
 		If& rIf = *data.ifs[i];
 		if ( rIf.data.defines.size()
 			|| rIf.data.includes.size()
-			|| rIf.data.compilerFlags.size()
 			|| rIf.data.ifs.size() )
 		{
 			fprintf (
@@ -470,6 +450,62 @@
 	}
 }
 
+void
+MingwBackend::GenerateProjectGccOptionsMacro ( const char* assignmentOperation,
+                                               IfableData& data ) const
+{
+	size_t i;
+
+	fprintf (
+		fMakefile,
+		"PROJECT_GCCOPTIONS %s",
+		assignmentOperation );
+	
+	for ( i = 0; i < data.compilerFlags.size(); i++ )
+	{
+		fprintf (
+			fMakefile,
+			" %s",
+			data.compilerFlags[i]->flag.c_str() );
+	}
+
+	fprintf ( fMakefile, "\n" );
+}
+
+void
+MingwBackend::GenerateProjectGccOptions (
+	const char* assignmentOperation,
+	IfableData& data ) const
+{
+	size_t i;
+
+	if ( data.compilerFlags.size() )
+	{
+		GenerateProjectGccOptionsMacro ( assignmentOperation,
+		                                 data );
+	}
+
+	for ( i = 0; i < data.ifs.size(); i++ )
+	{
+		If& rIf = *data.ifs[i];
+		if ( rIf.data.compilerFlags.size()
+		     || rIf.data.ifs.size() )
+		{
+			fprintf (
+				fMakefile,
+				"ifeq (\"$(%s)\",\"%s\")\n",
+				rIf.property.c_str(),
+				rIf.value.c_str() );
+			GenerateProjectGccOptions (
+				"+=",
+				rIf.data );
+			fprintf (
+				fMakefile,
+				"endif\n\n" );
+		}
+	}
+}
+
 string
 MingwBackend::GenerateProjectLFLAGS () const
 {
@@ -487,14 +523,14 @@
 void
 MingwBackend::GenerateGlobalVariables () const
 {
-	GenerateGlobalCFlagsAndProperties (
-		"=",
-		ProjectNode.non_if_data );
+	GenerateGlobalCFlagsAndProperties ( "=", ProjectNode.non_if_data );
+	GenerateProjectGccOptions ( "=", ProjectNode.non_if_data );
 
 	fprintf ( fMakefile, "PROJECT_RCFLAGS := $(PROJECT_CFLAGS)\n" );
 	fprintf ( fMakefile, "PROJECT_WIDLFLAGS := $(PROJECT_CFLAGS)\n" );
 	fprintf ( fMakefile, "PROJECT_LFLAGS := %s\n",
 	          GenerateProjectLFLAGS ().c_str () );
+	fprintf ( fMakefile, "PROJECT_CFLAGS += $(PROJECT_GCCOPTIONS)\n" );
 	fprintf ( fMakefile, "PROJECT_CFLAGS += -Wall\n" );
 	fprintf ( fMakefile, "\n" );
 }

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h	2005-05-14 14:14:01 UTC (rev 15278)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h	2005-05-14 15:07:11 UTC (rev 15279)
@@ -73,10 +73,15 @@
 	void CreateMakefile ();
 	void CloseMakefile () const;
 	void GenerateHeader () const;
+	std::string GenerateIncludesAndDefines ( IfableData& data ) const;
 	void GenerateProjectCFlagsMacro ( const char* assignmentOperation,
 	                                  IfableData& data ) const;
 	void GenerateGlobalCFlagsAndProperties ( const char* op,
 	                                         IfableData& data ) const;
+	void GenerateProjectGccOptionsMacro ( const char* assignmentOperation,
+                                              IfableData& data ) const;
+	void GenerateProjectGccOptions ( const char* assignmentOperation,
+	                                 IfableData& data ) const;
 	std::string GenerateProjectLFLAGS () const;
 	void GenerateDirectories ();
 	void GenerateGlobalVariables () const;

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-05-14 14:14:01 UTC (rev 15278)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-05-14 15:07:11 UTC (rev 15279)
@@ -488,9 +488,9 @@
 	return objectFilenames;
 }
 
-string
+/* static */ string
 MingwModuleHandler::GenerateGccDefineParametersFromVector (
-	const vector<Define*>& defines ) const
+	const vector<Define*>& defines )
 {
 	string parameters;
 	for ( size_t i = 0; i < defines.size (); i++ )
@@ -535,8 +535,8 @@
 		return path1 + CSEP + path2;
 }
 
-string
-MingwModuleHandler::GenerateGccIncludeParametersFromVector ( const vector<Include*>& includes ) const
+/* static */ string
+MingwModuleHandler::GenerateGccIncludeParametersFromVector ( const vector<Include*>& includes )
 {
 	string parameters;
 	for ( size_t i = 0; i < includes.size (); i++ )

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-05-14 14:14:01 UTC (rev 15278)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-05-14 15:07:11 UTC (rev 15279)
@@ -40,6 +40,9 @@
 		const Module& module,
 		string_list* pclean_files );
 
+	static std::string GenerateGccDefineParametersFromVector ( const std::vector<Define*>& defines );
+	static std::string GenerateGccIncludeParametersFromVector ( const std::vector<Include*>& includes );
+
 	std::string GetModuleTargets ( const Module& module );
 	void GetObjectsVector ( const IfableData& data,
 	                        std::vector<std::string>& objectFiles ) const;
@@ -100,9 +103,7 @@
 private:
 	std::string ConcatenatePaths ( const std::string& path1,
 	                               const std::string& path2 ) const;
-	std::string GenerateGccDefineParametersFromVector ( const std::vector<Define*>& defines ) const;
 	std::string GenerateGccDefineParameters () const;
-	std::string GenerateGccIncludeParametersFromVector ( const std::vector<Include*>& includes ) const;
 	std::string GenerateCompilerParametersFromVector ( const std::vector<CompilerFlag*>& compilerFlags ) const;
 	std::string GenerateLinkerParametersFromVector ( const std::vector<LinkerFlag*>& linkerFlags ) const;
 	std::string GenerateImportLibraryDependenciesFromVector ( const std::vector<Library*>& libraries );