create a couple more variables to reduce makefile size
[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 GenerateObjectFileTargetsHost ( const Module& module ) const;
34 void GenerateObjectFileTargetsTarget ( const Module& module ) const;
35 void GenerateArchiveTargetHost ( const Module& module ) const;
36 void GenerateArchiveTargetTarget ( const Module& module ) const;
37 std::string GetInvocationDependencies ( const Module& module ) const;
38 std::string GetInvocationParameters ( const Invoke& invoke ) const;
39 void GenerateInvocations ( const Module& module ) const;
40 void GeneratePreconditionDependencies ( const Module& module ) const;
41 std::string GenerateObjectList ( const Module& module ) 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 GenerateGccModuleIncludeVariable ( const Module& module ) const;
50 std::string GenerateGccIncludeParameters ( const Module& module ) const;
51 std::string GenerateGccParameters ( const Module& module ) const;
52 std::string GenerateNasmParameters ( const Module& module ) const;
53 std::string GenerateGccCommand ( const Module& module,
54 const std::string& sourceFilename,
55 const std::string& cc ) const;
56 std::string GenerateGccAssemblerCommand ( const Module& module,
57 const std::string& sourceFilename,
58 const std::string& cc ) const;
59 std::string GenerateNasmCommand ( const Module& module,
60 const std::string& sourceFilename ) const;
61 std::string GenerateCommand ( const Module& module,
62 const std::string& sourceFilename,
63 const std::string& cc ) const;
64 void GenerateObjectFileTargets ( const Module& module,
65 const std::string& cc ) const;
66 void GenerateArchiveTarget ( const Module& module,
67 const std::string& ar ) const;
68 std::string GetPreconditionDependenciesName ( const Module& module ) const;
69 };
70
71
72 class MingwBuildToolModuleHandler : public MingwModuleHandler
73 {
74 public:
75 MingwBuildToolModuleHandler ();
76 virtual void Process ( const Module& module );
77 private:
78 void GenerateBuildToolModuleTarget ( const Module& module );
79 };
80
81
82 class MingwKernelModuleHandler : public MingwModuleHandler
83 {
84 public:
85 MingwKernelModuleHandler ();
86 virtual void Process ( const Module& module );
87 private:
88 void GenerateKernelModuleTarget ( const Module& module );
89 };
90
91
92 class MingwStaticLibraryModuleHandler : public MingwModuleHandler
93 {
94 public:
95 MingwStaticLibraryModuleHandler ();
96 virtual void Process ( const Module& module );
97 private:
98 void GenerateStaticLibraryModuleTarget ( const Module& module );
99 };
100
101
102 class MingwKernelModeDLLModuleHandler : public MingwModuleHandler
103 {
104 public:
105 MingwKernelModeDLLModuleHandler ();
106 virtual void Process ( const Module& module );
107 private:
108 void GenerateKernelModeDLLModuleTarget ( const Module& module );
109 };
110
111 #endif /* MINGW_MODULEHANDLER_H */