- Enable ROS_LEAN_AND_MEAN if you want 50% smaller binaries and a 20MB reduction...
[reactos.git] / reactos / tools / rbuild / rbuild.h
1 /*
2 * Copyright (C) 2005 Casper S. Hornstrup
3 *
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.
8 *
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.
13 *
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.
17 */
18 #ifndef __RBUILD_H
19 #define __RBUILD_H
20
21 #include "pch.h"
22
23 #ifdef WIN32
24 #include <direct.h>
25 #include <io.h>
26 #endif/*WIN32*/
27 #include <sys/stat.h>
28 #include <time.h>
29 #ifdef _MSC_VER
30 #include <sys/utime.h>
31 #else/*_MSC_VER*/
32 #include <utime.h>
33 #ifdef WIN32
34 #include <process.h>
35 #endif/*WIN32*/
36 #endif/*_MSC_VER*/
37
38 #include <infhost.h>
39
40 #include "ssprintf.h"
41 #include "exception.h"
42 #include "xml.h"
43
44 class Backend; // forward declaration
45
46 typedef std::vector<std::string> string_list;
47
48 extern std::string ExePrefix;
49 extern std::string ExePostfix;
50 extern std::string sSep;
51 extern std::string sBadSep;
52 extern char cSep;
53 extern char cBadSep;
54
55 #ifdef WIN32
56 #define DEF_EXEPREFIX ""
57 #define DEF_EXEPOSTFIX ".exe"
58 #define DEF_CSEP '\\'
59 #define DEF_CBAD_SEP '/'
60 #define DEF_SSEP "\\"
61 #define DEF_SBAD_SEP "/"
62 #else
63 #define DEF_EXEPREFIX "./"
64 #define DEF_EXEPOSTFIX ""
65 #define DEF_CSEP '/'
66 #define DEF_CBAD_SEP '\\'
67 #define DEF_SSEP "/"
68 #define DEF_SBAD_SEP "\\"
69 #endif
70
71 #define MS_VS_DEF_VERSION "7.10"
72
73 class Directory;
74 class Project;
75 class IfableData;
76 class Module;
77 class Include;
78 class Define;
79 class File;
80 class Library;
81 class Invoke;
82 class InvokeFile;
83 class Dependency;
84 class ImportLibrary;
85 class If;
86 class CompilerFlag;
87 class LinkerFlag;
88 class LinkerScript;
89 class Property;
90 class TestSupportCode;
91 class WineResource;
92 class AutomaticDependency;
93 class Bootstrap;
94 class CDFile;
95 class InstallFile;
96 class PchFile;
97 class StubbedComponent;
98 class StubbedSymbol;
99 class CompilationUnit;
100 class FileLocation;
101 class AutoRegister;
102
103 class SourceFileTest;
104
105
106 typedef std::map<std::string,Directory*> directory_map;
107
108 class Directory
109 {
110 public:
111 std::string name;
112 directory_map subdirs;
113 Directory ( const std::string& name );
114 void Add ( const char* subdir );
115 void GenerateTree ( const std::string& parent,
116 bool verbose );
117 std::string EscapeSpaces ( std::string path );
118 void CreateRule ( FILE* f,
119 const std::string& parent );
120 private:
121 bool mkdir_p ( const char* path );
122 std::string ReplaceVariable ( std::string name,
123 std::string value,
124 std::string path );
125 std::string GetEnvironmentVariable ( const std::string& name );
126 void ResolveVariablesInPath ( char* buf,
127 std::string path );
128 bool CreateDirectory ( std::string path );
129 };
130
131
132 class Configuration
133 {
134 public:
135 Configuration ();
136 ~Configuration ();
137 bool Verbose;
138 bool CleanAsYouGo;
139 bool AutomaticDependencies;
140 bool CheckDependenciesForModuleOnly;
141 bool CompilationUnitsEnabled;
142 std::string CheckDependenciesForModuleOnlyModule;
143 std::string VSProjectVersion;
144 std::string VSConfigurationType;
145 bool MakeHandlesInstallDirectories;
146 bool GenerateProxyMakefilesInSourceTree;
147 bool InstallFiles;
148 };
149
150 class Environment
151 {
152 public:
153 static std::string GetVariable ( const std::string& name );
154 static std::string GetIntermediatePath ();
155 static std::string GetOutputPath ();
156 static std::string GetInstallPath ();
157 static std::string GetEnvironmentVariablePathOrDefault ( const std::string& name,
158 const std::string& defaultValue );
159 };
160
161
162 class FileSupportCode
163 {
164 public:
165 static void WriteIfChanged ( char* outbuf,
166 std::string filename );
167 };
168
169
170 class ParseContext
171 {
172 public:
173 If* ifData;
174 CompilationUnit* compilationUnit;
175 ParseContext ();
176 };
177
178
179 class IfableData
180 {
181 public:
182 std::vector<CompilationUnit*> compilationUnits;
183 std::vector<File*> files;
184 std::vector<Include*> includes;
185 std::vector<Define*> defines;
186 std::vector<Library*> libraries;
187 std::vector<Property*> properties;
188 std::vector<Module*> modules;
189 std::vector<CompilerFlag*> compilerFlags;
190 std::vector<If*> ifs;
191
192 ~IfableData();
193 void ProcessXML();
194 void ExtractModules( std::vector<Module*> &modules );
195 };
196
197 class Project
198 {
199 std::string xmlfile;
200 XMLElement *node, *head;
201 Backend* _backend;
202 public:
203 const Configuration& configuration;
204 std::string name;
205 std::string makefile;
206 XMLIncludes xmlbuildfiles;
207 std::vector<LinkerFlag*> linkerFlags;
208 std::vector<CDFile*> cdfiles;
209 std::vector<InstallFile*> installfiles;
210 std::vector<Module*> modules;
211 IfableData non_if_data;
212
213 Project ( const Configuration& configuration,
214 const std::string& filename );
215 ~Project ();
216 void SetBackend ( Backend* backend ) { _backend = backend; }
217 Backend& GetBackend() { return *_backend; }
218 void WriteConfigurationFile ();
219 void ExecuteInvocations ();
220
221 void ProcessXML ( const std::string& path );
222 Module* LocateModule ( const std::string& name );
223 const Module* LocateModule ( const std::string& name ) const;
224 std::string GetProjectFilename () const;
225 std::string ResolveProperties ( const std::string& s ) const;
226 private:
227 std::string ResolveNextProperty ( std::string& s ) const;
228 const Property* LookupProperty ( const std::string& name ) const;
229 void SetConfigurationOption ( char* s,
230 std::string name,
231 std::string* alternativeName );
232 void SetConfigurationOption ( char* s,
233 std::string name );
234 void ReadXml ();
235 void ProcessXMLSubElement ( const XMLElement& e,
236 const std::string& path,
237 ParseContext& parseContext );
238
239 // disable copy semantics
240 Project ( const Project& );
241 Project& operator = ( const Project& );
242 };
243
244
245 enum ModuleType
246 {
247 BuildTool = 0,
248 StaticLibrary = 1,
249 ObjectLibrary = 2,
250 Kernel = 3,
251 KernelModeDLL = 4,
252 KernelModeDriver = 5,
253 NativeDLL = 6,
254 NativeCUI = 7,
255 Win32DLL = 8,
256 Win32CUI = 9,
257 Win32GUI = 10,
258 BootLoader = 11,
259 BootSector = 12,
260 Iso = 13,
261 LiveIso = 14,
262 Test = 15,
263 RpcServer = 16,
264 RpcClient = 17,
265 Alias = 18,
266 BootProgram = 19,
267 Win32SCR = 20,
268 ExportDriver = 21
269 };
270
271 enum HostType
272 {
273 HostFalse,
274 HostDefault,
275 HostTrue
276 };
277
278 class Module
279 {
280 public:
281 const Project& project;
282 const XMLElement& node;
283 std::string xmlbuildFile;
284 std::string name;
285 std::string guid;
286 std::string extension;
287 std::string entrypoint;
288 std::string baseaddress;
289 std::string payload;
290 std::string path;
291 ModuleType type;
292 ImportLibrary* importLibrary;
293 bool mangledSymbols;
294 bool isUnicode;
295 Bootstrap* bootstrap;
296 AutoRegister* autoRegister;
297 IfableData non_if_data;
298 std::vector<Invoke*> invocations;
299 std::vector<Dependency*> dependencies;
300 std::vector<CompilerFlag*> compilerFlags;
301 std::vector<LinkerFlag*> linkerFlags;
302 std::vector<StubbedComponent*> stubbedComponents;
303 LinkerScript* linkerScript;
304 PchFile* pch;
305 bool cplusplus;
306 std::string prefix;
307 HostType host;
308 std::string installBase;
309 std::string installName;
310 std::string aliasedModuleName;
311 bool useWRC;
312 bool allowWarnings;
313 bool enabled;
314
315 Module ( const Project& project,
316 const XMLElement& moduleNode,
317 const std::string& modulePath );
318 ~Module ();
319 ModuleType GetModuleType ( const std::string& location,
320 const XMLAttribute& attribute );
321 bool HasImportLibrary () const;
322 bool IsDLL () const;
323 bool GenerateInOutputTree () const;
324 std::string GetTargetName () const; // "foo.exe"
325 std::string GetDependencyPath () const; // "path/foo.exe" or "path/libfoo.a"
326 std::string GetBasePath () const; // "path"
327 std::string GetPath () const; // "path/foo.exe"
328 std::string GetPathWithPrefix ( const std::string& prefix ) const; // "path/prefixfoo.exe"
329 std::string GetPathToBaseDir() const; // "../" offset to rootdirectory
330 void GetTargets ( string_list& ) const;
331 std::string GetInvocationTarget ( const int index ) const;
332 bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const;
333 void InvokeModule () const;
334 void ProcessXML ();
335 void GetSourceFilenames ( string_list& list,
336 bool includeGeneratedFiles ) const;
337 private:
338 std::string GetDefaultModuleExtension () const;
339 std::string GetDefaultModuleEntrypoint () const;
340 std::string GetDefaultModuleBaseaddress () const;
341 void ProcessXMLSubElement ( const XMLElement& e,
342 const std::string& path,
343 ParseContext& parseContext );
344 };
345
346
347 class Include
348 {
349 public:
350 const Project& project;
351 const Module* module;
352 const XMLElement* node;
353 const Module* baseModule;
354 std::string directory;
355 std::string basePath;
356
357 Include ( const Project& project,
358 const XMLElement* includeNode );
359 Include ( const Project& project,
360 const Module* module,
361 const XMLElement* includeNode );
362 Include ( const Project& project,
363 std::string directory,
364 std::string basePath );
365 ~Include ();
366 void ProcessXML();
367 private:
368 };
369
370
371 class Define
372 {
373 public:
374 const Project& project;
375 const Module* module;
376 const XMLElement& node;
377 std::string name;
378 std::string value;
379
380 Define ( const Project& project,
381 const XMLElement& defineNode );
382 Define ( const Project& project,
383 const Module* module,
384 const XMLElement& defineNode );
385 ~Define();
386 void ProcessXML();
387 private:
388 void Initialize();
389 };
390
391
392 class File
393 {
394 public:
395 std::string name;
396 bool first;
397 std::string switches;
398 bool isPreCompiledHeader;
399
400 File ( const std::string& _name,
401 bool _first,
402 std::string _switches,
403 bool _isPreCompiledHeader );
404
405 void ProcessXML();
406 };
407
408
409 class Library
410 {
411 public:
412 const XMLElement& node;
413 const Module& module;
414 std::string name;
415 const Module* importedModule;
416
417 Library ( const XMLElement& _node,
418 const Module& _module,
419 const std::string& _name );
420
421 void ProcessXML();
422 };
423
424
425 class Invoke
426 {
427 public:
428 const XMLElement& node;
429 const Module& module;
430 const Module* invokeModule;
431 std::vector<InvokeFile*> input;
432 std::vector<InvokeFile*> output;
433
434 Invoke ( const XMLElement& _node,
435 const Module& _module );
436
437 void ProcessXML();
438 void GetTargets ( string_list& targets ) const;
439 std::string GetParameters () const;
440 private:
441 void ProcessXMLSubElement ( const XMLElement& e );
442 void ProcessXMLSubElementInput ( const XMLElement& e );
443 void ProcessXMLSubElementOutput ( const XMLElement& e );
444 };
445
446
447 class InvokeFile
448 {
449 public:
450 const XMLElement& node;
451 std::string name;
452 std::string switches;
453
454 InvokeFile ( const XMLElement& _node,
455 const std::string& _name );
456
457 void ProcessXML ();
458 };
459
460
461 class Dependency
462 {
463 public:
464 const XMLElement& node;
465 const Module& module;
466 const Module* dependencyModule;
467
468 Dependency ( const XMLElement& _node,
469 const Module& _module );
470
471 void ProcessXML();
472 };
473
474
475 class ImportLibrary
476 {
477 public:
478 const XMLElement& node;
479 const Module& module;
480 std::string basename;
481 std::string definition;
482
483 ImportLibrary ( const XMLElement& _node,
484 const Module& module );
485
486 void ProcessXML ();
487 };
488
489
490 class If
491 {
492 public:
493 const XMLElement& node;
494 const Project& project;
495 const Module* module;
496 const bool negated;
497 std::string property, value;
498 IfableData data;
499
500 If ( const XMLElement& node_,
501 const Project& project_,
502 const Module* module_,
503 const bool negated_ = false );
504 ~If();
505
506 void ProcessXML();
507 };
508
509
510 class CompilerFlag
511 {
512 public:
513 const Project& project;
514 const Module* module;
515 const XMLElement& node;
516 std::string flag;
517
518 CompilerFlag ( const Project& project,
519 const XMLElement& compilerFlagNode );
520 CompilerFlag ( const Project& project,
521 const Module* module,
522 const XMLElement& compilerFlagNode );
523 ~CompilerFlag ();
524 void ProcessXML();
525 private:
526 void Initialize();
527 };
528
529
530 class LinkerFlag
531 {
532 public:
533 const Project& project;
534 const Module* module;
535 const XMLElement& node;
536 std::string flag;
537
538 LinkerFlag ( const Project& project,
539 const XMLElement& linkerFlagNode );
540 LinkerFlag ( const Project& project,
541 const Module* module,
542 const XMLElement& linkerFlagNode );
543 ~LinkerFlag ();
544 void ProcessXML();
545 private:
546 void Initialize();
547 };
548
549
550 class LinkerScript
551 {
552 public:
553 const Project& project;
554 const Module* module;
555 const XMLElement& node;
556 const Module* baseModule;
557 std::string directory;
558 std::string basePath;
559
560 LinkerScript ( const Project& project,
561 const Module* module,
562 const XMLElement& node );
563 ~LinkerScript ();
564 void ProcessXML();
565 };
566
567
568 class Property
569 {
570 public:
571 const XMLElement& node;
572 const Project& project;
573 const Module* module;
574 std::string name, value;
575
576 Property ( const XMLElement& node_,
577 const Project& project_,
578 const Module* module_ );
579
580 void ProcessXML();
581 };
582
583
584 class TestSupportCode
585 {
586 public:
587 const Project& project;
588
589 TestSupportCode ( const Project& project );
590 ~TestSupportCode ();
591 void GenerateTestSupportCode ( bool verbose );
592 private:
593 bool IsTestModule ( const Module& module );
594 void GenerateTestSupportCodeForModule ( Module& module,
595 bool verbose );
596 std::string GetHooksFilename ( Module& module );
597 char* WriteStubbedSymbolToHooksFile ( char* buffer,
598 const StubbedComponent& component,
599 const StubbedSymbol& symbol );
600 char* WriteStubbedComponentToHooksFile ( char* buffer,
601 const StubbedComponent& component );
602 void WriteHooksFile ( Module& module );
603 std::string GetStubsFilename ( Module& module );
604 char* WriteStubbedSymbolToStubsFile ( char* buffer,
605 const StubbedComponent& component,
606 const StubbedSymbol& symbol,
607 int stubIndex );
608 char* WriteStubbedComponentToStubsFile ( char* buffer,
609 const StubbedComponent& component,
610 int* stubIndex );
611 void WriteStubsFile ( Module& module );
612 std::string GetStartupFilename ( Module& module );
613 bool IsUnknownCharacter ( char ch );
614 std::string GetTestDispatcherName ( std::string filename );
615 bool IsTestFile ( std::string& filename ) const;
616 void GetSourceFilenames ( string_list& list,
617 Module& module ) const;
618 char* WriteTestDispatcherPrototypesToStartupFile ( char* buffer,
619 Module& module );
620 char* WriteRegisterTestsFunctionToStartupFile ( char* buffer,
621 Module& module );
622 void WriteStartupFile ( Module& module );
623 };
624
625
626 class WineResource
627 {
628 public:
629 const Project& project;
630 std::string bin2res;
631
632 WineResource ( const Project& project,
633 std::string bin2res );
634 ~WineResource ();
635 void UnpackResources ( bool verbose );
636 private:
637 bool IsSpecFile ( const File& file );
638 bool IsWineModule ( const Module& module );
639 bool IsResourceFile ( const File& file );
640 std::string GetResourceFilename ( const Module& module );
641 void UnpackResourcesInModule ( Module& module,
642 bool verbose );
643 };
644
645
646 class SourceFile
647 {
648 public:
649 SourceFile ( AutomaticDependency* automaticDependency,
650 const Module& module,
651 const std::string& filename,
652 SourceFile* parent,
653 bool isNonAutomaticDependency );
654 SourceFile* ParseFile ( const std::string& normalizedFilename );
655 void Parse ();
656 std::string Location () const;
657 std::vector<SourceFile*> files;
658 AutomaticDependency* automaticDependency;
659 const Module& module;
660 std::string filename;
661 std::string filenamePart;
662 std::string directoryPart;
663 std::vector<SourceFile*> parents; /* List of files, this file is included from */
664 bool isNonAutomaticDependency;
665 std::string cachedDependencies;
666 time_t lastWriteTime;
667 time_t youngestLastWriteTime; /* Youngest last write time of this file and all children */
668 SourceFile* youngestFile;
669 private:
670 void GetDirectoryAndFilenameParts ();
671 void Close ();
672 void Open ();
673 void SkipWhitespace ();
674 bool ReadInclude ( std::string& filename,
675 bool& searchCurrentDirectory,
676 bool& includeNext );
677 bool IsIncludedFrom ( const std::string& normalizedFilename );
678 SourceFile* GetParentSourceFile ();
679 bool CanProcessFile ( const std::string& extension );
680 bool IsParentOf ( const SourceFile* parent,
681 const SourceFile* child );
682 std::string buf;
683 const char *p;
684 const char *end;
685 };
686
687
688 class AutomaticDependency
689 {
690 friend class SourceFileTest;
691 public:
692 const Project& project;
693
694 AutomaticDependency ( const Project& project );
695 ~AutomaticDependency ();
696 std::string GetFilename ( const std::string& filename );
697 bool LocateIncludedFile ( const std::string& directory,
698 const std::string& includedFilename,
699 std::string& resolvedFilename );
700 bool LocateIncludedFile ( SourceFile* sourceFile,
701 const Module& module,
702 const std::string& includedFilename,
703 bool searchCurrentDirectory,
704 bool includeNext,
705 std::string& resolvedFilename );
706 SourceFile* RetrieveFromCacheOrParse ( const Module& module,
707 const std::string& filename,
708 SourceFile* parentSourceFile );
709 SourceFile* RetrieveFromCache ( const std::string& filename );
710 void CheckAutomaticDependencies ( bool verbose );
711 void CheckAutomaticDependenciesForModule ( Module& module,
712 bool verbose );
713 private:
714 void GetModulesToCheck ( Module& module, std::vector<const Module*>& modules );
715 void CheckAutomaticDependencies ( const Module& module,
716 bool verbose );
717 void CheckAutomaticDependenciesForFile ( SourceFile* sourceFile );
718 void GetIncludeDirectories ( std::vector<Include*>& includes,
719 const Module& module,
720 Include& currentDirectory,
721 bool searchCurrentDirectory );
722 void GetModuleFiles ( const Module& module,
723 std::vector<File*>& files ) const;
724 void ParseFiles ();
725 void ParseFiles ( const Module& module );
726 void ParseFile ( const Module& module,
727 const File& file );
728 std::map<std::string, SourceFile*> sourcefile_map;
729 };
730
731
732 class Bootstrap
733 {
734 public:
735 const Project& project;
736 const Module* module;
737 const XMLElement& node;
738 std::string base;
739 std::string nameoncd;
740
741 Bootstrap ( const Project& project,
742 const Module* module,
743 const XMLElement& bootstrapNode );
744 ~Bootstrap ();
745 void ProcessXML();
746 private:
747 bool IsSupportedModuleType ( ModuleType type );
748 void Initialize();
749 };
750
751
752 class CDFile
753 {
754 public:
755 const Project& project;
756 const XMLElement& node;
757 std::string name;
758 std::string base;
759 std::string nameoncd;
760 std::string path;
761
762 CDFile ( const Project& project,
763 const XMLElement& bootstrapNode,
764 const std::string& path );
765 ~CDFile ();
766 void ProcessXML();
767 std::string GetPath () const;
768 };
769
770
771 class InstallFile
772 {
773 public:
774 const Project& project;
775 const XMLElement& node;
776 std::string name;
777 std::string base;
778 std::string newname;
779 std::string path;
780
781 InstallFile ( const Project& project,
782 const XMLElement& bootstrapNode,
783 const std::string& path );
784 ~InstallFile ();
785 void ProcessXML ();
786 std::string GetPath () const;
787 };
788
789
790 class PchFile
791 {
792 public:
793 const XMLElement& node;
794 const Module& module;
795 File file;
796
797 PchFile (
798 const XMLElement& node,
799 const Module& module,
800 const File file );
801 void ProcessXML();
802 };
803
804
805 class StubbedComponent
806 {
807 public:
808 const Module* module;
809 const XMLElement& node;
810 std::string name;
811 std::vector<StubbedSymbol*> symbols;
812
813 StubbedComponent ( const Module* module_,
814 const XMLElement& stubbedComponentNode );
815 ~StubbedComponent ();
816 void ProcessXML ();
817 void ProcessXMLSubElement ( const XMLElement& e );
818 };
819
820
821 class StubbedSymbol
822 {
823 public:
824 const XMLElement& node;
825 std::string symbol;
826 std::string newname;
827 std::string strippedName;
828
829 StubbedSymbol ( const XMLElement& stubbedSymbolNode );
830 ~StubbedSymbol ();
831 void ProcessXML();
832 private:
833 std::string StripSymbol ( std::string symbol );
834 };
835
836
837 class CompilationUnit
838 {
839 public:
840 const Project* project;
841 const Module* module;
842 const XMLElement* node;
843 std::string name;
844 std::vector<File*> files;
845
846 CompilationUnit ( File* file );
847 CompilationUnit ( const Project* project,
848 const Module* module,
849 const XMLElement* node );
850 ~CompilationUnit ();
851 void ProcessXML();
852 bool IsGeneratedFile () const;
853 bool HasFileWithExtension ( const std::string& extension ) const;
854 bool IsFirstFile () const;
855 FileLocation* GetFilename ( Directory* intermediateDirectory ) const;
856 std::string GetSwitches () const;
857 };
858
859
860 class CompilationUnitSupportCode
861 {
862 public:
863 const Project& project;
864
865 CompilationUnitSupportCode ( const Project& project );
866 ~CompilationUnitSupportCode ();
867 void Generate ( bool verbose );
868 private:
869 void GenerateForModule ( Module& module,
870 bool verbose );
871 std::string GetCompilationUnitFilename ( Module& module,
872 CompilationUnit& compilationUnit );
873 void WriteCompilationUnitFile ( Module& module,
874 CompilationUnit& compilationUnit );
875 };
876
877
878 class FileLocation
879 {
880 public:
881 Directory* directory;
882 std::string filename;
883 FileLocation ( Directory* directory,
884 std::string filename );
885 };
886
887
888 enum AutoRegisterType
889 {
890 DllRegisterServer,
891 DllInstall,
892 Both
893 };
894
895 class AutoRegister
896 {
897 public:
898 const Project& project;
899 const Module* module;
900 const XMLElement& node;
901 std::string infSection;
902 AutoRegisterType type;
903 AutoRegister ( const Project& project_,
904 const Module* module_,
905 const XMLElement& node_ );
906 ~AutoRegister ();
907 void ProcessXML();
908 private:
909 bool IsSupportedModuleType ( ModuleType type );
910 AutoRegisterType GetAutoRegisterType( std::string type );
911 void Initialize ();
912 };
913
914
915 class SysSetupGenerator
916 {
917 public:
918 const Project& project;
919 SysSetupGenerator ( const Project& project );
920 ~SysSetupGenerator ();
921 void Generate ();
922 private:
923 std::string GetDirectoryId ( const Module& module );
924 std::string GetFlags ( const Module& module );
925 void Generate ( HINF inf,
926 const Module& module );
927 };
928
929
930 extern void
931 InitializeEnvironment ();
932
933 extern std::string
934 Right ( const std::string& s, size_t n );
935
936 extern std::string
937 Replace ( const std::string& s, const std::string& find, const std::string& with );
938
939 extern std::string
940 ChangeSeparator ( const std::string& s,
941 const char fromSeparator,
942 const char toSeparator );
943
944 extern std::string
945 FixSeparator ( const std::string& s );
946
947 extern std::string
948 FixSeparatorForSystemCommand ( const std::string& s );
949
950 extern std::string
951 DosSeparator ( const std::string& s );
952
953 extern std::string
954 ReplaceExtension (
955 const std::string& filename,
956 const std::string& newExtension );
957
958 extern std::string
959 GetSubPath (
960 const std::string& location,
961 const std::string& path,
962 const std::string& att_value );
963
964 extern std::string
965 GetExtension ( const std::string& filename );
966
967 extern std::string
968 GetDirectory ( const std::string& filename );
969
970 extern std::string
971 GetFilename ( const std::string& filename );
972
973 extern std::string
974 NormalizeFilename ( const std::string& filename );
975
976 extern std::string
977 ToLower ( std::string filename );
978
979 #endif /* __RBUILD_H */