2 * Copyright (C) 2005 Casper S. Hornstrup
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.
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.
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.
21 #include "../backend.h"
26 #define NUL "/dev/null"
30 class MingwModuleHandler
;
33 v2s ( const string_list
& v
, int wrap_at
);
36 class MingwBackend
: public Backend
39 MingwBackend ( Project
& project
,
40 Configuration
& configuration
);
42 virtual void Process ();
43 std::string
AddDirectoryTarget ( const std::string
& directory
,
44 Directory
* directoryTree
);
45 const Module
& GetAliasedModuleOrModule ( const Module
& module
) const;
46 std::string compilerPrefix
;
47 std::string compilerCommand
;
48 std::string nasmCommand
;
49 std::string binutilsPrefix
;
50 std::string binutilsCommand
;
52 Directory
* intermediateDirectory
;
53 Directory
* outputDirectory
;
54 Directory
* installDirectory
;
56 void CreateMakefile ();
57 void CloseMakefile () const;
58 void GenerateHeader () const;
59 std::string
GenerateIncludesAndDefines ( IfableData
& data
) const;
60 void GenerateProjectCFlagsMacro ( const char* assignmentOperation
,
61 IfableData
& data
) const;
62 void GenerateGlobalCFlagsAndProperties ( const char* op
,
63 IfableData
& data
) const;
64 void GenerateProjectGccOptionsMacro ( const char* assignmentOperation
,
65 IfableData
& data
) const;
66 void GenerateProjectGccOptions ( const char* assignmentOperation
,
67 IfableData
& data
) const;
68 std::string
GenerateProjectLFLAGS () const;
69 void GenerateDirectories ();
70 void GenerateGlobalVariables () const;
71 bool IncludeInAllTarget ( const Module
& module
) const;
72 void GenerateAllTarget ( const std::vector
<MingwModuleHandler
*>& handlers
) const;
73 std::string
GetBuildToolDependencies () const;
74 void GenerateInitTarget () const;
75 void GenerateRegTestsRunTarget () const;
76 void GenerateXmlBuildFilesMacro() const;
77 std::string
GetBin2ResExecutable ();
78 void UnpackWineResources ();
79 void GenerateTestSupportCode ();
80 void GenerateCompilationUnitSupportCode ();
81 void GenerateSysSetup ();
82 std::string
GetProxyMakefileTree () const;
83 void GenerateProxyMakefiles ();
84 void CheckAutomaticDependencies ();
85 bool IncludeDirectoryTarget ( const std::string
& directory
) const;
86 bool TryToDetectThisCompiler ( const std::string
& compiler
);
87 void DetectCompiler ();
88 bool TryToDetectThisNetwideAssembler ( const std::string
& assembler
);
89 bool TryToDetectThisBinutils ( const std::string
& binutils
);
90 std::string
GetBinutilsVersion ( const std::string
& binutilsCommand
);
91 bool IsSupportedBinutilsVersion ( const std::string
& binutilsVersion
);
92 void DetectBinutils ();
93 void DetectNetwideAssembler ();
94 void DetectPipeSupport ();
95 void DetectPCHSupport ();
96 bool CanEnablePreCompiledHeaderSupportForModule ( const Module
& module
);
97 void ProcessModules ();
98 void CheckAutomaticDependenciesForModuleOnly ();
99 void ProcessNormal ();
100 std::string
GetNonModuleInstallDirectories ( const std::string
& installDirectory
);
101 std::string
GetInstallDirectories ( const std::string
& installDirectory
);
102 void GetNonModuleInstallFiles ( std::vector
<std::string
>& out
) const;
103 void GetInstallFiles ( std::vector
<std::string
>& out
) const;
104 void GetNonModuleInstallTargetFiles ( std::vector
<std::string
>& out
) const;
105 void GetModuleInstallTargetFiles ( std::vector
<std::string
>& out
) const;
106 void GetInstallTargetFiles ( std::vector
<std::string
>& out
) const;
107 void OutputInstallTarget ( const std::string
& sourceFilename
,
108 const std::string
& targetFilename
,
109 const std::string
& targetDirectory
);
110 void OutputNonModuleInstallTargets ();
111 void OutputModuleInstallTargets ();
112 std::string
GetRegistrySourceFiles ();
113 std::string
GetRegistryTargetFiles ();
114 void OutputRegistryInstallTarget ();
115 void GenerateInstallTarget ();
116 void GetModuleTestTargets ( std::vector
<std::string
>& out
) const;
117 void GenerateTestTarget ();
118 void GenerateDirectoryTargets ();
127 ProxyMakefile ( const Project
& project
);
129 void GenerateProxyMakefiles ( bool verbose
,
130 std::string outputTree
);
132 std::string
GeneratePathToParentDirectory ( int numberOfParentDirectories
);
133 std::string
GetPathToTopDirectory ( Module
& module
);
134 bool GenerateProxyMakefile ( Module
& module
);
135 void GenerateProxyMakefileForModule ( Module
& module
,
137 std::string outputTree
);
138 const Project
& project
;