Only pass GCC specific options to GCC

svn path=/branches/xmlbuildsystem/; revision=15279
This commit is contained in:
Casper Hornstrup 2005-05-14 15:07:11 +00:00
parent 91c4967ba6
commit 1732348d39
4 changed files with 83 additions and 41 deletions

View file

@ -383,46 +383,27 @@ MingwBackend::GenerateHeader () const
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 @@ MingwBackend::GenerateGlobalCFlagsAndProperties (
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 @@ MingwBackend::GenerateGlobalCFlagsAndProperties (
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 @@ MingwBackend::GenerateGlobalCFlagsAndProperties (
}
}
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 @@ MingwBackend::GenerateProjectLFLAGS () const
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" );
}

View file

@ -73,10 +73,15 @@ private:
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;

View file

@ -488,9 +488,9 @@ MingwModuleHandler::GetObjectFilenames ()
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 @@ MingwModuleHandler::ConcatenatePaths (
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++ )

View file

@ -40,6 +40,9 @@ public:
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 @@ protected:
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 );