forgot to recurse If elements when generating macros
[reactos.git] / reactos / tools / rbuild / backend / mingw / modulehandler.h
1 #ifndef MINGW_MODULEHANDLER_H
2 #define MINGW_MODULEHANDLER_H
3
4 #include "../backend.h"
5
6 class MingwModuleHandler
7 {
8 public:
9 static std::map<ModuleType,MingwModuleHandler*>* handler_map;
10 static int ref;
11
12 MingwModuleHandler ( ModuleType moduletype );
13 virtual ~MingwModuleHandler();
14
15 static void SetMakefile ( FILE* f );
16 static MingwModuleHandler* LookupHandler ( const std::string& location,
17 ModuleType moduletype_ );
18 virtual void Process ( const Module& module ) = 0;
19
20 protected:
21 std::string GetWorkingDirectory () const;
22 std::string GetExtension ( const std::string& filename ) const;
23 std::string ReplaceExtension ( const std::string& filename,
24 const std::string& newExtension ) const;
25 std::string GetModuleArchiveFilename ( const Module& module ) const;
26 std::string GetImportLibraryDependencies ( const Module& module ) const;
27 std::string GetModuleDependencies ( const Module& module ) const;
28 std::string GetAllDependencies ( const Module& module ) const;
29 std::string GetSourceFilenames ( const Module& module ) const;
30
31 std::string GetObjectFilename ( const std::string& sourceFilename ) const;
32 std::string GetObjectFilenames ( const Module& module ) const;
33 void GenerateMacrosAndTargetsHost ( const Module& module ) const;
34 void GenerateMacrosAndTargetsTarget ( const Module& module ) const;
35 std::string GetInvocationDependencies ( const Module& module ) const;
36 std::string GetInvocationParameters ( const Invoke& invoke ) const;
37 void GenerateInvocations ( const Module& module ) const;
38 void GeneratePreconditionDependencies ( const Module& module ) const;
39 std::string GenerateMacros ( const Module& module,
40 const std::string& cflags_macro,
41 const std::string& objs_macro ) const;
42 static FILE* fMakefile;
43 private:
44 std::string ConcatenatePaths ( const std::string& path1,
45 const std::string& path2 ) const;
46 std::string GenerateGccDefineParametersFromVector ( const std::vector<Define*>& defines ) const;
47 std::string GenerateGccDefineParameters ( const Module& module ) const;
48 std::string GenerateGccIncludeParametersFromVector ( const std::vector<Include*>& includes ) const;
49 void GenerateMacros ( const Module& module,
50 const char* op,
51 const std::vector<File*>& files,
52 const std::vector<Include*>* includes,
53 const std::vector<Define*>& defines,
54 const std::vector<If*>* ifs,
55 const std::string& cflags_macro,
56 const std::string& nasmflags_macro,
57 const std::string& objs_macro) const;
58 void GenerateMacros ( const Module& module,
59 const std::string& cflags_macro,
60 const std::string& nasmflags_macro,
61 const std::string& objs_macro) const;
62 void GenerateGccModuleIncludeVariable ( const Module& module ) const;
63 std::string GenerateGccIncludeParameters ( const Module& module ) const;
64 std::string GenerateGccParameters ( const Module& module ) const;
65 std::string GenerateNasmParameters ( const Module& module ) const;
66 std::string GenerateGccCommand ( const Module& module,
67 const std::string& sourceFilename,
68 const std::string& cc,
69 const std::string& cflagsMacro ) const;
70 std::string GenerateGccAssemblerCommand ( const Module& module,
71 const std::string& sourceFilename,
72 const std::string& cc,
73 const std::string& cflagsMacro ) const;
74 std::string GenerateNasmCommand ( const Module& module,
75 const std::string& sourceFilename,
76 const std::string& nasmflagsMacro ) const;
77 std::string GenerateCommand ( const Module& module,
78 const std::string& sourceFilename,
79 const std::string& cc,
80 const std::string& cflagsMacro,
81 const std::string& nasmflagsMacro ) const;
82 void GenerateObjectFileTargets ( const Module& module,
83 const std::vector<File*>& files,
84 const std::string& cc,
85 const std::string& cflagsMacro,
86 const std::string& nasmflagsMacro ) const;
87 void GenerateObjectFileTargets ( const Module& module,
88 const std::string& cc,
89 const std::string& cflagsMacro,
90 const std::string& nasmflagsMacro ) const;
91 void GenerateArchiveTarget ( const Module& module,
92 const std::string& ar,
93 const std::string& objs_macro ) const;
94 void GenerateMacrosAndTargets ( const Module& module,
95 const std::string& cc,
96 const std::string& ar ) const;
97 std::string GetPreconditionDependenciesName ( const Module& module ) const;
98 };
99
100
101 class MingwBuildToolModuleHandler : public MingwModuleHandler
102 {
103 public:
104 MingwBuildToolModuleHandler ();
105 virtual void Process ( const Module& module );
106 private:
107 void GenerateBuildToolModuleTarget ( const Module& module );
108 };
109
110
111 class MingwKernelModuleHandler : public MingwModuleHandler
112 {
113 public:
114 MingwKernelModuleHandler ();
115 virtual void Process ( const Module& module );
116 private:
117 void GenerateKernelModuleTarget ( const Module& module );
118 };
119
120
121 class MingwStaticLibraryModuleHandler : public MingwModuleHandler
122 {
123 public:
124 MingwStaticLibraryModuleHandler ();
125 virtual void Process ( const Module& module );
126 private:
127 void GenerateStaticLibraryModuleTarget ( const Module& module );
128 };
129
130
131 class MingwKernelModeDLLModuleHandler : public MingwModuleHandler
132 {
133 public:
134 MingwKernelModeDLLModuleHandler ();
135 virtual void Process ( const Module& module );
136 private:
137 void GenerateKernelModeDLLModuleTarget ( const Module& module );
138 };
139
140
141 class MingwNativeDLLModuleHandler : public MingwModuleHandler
142 {
143 public:
144 MingwNativeDLLModuleHandler ();
145 virtual void Process ( const Module& module );
146 private:
147 void GenerateNativeDLLModuleTarget ( const Module& module );
148 };
149
150 #endif /* MINGW_MODULEHANDLER_H */