}
string
-MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector<CompilerFlag*>& compilerFlags ) const
+MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector<CompilerFlag*>& compilerFlags, const CompilerType type ) const
{
string parameters;
for ( size_t i = 0; i < compilerFlags.size (); i++ )
{
CompilerFlag& compilerFlag = *compilerFlags[i];
- if ( parameters.length () > 0 )
- parameters += " ";
- parameters += compilerFlag.flag;
+ if ( compilerFlag.compiler == type )
+ {
+ if ( parameters.length () > 0 )
+ parameters += " ";
+ parameters += compilerFlag.flag;
+ }
}
return parameters;
}
if ( generatingCompilerMacro )
{
- string compilerParameters = GenerateCompilerParametersFromVector ( data.compilerFlags );
+ string compilerParameters = GenerateCompilerParametersFromVector ( data.compilerFlags , CompilerTypeDontCare );
if ( compilerParameters.size () > 0 )
{
fprintf (
{
const FileLocation& sourceFile = compilationUnit.GetFilename ();
string extension = GetExtension ( sourceFile );
+ string flags = cflagsMacro;
+ flags += " ";
if ( extension == ".c" || extension == ".C" )
{
+ flags += GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags , CompilerTypeCC );
GenerateGccCommand ( &sourceFile,
GetCompilationUnitDependencies ( compilationUnit ) + extraDependencies,
cc,
- cflagsMacro );
+ flags );
}
else if ( extension == ".cc" || extension == ".CC" ||
extension == ".cpp" || extension == ".CPP" ||
extension == ".cxx" || extension == ".CXX" )
{
+ flags += GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags , CompilerTypeCPP );
GenerateGccCommand ( &sourceFile,
GetCompilationUnitDependencies ( compilationUnit ) + extraDependencies,
cppc,
- cflagsMacro );
+ flags );
}
else if ( extension == ".s" || extension == ".S" )
{
std::string ConcatenatePaths ( const std::string& path1,
const std::string& path2 ) const;
std::string GenerateGccDefineParameters () const;
- std::string GenerateCompilerParametersFromVector ( const std::vector<CompilerFlag*>& compilerFlags ) const;
+ std::string GenerateCompilerParametersFromVector ( const std::vector<CompilerFlag*>& compilerFlags, const CompilerType type ) const;
std::string GenerateLinkerParametersFromVector ( const std::vector<LinkerFlag*>& linkerFlags ) const;
std::string GenerateImportLibraryDependenciesFromVector ( const std::vector<Library*>& libraries );
std::string GenerateLinkerParameters () const;
node.location,
"<compilerflag> is empty." );
}
+
flag = node.value;
+ compiler = CompilerTypeDontCare;
+
+ const XMLAttribute* att = node.GetAttribute ( "compiler", false );
+ if ( att != NULL)
+ {
+ if ( att->value == "cpp" )
+ compiler = CompilerTypeCPP;
+ else if ( att->value == "cc" )
+ compiler = CompilerTypeCC;
+ else
+ {
+ throw InvalidAttributeValueException (
+ node.location,
+ "compiler",
+ att->value );
+ }
+ }
}
void