f6b9df7edf8781eea7590a3bbfedfdbe49430bfd
[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 };
268
269 enum HostType
270 {
271 HostFalse,
272 HostDefault,
273 HostTrue
274 };
275
276 class Module
277 {
278 public:
279 const Project& project;
280 const XMLElement& node;
281 std::string xmlbuildFile;
282 std::string name;
283 std::string guid;
284 std::string extension;
285 std::string entrypoint;
286 std::string baseaddress;
287 std::string payload;
288 std::string path;
289 ModuleType type;
290 ImportLibrary* importLibrary;
291 bool mangledSymbols;
292 bool isUnicode;
293 Bootstrap* bootstrap;
294 AutoRegister* autoRegister;
295 IfableData non_if_data;
296 std::vector<Invoke*> invocations;
297 std::vector<Dependency*> dependencies;
298 std::vector<CompilerFlag*> compilerFlags;
299 std::vector<LinkerFlag*> linkerFlags;
300 std::vector<StubbedComponent*> stubbedComponents;
301 LinkerScript* linkerScript;
302 PchFile* pch;
303 bool cplusplus;
304 std::string prefix;
305 HostType host;
306 std::string installBase;
307 std::string installName;
308 std::string aliasedModuleName;
309 bool useWRC;
310 bool allowWarnings;
311 bool enabled;
312
313 Module ( const Project& project,
314 const XMLElement& moduleNode,
315 const std::string& modulePath );
316 ~Module ();
317 ModuleType GetModuleType ( const std::string& location,
318 const XMLAttribute& attribute );
319 bool HasImportLibrary () const;
320 bool IsDLL () const;
321 bool GenerateInOutputTree () const;
322 std::string GetTargetName () const; // "foo.exe"
323 std::string GetDependencyPath () const; // "path/foo.exe" or "path/libfoo.a"
324 std::string GetBasePath () const; // "path"
325 std::string GetPath () const; // "path/foo.exe"
326 std::string GetPathWithPrefix ( const std::string& prefix ) const; // "path/prefixfoo.exe"
327 std::string GetPathToBaseDir() const; // "../" offset to rootdirectory
328 void GetTargets ( string_list& ) const;
329 std::string GetInvocationTarget ( const int index ) const;
330 bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const;
331 void InvokeModule () const;
332 void ProcessXML ();
333 void GetSourceFilenames ( string_list& list,
334 bool includeGeneratedFiles ) const;
335 private:
336 std::string GetDefaultModuleExtension () const;
337 std::string GetDefaultModuleEntrypoint () const;
338 std::string GetDefaultModuleBaseaddress () const;
339 void ProcessXMLSubElement ( const XMLElement& e,
340 const std::string& path,
341 ParseContext& parseContext );
342 };
343
344
345 class Include
346 {
347 public:
348 const Project& project;
349 const Module* module;
350 const XMLElement* node;
351 const Module* baseModule;
352 std::string directory;
353 std::string basePath;
354
355 Include ( const Project& project,
356 const XMLElement* includeNode );
357 Include ( const Project& project,
358 const Module* module,
359 const XMLElement* includeNode );
360 Include ( const Project& project,
361 std::string directory,
362 std::string basePath );
363 ~Include ();
364 void ProcessXML();
365 private:
366 };
367
368
369 class Define
370 {
371 public:
372 const Project& project;
373 const Module* module;
374 const XMLElement& node;
375 std::string name;
376 std::string value;
377
378 Define ( const Project& project,
379 const XMLElement& defineNode );
380 Define ( const Project& project,
381 const Module* module,
382 const XMLElement& defineNode );
383 ~Define();
384 void ProcessXML();
385 private:
386 void Initialize();
387 };
388
389
390 class File
391 {
392 public:
393 std::string name;
394 bool first;
395 std::string switches;
396 bool isPreCompiledHeader;
397
398 File ( const std::string& _name,
399 bool _first,
400 std::string _switches,
401 bool _isPreCompiledHeader );
402
403 void ProcessXML();
404 };
405
406
407 class Library
408 {
409 public:
410 const XMLElement& node;
411 const Module& module;
412 std::string name;
413 const Module* importedModule;
414
415 Library ( const XMLElement& _node,
416 const Module& _module,
417 const std::string& _name );
418
419 void ProcessXML();
420 };
421
422
423 class Invoke
424 {
425 public:
426 const XMLElement& node;
427 const Module& module;
428 const Module* invokeModule;
429 std::vector<InvokeFile*> input;
430 std::vector<InvokeFile*> output;
431
432 Invoke ( const XMLElement& _node,
433 const Module& _module );
434
435 void ProcessXML();
436 void GetTargets ( string_list& targets ) const;
437 std::string GetParameters () const;
438 private:
439 void ProcessXMLSubElement ( const XMLElement& e );
440 void ProcessXMLSubElementInput ( const XMLElement& e );
441 void ProcessXMLSubElementOutput ( const XMLElement& e );
442 };
443
444
445 class InvokeFile
446 {
447 public:
448 const XMLElement& node;
449 std::string name;
450 std::string switches;
451
452 InvokeFile ( const XMLElement& _node,
453 const std::string& _name );
454
455 void ProcessXML ();
456 };
457
458
459 class Dependency
460 {
461 public:
462 const XMLElement& node;
463 const Module& module;
464 const Module* dependencyModule;
465
466 Dependency ( const XMLElement& _node,
467 const Module& _module );
468
469 void ProcessXML();
470 };
471
472
473 class ImportLibrary
474 {
475 public:
476 const XMLElement& node;
477 const Module& module;
478 std::string basename;
479 std::string definition;
480
481 ImportLibrary ( const XMLElement& _node,
482 const Module& module );
483
484 void ProcessXML ();
485 };
486
487
488 class If
489 {
490 public:
491 const XMLElement& node;
492 const Project& project;
493 const Module* module;
494 const bool negated;
495 std::string property, value;
496 IfableData data;
497
498 If ( const XMLElement& node_,
499 const Project& project_,
500 const Module* module_,
501 const bool negated_ = false );
502 ~If();
503
504 void ProcessXML();
505 };
506
507
508 class CompilerFlag
509 {
510 public:
511 const Project& project;
512 const Module* module;
513 const XMLElement& node;
514 std::string flag;
515
516 CompilerFlag ( const Project& project,
517 const XMLElement& compilerFlagNode );
518 CompilerFlag ( const Project& project,
519 const Module* module,
520 const XMLElement& compilerFlagNode );
521 ~CompilerFlag ();
522 void ProcessXML();
523 private:
524 void Initialize();
525 };
526
527
528 class LinkerFlag
529 {
530 public:
531 const Project& project;
532 const Module* module;
533 const XMLElement& node;
534 std::string flag;
535
536 LinkerFlag ( const Project& project,
537 const XMLElement& linkerFlagNode );
538 LinkerFlag ( const Project& project,
539 const Module* module,
540 const XMLElement& linkerFlagNode );
541 ~LinkerFlag ();
542 void ProcessXML();
543 private:
544 void Initialize();
545 };
546
547
548 class LinkerScript
549 {
550 public:
551 const Project& project;
552 const Module* module;
553 const XMLElement& node;
554 const Module* baseModule;
555 std::string directory;
556 std::string basePath;
557
558 LinkerScript ( const Project& project,
559 const Module* module,
560 const XMLElement& node );
561 ~LinkerScript ();
562 void ProcessXML();
563 };
564
565
566 class Property
567 {
568 public:
569 const XMLElement& node;
570 const Project& project;
571 const Module* module;
572 std::string name, value;
573
574 Property ( const XMLElement& node_,
575 const Project& project_,
576 const Module* module_ );
577
578 void ProcessXML();
579 };
580
581
582 class TestSupportCode
583 {
584 public:
585 const Project& project;
586
587 TestSupportCode ( const Project& project );
588 ~TestSupportCode ();
589 void GenerateTestSupportCode ( bool verbose );
590 private:
591 bool IsTestModule ( const Module& module );
592 void GenerateTestSupportCodeForModule ( Module& module,
593 bool verbose );
594 std::string GetHooksFilename ( Module& module );
595 char* WriteStubbedSymbolToHooksFile ( char* buffer,
596 const StubbedComponent& component,
597 const StubbedSymbol& symbol );
598 char* WriteStubbedComponentToHooksFile ( char* buffer,
599 const StubbedComponent& component );
600 void WriteHooksFile ( Module& module );
601 std::string GetStubsFilename ( Module& module );
602 char* WriteStubbedSymbolToStubsFile ( char* buffer,
603 const StubbedComponent& component,
604 const StubbedSymbol& symbol,
605 int stubIndex );
606 char* WriteStubbedComponentToStubsFile ( char* buffer,
607 const StubbedComponent& component,
608 int* stubIndex );
609 void WriteStubsFile ( Module& module );
610 std::string GetStartupFilename ( Module& module );
611 bool IsUnknownCharacter ( char ch );
612 std::string GetTestDispatcherName ( std::string filename );
613 bool IsTestFile ( std::string& filename ) const;
614 void GetSourceFilenames ( string_list& list,
615 Module& module ) const;
616 char* WriteTestDispatcherPrototypesToStartupFile ( char* buffer,
617 Module& module );
618 char* WriteRegisterTestsFunctionToStartupFile ( char* buffer,
619 Module& module );
620 void WriteStartupFile ( Module& module );
621 };
622
623
624 class WineResource
625 {
626 public:
627 const Project& project;
628 std::string bin2res;
629
630 WineResource ( const Project& project,
631 std::string bin2res );
632 ~WineResource ();
633 void UnpackResources ( bool verbose );
634 private:
635 bool IsSpecFile ( const File& file );
636 bool IsWineModule ( const Module& module );
637 bool IsResourceFile ( const File& file );
638 std::string GetResourceFilename ( const Module& module );
639 void UnpackResourcesInModule ( Module& module,
640 bool verbose );
641 };
642
643
644 class SourceFile
645 {
646 public:
647 SourceFile ( AutomaticDependency* automaticDependency,
648 const Module& module,
649 const std::string& filename,
650 SourceFile* parent,
651 bool isNonAutomaticDependency );
652 SourceFile* ParseFile ( const std::string& normalizedFilename );
653 void Parse ();
654 std::string Location () const;
655 std::vector<SourceFile*> files;
656 AutomaticDependency* automaticDependency;
657 const Module& module;
658 std::string filename;
659 std::string filenamePart;
660 std::string directoryPart;
661 std::vector<SourceFile*> parents; /* List of files, this file is included from */
662 bool isNonAutomaticDependency;
663 std::string cachedDependencies;
664 time_t lastWriteTime;
665 time_t youngestLastWriteTime; /* Youngest last write time of this file and all children */
666 SourceFile* youngestFile;
667 private:
668 void GetDirectoryAndFilenameParts ();
669 void Close ();
670 void Open ();
671 void SkipWhitespace ();
672 bool ReadInclude ( std::string& filename,
673 bool& searchCurrentDirectory,
674 bool& includeNext );
675 bool IsIncludedFrom ( const std::string& normalizedFilename );
676 SourceFile* GetParentSourceFile ();
677 bool CanProcessFile ( const std::string& extension );
678 bool IsParentOf ( const SourceFile* parent,
679 const SourceFile* child );
680 std::string buf;
681 const char *p;
682 const char *end;
683 };
684
685
686 class AutomaticDependency
687 {
688 friend class SourceFileTest;
689 public:
690 const Project& project;
691
692 AutomaticDependency ( const Project& project );
693 ~AutomaticDependency ();
694 std::string GetFilename ( const std::string& filename );
695 bool LocateIncludedFile ( const std::string& directory,
696 const std::string& includedFilename,
697 std::string& resolvedFilename );
698 bool LocateIncludedFile ( SourceFile* sourceFile,
699 const Module& module,
700 const std::string& includedFilename,
701 bool searchCurrentDirectory,
702 bool includeNext,
703 std::string& resolvedFilename );
704 SourceFile* RetrieveFromCacheOrParse ( const Module& module,
705 const std::string& filename,
706 SourceFile* parentSourceFile );
707 SourceFile* RetrieveFromCache ( const std::string& filename );
708 void CheckAutomaticDependencies ( bool verbose );
709 void CheckAutomaticDependenciesForModule ( Module& module,
710 bool verbose );
711 private:
712 void GetModulesToCheck ( Module& module, std::vector<const Module*>& modules );
713 void CheckAutomaticDependencies ( const Module& module,
714 bool verbose );
715 void CheckAutomaticDependenciesForFile ( SourceFile* sourceFile );
716 void GetIncludeDirectories ( std::vector<Include*>& includes,
717 const Module& module,
718 Include& currentDirectory,
719 bool searchCurrentDirectory );
720 void GetModuleFiles ( const Module& module,
721 std::vector<File*>& files ) const;
722 void ParseFiles ();
723 void ParseFiles ( const Module& module );
724 void ParseFile ( const Module& module,
725 const File& file );
726 std::map<std::string, SourceFile*> sourcefile_map;
727 };
728
729
730 class Bootstrap
731 {
732 public:
733 const Project& project;
734 const Module* module;
735 const XMLElement& node;
736 std::string base;
737 std::string nameoncd;
738
739 Bootstrap ( const Project& project,
740 const Module* module,
741 const XMLElement& bootstrapNode );
742 ~Bootstrap ();
743 void ProcessXML();
744 private:
745 bool IsSupportedModuleType ( ModuleType type );
746 void Initialize();
747 };
748
749
750 class CDFile
751 {
752 public:
753 const Project& project;
754 const XMLElement& node;
755 std::string name;
756 std::string base;
757 std::string nameoncd;
758 std::string path;
759
760 CDFile ( const Project& project,
761 const XMLElement& bootstrapNode,
762 const std::string& path );
763 ~CDFile ();
764 void ProcessXML();
765 std::string GetPath () const;
766 };
767
768
769 class InstallFile
770 {
771 public:
772 const Project& project;
773 const XMLElement& node;
774 std::string name;
775 std::string base;
776 std::string newname;
777 std::string path;
778
779 InstallFile ( const Project& project,
780 const XMLElement& bootstrapNode,
781 const std::string& path );
782 ~InstallFile ();
783 void ProcessXML ();
784 std::string GetPath () const;
785 };
786
787
788 class PchFile
789 {
790 public:
791 const XMLElement& node;
792 const Module& module;
793 File file;
794
795 PchFile (
796 const XMLElement& node,
797 const Module& module,
798 const File file );
799 void ProcessXML();
800 };
801
802
803 class StubbedComponent
804 {
805 public:
806 const Module* module;
807 const XMLElement& node;
808 std::string name;
809 std::vector<StubbedSymbol*> symbols;
810
811 StubbedComponent ( const Module* module_,
812 const XMLElement& stubbedComponentNode );
813 ~StubbedComponent ();
814 void ProcessXML ();
815 void ProcessXMLSubElement ( const XMLElement& e );
816 };
817
818
819 class StubbedSymbol
820 {
821 public:
822 const XMLElement& node;
823 std::string symbol;
824 std::string newname;
825 std::string strippedName;
826
827 StubbedSymbol ( const XMLElement& stubbedSymbolNode );
828 ~StubbedSymbol ();
829 void ProcessXML();
830 private:
831 std::string StripSymbol ( std::string symbol );
832 };
833
834
835 class CompilationUnit
836 {
837 public:
838 const Project* project;
839 const Module* module;
840 const XMLElement* node;
841 std::string name;
842 std::vector<File*> files;
843
844 CompilationUnit ( File* file );
845 CompilationUnit ( const Project* project,
846 const Module* module,
847 const XMLElement* node );
848 ~CompilationUnit ();
849 void ProcessXML();
850 bool IsGeneratedFile () const;
851 bool HasFileWithExtension ( const std::string& extension ) const;
852 bool IsFirstFile () const;
853 FileLocation* GetFilename ( Directory* intermediateDirectory ) const;
854 std::string GetSwitches () const;
855 };
856
857
858 class CompilationUnitSupportCode
859 {
860 public:
861 const Project& project;
862
863 CompilationUnitSupportCode ( const Project& project );
864 ~CompilationUnitSupportCode ();
865 void Generate ( bool verbose );
866 private:
867 void GenerateForModule ( Module& module,
868 bool verbose );
869 std::string GetCompilationUnitFilename ( Module& module,
870 CompilationUnit& compilationUnit );
871 void WriteCompilationUnitFile ( Module& module,
872 CompilationUnit& compilationUnit );
873 };
874
875
876 class FileLocation
877 {
878 public:
879 Directory* directory;
880 std::string filename;
881 FileLocation ( Directory* directory,
882 std::string filename );
883 };
884
885
886 enum AutoRegisterType
887 {
888 DllRegisterServer,
889 DllInstall,
890 Both
891 };
892
893 class AutoRegister
894 {
895 public:
896 const Project& project;
897 const Module* module;
898 const XMLElement& node;
899 std::string infSection;
900 AutoRegisterType type;
901 AutoRegister ( const Project& project_,
902 const Module* module_,
903 const XMLElement& node_ );
904 ~AutoRegister ();
905 void ProcessXML();
906 private:
907 bool IsSupportedModuleType ( ModuleType type );
908 AutoRegisterType GetAutoRegisterType( std::string type );
909 void Initialize ();
910 };
911
912
913 class SysSetupGenerator
914 {
915 public:
916 const Project& project;
917 SysSetupGenerator ( const Project& project );
918 ~SysSetupGenerator ();
919 void Generate ();
920 private:
921 std::string GetDirectoryId ( const Module& module );
922 std::string GetFlags ( const Module& module );
923 void Generate ( HINF inf,
924 const Module& module );
925 };
926
927
928 extern void
929 InitializeEnvironment ();
930
931 extern std::string
932 Right ( const std::string& s, size_t n );
933
934 extern std::string
935 Replace ( const std::string& s, const std::string& find, const std::string& with );
936
937 extern std::string
938 ChangeSeparator ( const std::string& s,
939 const char fromSeparator,
940 const char toSeparator );
941
942 extern std::string
943 FixSeparator ( const std::string& s );
944
945 extern std::string
946 FixSeparatorForSystemCommand ( const std::string& s );
947
948 extern std::string
949 DosSeparator ( const std::string& s );
950
951 extern std::string
952 ReplaceExtension (
953 const std::string& filename,
954 const std::string& newExtension );
955
956 extern std::string
957 GetSubPath (
958 const std::string& location,
959 const std::string& path,
960 const std::string& att_value );
961
962 extern std::string
963 GetExtension ( const std::string& filename );
964
965 extern std::string
966 GetDirectory ( const std::string& filename );
967
968 extern std::string
969 GetFilename ( const std::string& filename );
970
971 extern std::string
972 NormalizeFilename ( const std::string& filename );
973
974 extern std::string
975 ToLower ( std::string filename );
976
977 #endif /* __RBUILD_H */