From 8df8ba2e6ab7433dbd7d385b3a575644c08985a4 Mon Sep 17 00:00:00 2001 From: Casper Hornstrup Date: Sat, 15 Jan 2005 23:00:02 +0000 Subject: [PATCH] Refactor GenerateGlobalCFlagsAndProperties svn path=/branches/xmlbuildsystem/; revision=13069 --- reactos/tools/rbuild/backend/mingw/mingw.cpp | 65 ++++++++++++-------- reactos/tools/rbuild/backend/mingw/mingw.h | 15 ++--- 2 files changed, 47 insertions(+), 33 deletions(-) diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp index 04ea376b6a3..48caff54abb 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@ -59,9 +59,44 @@ MingwBackend::GenerateHeader () fprintf ( fMakefile, "# THIS FILE IS AUTOMATICALLY GENERATED, EDIT 'ReactOS.xml' INSTEAD\n\n" ); } +void +MingwBackend::GenerateProjectCFlagsMacro ( const char* assignmentOperation, + const vector& includes, + const vector& defines ) const +{ + size_t i; + + fprintf ( + fMakefile, + "PROJECT_CFLAGS %s", + assignmentOperation ); + for ( i = 0; i < includes.size(); i++ ) + { + fprintf ( + fMakefile, + " -I%s", + includes[i]->directory.c_str() ); + } + + for ( i = 0; i < defines.size(); i++ ) + { + Define& d = *defines[i]; + fprintf ( + fMakefile, + " -D%s", + d.name.c_str() ); + if ( d.value.size() ) + fprintf ( + fMakefile, + "=%s", + d.value.c_str() ); + } + fprintf ( fMakefile, "\n" ); +} + void MingwBackend::GenerateGlobalCFlagsAndProperties ( - const char* op, + const char* assignmentOperation, const vector& properties, const vector& includes, const vector& defines, @@ -79,31 +114,9 @@ MingwBackend::GenerateGlobalCFlagsAndProperties ( if ( includes.size() || defines.size() ) { - fprintf ( - fMakefile, - "PROJECT_CFLAGS %s", - op ); - for ( i = 0; i < includes.size(); i++ ) - { - fprintf ( - fMakefile, - " -I%s", - includes[i]->directory.c_str() ); - } - for ( i = 0; i < defines.size(); i++ ) - { - Define& d = *defines[i]; - fprintf ( - fMakefile, - " -D%s", - d.name.c_str() ); - if ( d.value.size() ) - fprintf ( - fMakefile, - "=%s", - d.value.c_str() ); - } - fprintf ( fMakefile, "\n" ); + GenerateProjectCFlagsMacro ( assignmentOperation, + includes, + defines ); } for ( i = 0; i < ifs.size(); i++ ) diff --git a/reactos/tools/rbuild/backend/mingw/mingw.h b/reactos/tools/rbuild/backend/mingw/mingw.h index 0f047d82e59..04bab3e4fd6 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.h +++ b/reactos/tools/rbuild/backend/mingw/mingw.h @@ -14,13 +14,14 @@ private: void CreateMakefile (); void CloseMakefile (); void GenerateHeader (); - void - MingwBackend::GenerateGlobalCFlagsAndProperties ( - const char* op, - const std::vector& properties, - const std::vector& includes, - const std::vector& defines, - const std::vector& ifs ); + void GenerateProjectCFlagsMacro ( const char* assignmentOperation, + const std::vector& includes, + const std::vector& defines ) const; + void GenerateGlobalCFlagsAndProperties ( const char* op, + const std::vector& properties, + const std::vector& includes, + const std::vector& defines, + const std::vector& ifs ); std::string GenerateProjectLFLAGS (); void GenerateGlobalVariables (); void GenerateAllTarget ();