return s2;\r
}\r
\r
+string\r
+ReplaceExtension (\r
+ const string& filename,\r
+ const string& newExtension )\r
+{\r
+ size_t index = filename.find_last_of ( '/' );\r
+ if ( index == string::npos )\r
+ index = 0;\r
+ size_t index2 = filename.find_last_of ( '\\' );\r
+ if ( index2 != string::npos && index2 > index )\r
+ index = index2;\r
+ string tmp = filename.substr( index /*, filename.size() - index*/ );\r
+ size_t ext_index = tmp.find_last_of( '.' );\r
+ if ( ext_index != string::npos )\r
+ return filename.substr ( 0, index + ext_index ) + newExtension;\r
+ return filename + newExtension;\r
+}\r
+\r
string\r
GetSubPath (\r
const string& location,\r
{\r
if ( HasImportLibrary () )\r
{\r
- return ssprintf ( "dk%cnkm%clib%clib%s.a",\r
+ return ReplaceExtension ( GetPath(), ".a" );\r
+ /*return ssprintf ( "dk%cnkm%clib%clib%s.a",\r
CSEP,\r
CSEP,\r
CSEP,\r
- name.c_str () );\r
+ name.c_str () );*/\r
}\r
else\r
return GetPath();\r
return path + CSEP + prefix + GetTargetName ();\r
}\r
\r
-string\r
-Module::GetTargets () const\r
+void\r
+Module::GetTargets ( string_list& targets ) const\r
{\r
if ( invocations.size () > 0 )\r
{\r
- string targets ( "" );\r
for ( size_t i = 0; i < invocations.size (); i++ )\r
{\r
Invoke& invoke = *invocations[i];\r
- if ( targets.length () > 0 )\r
- targets += " ";\r
- targets += invoke.GetTargets ();\r
+ invoke.GetTargets ( targets );\r
}\r
- return targets;\r
}\r
else\r
- return GetPath ();\r
+ targets.push_back ( GetPath () );\r
}\r
\r
string\r
subs_invalid = true;\r
}\r
if ( subs_invalid && e.subElements.size() > 0 )\r
- throw InvalidBuildFileException ( e.location,\r
- "<%s> cannot have sub-elements",\r
- e.name.c_str() );\r
+ throw InvalidBuildFileException (\r
+ e.location,\r
+ "<%s> cannot have sub-elements",\r
+ e.name.c_str() );\r
}\r
\r
-string\r
-Invoke::GetTargets () const\r
+void\r
+Invoke::GetTargets ( string_list& targets ) const\r
{\r
- string targets ( "" );\r
for ( size_t i = 0; i < output.size (); i++ )\r
{\r
InvokeFile& file = *output[i];\r
- if ( targets.length () > 0 )\r
- targets += " ";\r
- targets += NormalizeFilename ( file.name );\r
+ targets.push_back ( NormalizeFilename ( file.name ) );\r
}\r
- return targets;\r
}\r
\r
string\r
InvokeFile& invokeFile = *output[i];\r
if ( invokeFile.switches.length () > 0 )\r
{\r
- parameters += invokeFile.switches;\r
- parameters += " ";\r
+ parameters += invokeFile.switches + " ";\r
}\r
parameters += invokeFile.name;\r
}\r