2 * Copyright (C) 2005 Casper S. Hornstrup
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 Right ( const string
& s
, size_t n
)
31 return string ( &s
[s
.size()-n
] );
35 Replace ( const string
& s
, const string
& find
, const string
& with
)
38 const char* p
= s
.c_str();
41 const char* p2
= strstr ( p
, find
.c_str() );
45 ret
+= string ( p
, p2
-p
);
55 FixSeparator ( const string
& s
)
58 char* p
= strchr ( &s2
[0], cBadSep
);
62 p
= strchr ( p
, cBadSep
);
68 FixSeparatorForSystemCommand ( const string
& s
)
71 char* p
= strchr ( &s2
[0], DEF_CBAD_SEP
);
75 p
= strchr ( p
, DEF_CBAD_SEP
);
81 DosSeparator ( const string
& s
)
84 char* p
= strchr ( &s2
[0], '/' );
88 p
= strchr ( p
, '/' );
95 const string
& filename
,
96 const string
& newExtension
)
98 size_t index
= filename
.find_last_of ( '/' );
99 if ( index
== string::npos
)
101 size_t index2
= filename
.find_last_of ( '\\' );
102 if ( index2
!= string::npos
&& index2
> index
)
104 string tmp
= filename
.substr( index
/*, filename.size() - index*/ );
105 size_t ext_index
= tmp
.find_last_of( '.' );
106 if ( ext_index
!= string::npos
)
107 return filename
.substr ( 0, index
+ ext_index
) + newExtension
;
108 return filename
+ newExtension
;
113 const string
& location
,
115 const string
& att_value
)
117 if ( !att_value
.size() )
118 throw InvalidBuildFileException (
120 "<directory> tag has empty 'name' attribute" );
121 if ( strpbrk ( att_value
.c_str (), "/\\?*:<>|" ) )
122 throw InvalidBuildFileException (
124 "<directory> tag has invalid characters in 'name' attribute" );
127 return FixSeparator(path
+ cSep
+ att_value
);
131 GetExtension ( const string
& filename
)
133 size_t index
= filename
.find_last_of ( '/' );
134 if (index
== string::npos
) index
= 0;
135 string tmp
= filename
.substr( index
, filename
.size() - index
);
136 size_t ext_index
= tmp
.find_last_of( '.' );
137 if (ext_index
!= string::npos
)
138 return filename
.substr ( index
+ ext_index
, filename
.size() );
143 GetDirectory ( const string
& filename
)
145 size_t index
= filename
.find_last_of ( cSep
);
146 if ( index
== string::npos
)
149 return filename
.substr ( 0, index
);
153 GetFilename ( const string
& filename
)
155 size_t index
= filename
.find_last_of ( cSep
);
156 if ( index
== string::npos
)
159 return filename
.substr ( index
+ 1, filename
.length () - index
);
163 NormalizeFilename ( const string
& filename
)
165 if ( filename
== "" )
168 string normalizedPath
= path
.Fixup ( filename
, true );
169 string relativeNormalizedPath
= path
.RelativeFromWorkingDirectory ( normalizedPath
);
170 return FixSeparator ( relativeNormalizedPath
);
174 GetBooleanValue ( const string
& value
)
182 IfableData::~IfableData()
185 for ( i
= 0; i
< includes
.size (); i
++ )
187 for ( i
= 0; i
< defines
.size (); i
++ )
189 for ( i
= 0; i
< libraries
.size (); i
++ )
191 for ( i
= 0; i
< properties
.size (); i
++ )
192 delete properties
[i
];
193 for ( i
= 0; i
< compilerFlags
.size (); i
++ )
194 delete compilerFlags
[i
];
195 for ( i
= 0; i
< ifs
.size (); i
++ )
197 for ( i
= 0; i
< compilationUnits
.size (); i
++ )
198 delete compilationUnits
[i
];
201 void IfableData::ProcessXML ()
204 for ( i
= 0; i
< includes
.size (); i
++ )
205 includes
[i
]->ProcessXML ();
206 for ( i
= 0; i
< defines
.size (); i
++ )
207 defines
[i
]->ProcessXML ();
208 for ( i
= 0; i
< libraries
.size (); i
++ )
209 libraries
[i
]->ProcessXML ();
210 for ( i
= 0; i
< properties
.size(); i
++ )
211 properties
[i
]->ProcessXML ();
212 for ( i
= 0; i
< compilerFlags
.size(); i
++ )
213 compilerFlags
[i
]->ProcessXML ();
214 for ( i
= 0; i
< ifs
.size (); i
++ )
215 ifs
[i
]->ProcessXML ();
216 for ( i
= 0; i
< compilationUnits
.size (); i
++ )
217 compilationUnits
[i
]->ProcessXML ();
220 Module::Module ( const Project
& project
,
221 const XMLElement
& moduleNode
,
222 const string
& modulePath
)
225 importLibrary (NULL
),
232 if ( node
.name
!= "module" )
233 throw InvalidOperationException ( __FILE__
,
235 "Module created with non-<module> node" );
237 xmlbuildFile
= Path::RelativeFromWorkingDirectory ( moduleNode
.xmlFile
->filename () );
239 path
= FixSeparator ( modulePath
);
243 const XMLAttribute
* att
= moduleNode
.GetAttribute ( "if", false );
245 enabled
= GetBooleanValue ( project
.ResolveProperties ( att
->value
) );
247 att
= moduleNode
.GetAttribute ( "ifnot", false );
249 enabled
= !GetBooleanValue ( project
.ResolveProperties ( att
->value
) );
251 att
= moduleNode
.GetAttribute ( "name", true );
255 att
= moduleNode
.GetAttribute ( "type", true );
257 type
= GetModuleType ( node
.location
, *att
);
259 att
= moduleNode
.GetAttribute ( "extension", false );
261 extension
= att
->value
;
263 extension
= GetDefaultModuleExtension ();
265 att
= moduleNode
.GetAttribute ( "unicode", false );
268 const char* p
= att
->value
.c_str();
269 if ( !stricmp ( p
, "true" ) || !stricmp ( p
, "yes" ) )
271 else if ( !stricmp ( p
, "false" ) || !stricmp ( p
, "no" ) )
275 throw InvalidAttributeValueException (
284 att
= moduleNode
.GetAttribute ( "entrypoint", false );
286 entrypoint
= att
->value
;
288 entrypoint
= GetDefaultModuleEntrypoint ();
290 att
= moduleNode
.GetAttribute ( "baseaddress", false );
292 baseaddress
= att
->value
;
294 baseaddress
= GetDefaultModuleBaseaddress ();
296 att
= moduleNode
.GetAttribute ( "mangledsymbols", false );
299 const char* p
= att
->value
.c_str();
300 if ( !stricmp ( p
, "true" ) || !stricmp ( p
, "yes" ) )
301 mangledSymbols
= true;
302 else if ( !stricmp ( p
, "false" ) || !stricmp ( p
, "no" ) )
303 mangledSymbols
= false;
306 throw InvalidAttributeValueException (
313 mangledSymbols
= false;
315 att
= moduleNode
.GetAttribute ( "host", false );
318 const char* p
= att
->value
.c_str();
319 if ( !stricmp ( p
, "true" ) || !stricmp ( p
, "yes" ) )
321 else if ( !stricmp ( p
, "false" ) || !stricmp ( p
, "no" ) )
325 throw InvalidAttributeValueException (
332 att
= moduleNode
.GetAttribute ( "prefix", false );
336 att
= moduleNode
.GetAttribute ( "installbase", false );
338 installBase
= att
->value
;
342 att
= moduleNode
.GetAttribute ( "installname", false );
344 installName
= att
->value
;
348 att
= moduleNode
.GetAttribute ( "usewrc", false );
350 useWRC
= att
->value
== "true";
354 att
= moduleNode
.GetAttribute ( "allowwarnings", false );
357 att
= moduleNode
.GetAttribute ( "warnings", false );
360 printf ( "%s: WARNING: 'warnings' attribute of <module> is deprecated, use 'allowwarnings' instead\n",
361 moduleNode
.location
.c_str() );
365 allowWarnings
= att
->value
== "true";
367 allowWarnings
= false;
369 att
= moduleNode
.GetAttribute ( "aliasof", false );
370 if ( type
== Alias
&& att
!= NULL
)
371 aliasedModuleName
= att
->value
;
373 aliasedModuleName
= "";
379 for ( i
= 0; i
< invocations
.size(); i
++ )
380 delete invocations
[i
];
381 for ( i
= 0; i
< dependencies
.size(); i
++ )
382 delete dependencies
[i
];
383 for ( i
= 0; i
< compilerFlags
.size(); i
++ )
384 delete compilerFlags
[i
];
385 for ( i
= 0; i
< linkerFlags
.size(); i
++ )
386 delete linkerFlags
[i
];
387 for ( i
= 0; i
< stubbedComponents
.size(); i
++ )
388 delete stubbedComponents
[i
];
400 if ( aliasedModuleName
== name
)
401 throw InvalidBuildFileException (
403 "module '%s' cannot link against itself",
405 const Module
* m
= project
.LocateModule ( aliasedModuleName
);
407 throw InvalidBuildFileException (
409 "module '%s' trying to alias non-existant module '%s'",
411 aliasedModuleName
.c_str() );
415 for ( i
= 0; i
< node
.subElements
.size(); i
++ )
417 ParseContext parseContext
;
418 ProcessXMLSubElement ( *node
.subElements
[i
], path
, parseContext
);
420 for ( i
= 0; i
< invocations
.size(); i
++ )
421 invocations
[i
]->ProcessXML ();
422 for ( i
= 0; i
< dependencies
.size(); i
++ )
423 dependencies
[i
]->ProcessXML ();
424 for ( i
= 0; i
< compilerFlags
.size(); i
++ )
425 compilerFlags
[i
]->ProcessXML();
426 for ( i
= 0; i
< linkerFlags
.size(); i
++ )
427 linkerFlags
[i
]->ProcessXML();
428 for ( i
= 0; i
< stubbedComponents
.size(); i
++ )
429 stubbedComponents
[i
]->ProcessXML();
430 non_if_data
.ProcessXML();
432 linkerScript
->ProcessXML();
438 Module::ProcessXMLSubElement ( const XMLElement
& e
,
440 ParseContext
& parseContext
)
442 If
* pOldIf
= parseContext
.ifData
;
443 bool subs_invalid
= false;
444 string
subpath ( path
);
445 if ( e
.name
== "file" && e
.value
.size () > 0 )
448 const XMLAttribute
* att
= e
.GetAttribute ( "first", false );
451 if ( !stricmp ( att
->value
.c_str(), "true" ) )
453 else if ( stricmp ( att
->value
.c_str(), "false" ) )
454 throw InvalidBuildFileException (
456 "attribute 'first' of <file> element can only be 'true' or 'false'" );
458 string switches
= "";
459 att
= e
.GetAttribute ( "switches", false );
461 switches
= att
->value
;
464 // check for c++ file
465 string ext
= GetExtension ( e
.value
);
466 if ( !stricmp ( ext
.c_str(), ".cpp" ) )
468 else if ( !stricmp ( ext
.c_str(), ".cc" ) )
470 else if ( !stricmp ( ext
.c_str(), ".cxx" ) )
473 File
* pFile
= new File ( FixSeparator ( path
+ cSep
+ e
.value
),
477 if ( parseContext
.compilationUnit
)
478 parseContext
.compilationUnit
->files
.push_back ( pFile
);
481 CompilationUnit
* pCompilationUnit
= new CompilationUnit ( pFile
);
482 if ( parseContext
.ifData
)
483 parseContext
.ifData
->data
.compilationUnits
.push_back ( pCompilationUnit
);
485 non_if_data
.compilationUnits
.push_back ( pCompilationUnit
);
487 if ( parseContext
.ifData
)
488 parseContext
.ifData
->data
.files
.push_back ( pFile
);
490 non_if_data
.files
.push_back ( pFile
);
493 else if ( e
.name
== "library" && e
.value
.size () )
495 Library
* pLibrary
= new Library ( e
, *this, e
.value
);
496 if ( parseContext
.ifData
)
497 parseContext
.ifData
->data
.libraries
.push_back ( pLibrary
);
499 non_if_data
.libraries
.push_back ( pLibrary
);
502 else if ( e
.name
== "directory" )
504 const XMLAttribute
* att
= e
.GetAttribute ( "name", true );
506 subpath
= GetSubPath ( e
.location
, path
, att
->value
);
508 else if ( e
.name
== "include" )
510 Include
* include
= new Include ( project
, this, &e
);
511 if ( parseContext
.ifData
)
512 parseContext
.ifData
->data
.includes
.push_back ( include
);
514 non_if_data
.includes
.push_back ( include
);
517 else if ( e
.name
== "define" )
519 Define
* pDefine
= new Define ( project
, this, e
);
520 if ( parseContext
.ifData
)
521 parseContext
.ifData
->data
.defines
.push_back ( pDefine
);
523 non_if_data
.defines
.push_back ( pDefine
);
526 else if ( e
.name
== "invoke" )
528 if ( parseContext
.ifData
)
529 throw InvalidBuildFileException (
531 "<invoke> is not a valid sub-element of <if>" );
532 invocations
.push_back ( new Invoke ( e
, *this ) );
533 subs_invalid
= false;
535 else if ( e
.name
== "dependency" )
537 if ( parseContext
.ifData
)
538 throw InvalidBuildFileException (
540 "<dependency> is not a valid sub-element of <if>" );
541 dependencies
.push_back ( new Dependency ( e
, *this ) );
544 else if ( e
.name
== "importlibrary" )
546 if ( parseContext
.ifData
)
547 throw InvalidBuildFileException (
549 "<importlibrary> is not a valid sub-element of <if>" );
551 throw InvalidBuildFileException (
553 "Only one <importlibrary> is valid per module" );
554 importLibrary
= new ImportLibrary ( e
, *this );
557 else if ( e
.name
== "if" )
559 parseContext
.ifData
= new If ( e
, project
, this );
561 pOldIf
->data
.ifs
.push_back ( parseContext
.ifData
);
563 non_if_data
.ifs
.push_back ( parseContext
.ifData
);
564 subs_invalid
= false;
566 else if ( e
.name
== "ifnot" )
568 parseContext
.ifData
= new If ( e
, project
, this, true );
570 pOldIf
->data
.ifs
.push_back ( parseContext
.ifData
);
572 non_if_data
.ifs
.push_back ( parseContext
.ifData
);
573 subs_invalid
= false;
575 else if ( e
.name
== "compilerflag" )
577 CompilerFlag
* pCompilerFlag
= new CompilerFlag ( project
, this, e
);
578 if ( parseContext
.ifData
)
579 parseContext
.ifData
->data
.compilerFlags
.push_back ( pCompilerFlag
);
581 non_if_data
.compilerFlags
.push_back ( pCompilerFlag
);
584 else if ( e
.name
== "linkerflag" )
586 linkerFlags
.push_back ( new LinkerFlag ( project
, this, e
) );
589 else if ( e
.name
== "linkerscript" )
592 throw InvalidBuildFileException (
594 "Only one <linkerscript> is valid per module" );
595 linkerScript
= new LinkerScript ( project
, this, e
);
598 else if ( e
.name
== "component" )
600 stubbedComponents
.push_back ( new StubbedComponent ( this, e
) );
601 subs_invalid
= false;
603 else if ( e
.name
== "property" )
605 throw InvalidBuildFileException (
607 "<property> is not a valid sub-element of <module>" );
609 else if ( e
.name
== "bootstrap" )
611 bootstrap
= new Bootstrap ( project
, this, e
);
614 else if ( e
.name
== "pch" )
616 if ( parseContext
.ifData
)
617 throw InvalidBuildFileException (
619 "<pch> is not a valid sub-element of <if>" );
621 throw InvalidBuildFileException (
623 "Only one <pch> is valid per module" );
625 e
, *this, File ( FixSeparator ( path
+ cSep
+ e
.value
), false, "", true ) );
628 else if ( e
.name
== "compilationunit" )
630 CompilationUnit
* pCompilationUnit
= new CompilationUnit ( &project
, this, &e
);
631 if ( parseContext
.ifData
)
632 parseContext
.ifData
->data
.compilationUnits
.push_back ( pCompilationUnit
);
634 non_if_data
.compilationUnits
.push_back ( pCompilationUnit
);
635 parseContext
.compilationUnit
= pCompilationUnit
;
636 subs_invalid
= false;
638 if ( subs_invalid
&& e
.subElements
.size() > 0 )
639 throw InvalidBuildFileException (
641 "<%s> cannot have sub-elements",
643 for ( size_t i
= 0; i
< e
.subElements
.size (); i
++ )
644 ProcessXMLSubElement ( *e
.subElements
[i
], subpath
, parseContext
);
645 parseContext
.ifData
= pOldIf
;
649 Module::GetModuleType ( const string
& location
, const XMLAttribute
& attribute
)
651 if ( attribute
.value
== "buildtool" )
653 if ( attribute
.value
== "staticlibrary" )
654 return StaticLibrary
;
655 if ( attribute
.value
== "objectlibrary" )
656 return ObjectLibrary
;
657 if ( attribute
.value
== "kernel" )
659 if ( attribute
.value
== "kernelmodedll" )
660 return KernelModeDLL
;
661 if ( attribute
.value
== "kernelmodedriver" )
662 return KernelModeDriver
;
663 if ( attribute
.value
== "nativedll" )
665 if ( attribute
.value
== "nativecui" )
667 if ( attribute
.value
== "win32dll" )
669 if ( attribute
.value
== "win32cui" )
671 if ( attribute
.value
== "win32gui" )
673 if ( attribute
.value
== "bootloader" )
675 if ( attribute
.value
== "bootsector" )
677 if ( attribute
.value
== "iso" )
679 if ( attribute
.value
== "liveiso" )
681 if ( attribute
.value
== "test" )
683 if ( attribute
.value
== "rpcserver" )
685 if ( attribute
.value
== "rpcclient" )
687 if ( attribute
.value
== "alias" )
689 throw InvalidAttributeValueException ( location
,
695 Module::GetDefaultModuleExtension () const
714 case KernelModeDriver
:
731 throw InvalidOperationException ( __FILE__
,
736 Module::GetDefaultModuleEntrypoint () const
741 return "_NtProcessStartup";
743 return "_DriverEntry@8";
745 return "_DllMainCRTStartup@12";
747 return "_NtProcessStartup@4";
749 return "_DllMain@12";
753 return "_wmainCRTStartup";
755 return "_mainCRTStartup";
758 return "_wWinMainCRTStartup";
760 return "_WinMainCRTStartup";
761 case KernelModeDriver
:
762 return "_DriverEntry@8";
775 throw InvalidOperationException ( __FILE__
,
780 Module::GetDefaultModuleBaseaddress () const
796 case KernelModeDriver
:
810 throw InvalidOperationException ( __FILE__
,
815 Module::HasImportLibrary () const
817 return importLibrary
!= NULL
;
821 Module::IsDLL () const
829 case KernelModeDriver
:
847 throw InvalidOperationException ( __FILE__
,
852 Module::GenerateInOutputTree () const
860 case KernelModeDriver
:
878 throw InvalidOperationException ( __FILE__
,
883 Module::GetTargetName () const
885 return name
+ extension
;
889 Module::GetDependencyPath () const
891 if ( HasImportLibrary () )
892 return ReplaceExtension ( GetPathWithPrefix ( "lib" ), ".a" );
898 Module::GetBasePath () const
904 Module::GetPath () const
906 if ( path
.length() > 0 )
907 return path
+ cSep
+ GetTargetName ();
909 return GetTargetName ();
913 Module::GetPathWithPrefix ( const string
& prefix
) const
915 return path
+ cSep
+ prefix
+ GetTargetName ();
919 Module::GetInvocationTarget ( const int index
) const
921 return ssprintf ( "%s_invoke_%d",
927 Module::HasFileWithExtension (
928 const IfableData
& data
,
929 const std::string
& extension
) const
932 for ( i
= 0; i
< data
.compilationUnits
.size (); i
++ )
934 CompilationUnit
* compilationUnit
= data
.compilationUnits
[i
];
935 if ( compilationUnit
->HasFileWithExtension ( extension
) )
938 for ( i
= 0; i
< data
.ifs
.size (); i
++ )
940 if ( HasFileWithExtension ( data
.ifs
[i
]->data
, extension
) )
947 Module::InvokeModule () const
949 for ( size_t i
= 0; i
< invocations
.size (); i
++ )
951 Invoke
& invoke
= *invocations
[i
];
952 string command
= FixSeparatorForSystemCommand(invoke
.invokeModule
->GetPath ()) + " " + invoke
.GetParameters ();
953 printf ( "Executing '%s'\n\n", command
.c_str () );
954 int exitcode
= system ( command
.c_str () );
956 throw InvocationFailedException ( command
,
962 File::File ( const string
& _name
, bool _first
,
963 std::string _switches
,
964 bool _isPreCompiledHeader
)
968 isPreCompiledHeader(_isPreCompiledHeader
)
978 Library::Library ( const XMLElement
& _node
,
979 const Module
& _module
,
980 const string
& _name
)
984 importedModule(_module
.project
.LocateModule(_name
))
986 if ( module
.name
== name
)
987 throw InvalidBuildFileException (
989 "module '%s' cannot link against itself",
991 if ( !importedModule
)
992 throw InvalidBuildFileException (
994 "module '%s' trying to import non-existant module '%s'",
1000 Library::ProcessXML()
1002 if ( !module
.project
.LocateModule ( name
) )
1003 throw InvalidBuildFileException (
1005 "module '%s' is trying to link against non-existant module '%s'",
1006 module
.name
.c_str(),
1011 Invoke::Invoke ( const XMLElement
& _node
,
1012 const Module
& _module
)
1019 Invoke::ProcessXML()
1021 const XMLAttribute
* att
= node
.GetAttribute ( "module", false );
1023 invokeModule
= &module
;
1026 invokeModule
= module
.project
.LocateModule ( att
->value
);
1027 if ( invokeModule
== NULL
)
1028 throw InvalidBuildFileException (
1030 "module '%s' is trying to invoke non-existant module '%s'",
1031 module
.name
.c_str(),
1032 att
->value
.c_str() );
1035 for ( size_t i
= 0; i
< node
.subElements
.size (); i
++ )
1036 ProcessXMLSubElement ( *node
.subElements
[i
] );
1040 Invoke::ProcessXMLSubElement ( const XMLElement
& e
)
1042 bool subs_invalid
= false;
1043 if ( e
.name
== "input" )
1045 for ( size_t i
= 0; i
< e
.subElements
.size (); i
++ )
1046 ProcessXMLSubElementInput ( *e
.subElements
[i
] );
1048 else if ( e
.name
== "output" )
1050 for ( size_t i
= 0; i
< e
.subElements
.size (); i
++ )
1051 ProcessXMLSubElementOutput ( *e
.subElements
[i
] );
1053 if ( subs_invalid
&& e
.subElements
.size() > 0 )
1054 throw InvalidBuildFileException ( e
.location
,
1055 "<%s> cannot have sub-elements",
1060 Invoke::ProcessXMLSubElementInput ( const XMLElement
& e
)
1062 bool subs_invalid
= false;
1063 if ( e
.name
== "inputfile" && e
.value
.size () > 0 )
1065 input
.push_back ( new InvokeFile ( e
, FixSeparator ( module
.path
+ cSep
+ e
.value
) ) );
1066 subs_invalid
= true;
1068 if ( subs_invalid
&& e
.subElements
.size() > 0 )
1069 throw InvalidBuildFileException ( e
.location
,
1070 "<%s> cannot have sub-elements",
1075 Invoke::ProcessXMLSubElementOutput ( const XMLElement
& e
)
1077 bool subs_invalid
= false;
1078 if ( e
.name
== "outputfile" && e
.value
.size () > 0 )
1080 output
.push_back ( new InvokeFile ( e
, FixSeparator ( module
.path
+ cSep
+ e
.value
) ) );
1081 subs_invalid
= true;
1083 if ( subs_invalid
&& e
.subElements
.size() > 0 )
1084 throw InvalidBuildFileException (
1086 "<%s> cannot have sub-elements",
1091 Invoke::GetTargets ( string_list
& targets
) const
1093 for ( size_t i
= 0; i
< output
.size (); i
++ )
1095 InvokeFile
& file
= *output
[i
];
1096 targets
.push_back ( NormalizeFilename ( file
.name
) );
1101 Invoke::GetParameters () const
1103 string
parameters ( "" );
1105 for ( i
= 0; i
< output
.size (); i
++ )
1107 if ( parameters
.length () > 0)
1109 InvokeFile
& invokeFile
= *output
[i
];
1110 if ( invokeFile
.switches
.length () > 0 )
1112 parameters
+= invokeFile
.switches
+ " ";
1114 parameters
+= invokeFile
.name
;
1117 for ( i
= 0; i
< input
.size (); i
++ )
1119 if ( parameters
.length () > 0 )
1121 InvokeFile
& invokeFile
= *input
[i
];
1122 if ( invokeFile
.switches
.length () > 0 )
1124 parameters
+= invokeFile
.switches
;
1127 parameters
+= invokeFile
.name
;
1134 InvokeFile::InvokeFile ( const XMLElement
& _node
,
1135 const string
& _name
)
1139 const XMLAttribute
* att
= _node
.GetAttribute ( "switches", false );
1141 switches
= att
->value
;
1147 InvokeFile::ProcessXML()
1152 Dependency::Dependency ( const XMLElement
& _node
,
1153 const Module
& _module
)
1156 dependencyModule (NULL
)
1161 Dependency::ProcessXML()
1163 dependencyModule
= module
.project
.LocateModule ( node
.value
);
1164 if ( dependencyModule
== NULL
)
1165 throw InvalidBuildFileException ( node
.location
,
1166 "module '%s' depend on non-existant module '%s'",
1167 module
.name
.c_str(),
1168 node
.value
.c_str() );
1172 ImportLibrary::ImportLibrary ( const XMLElement
& _node
,
1173 const Module
& _module
)
1177 const XMLAttribute
* att
= _node
.GetAttribute ( "basename", false );
1179 basename
= att
->value
;
1181 basename
= module
.name
;
1183 att
= _node
.GetAttribute ( "definition", true );
1185 definition
= FixSeparator(att
->value
);
1189 If::If ( const XMLElement
& node_
,
1190 const Project
& project_
,
1191 const Module
* module_
,
1192 const bool negated_
)
1193 : node(node_
), project(project_
), module(module_
), negated(negated_
)
1195 const XMLAttribute
* att
;
1197 att
= node
.GetAttribute ( "property", true );
1199 property
= att
->value
;
1201 att
= node
.GetAttribute ( "value", true );
1216 Property::Property ( const XMLElement
& node_
,
1217 const Project
& project_
,
1218 const Module
* module_
)
1219 : node(node_
), project(project_
), module(module_
)
1221 const XMLAttribute
* att
;
1223 att
= node
.GetAttribute ( "name", true );
1227 att
= node
.GetAttribute ( "value", true );
1233 Property::ProcessXML()
1239 const XMLElement
& node_
,
1240 const Module
& module_
,
1242 : node(node_
), module(module_
), file(file_
)
1247 PchFile::ProcessXML()