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