~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/plugins/compilergcc/compilerGNUPOWERPC.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3
 
 * http://www.gnu.org/licenses/gpl-3.0.html
4
 
 *
5
 
 * $Revision$
6
 
 * $Id$
7
 
 * $HeadURL$
8
 
 */
9
 
 
10
 
#include <sdk.h>
11
 
#include <prep.h>
12
 
#ifndef CB_PRECOMP
13
 
    #include <wx/intl.h>
14
 
    #include <wx/regex.h>
15
 
    #include <wx/utils.h> // wxGetOSDirectory, wxGetEnv
16
 
#endif
17
 
#include <wx/filefn.h> // wxFileExists
18
 
#include <wx/fileconf.h> // wxFileConfig
19
 
#ifdef __WXMSW__
20
 
#include <wx/msw/registry.h>
21
 
#endif // __WXMSW__
22
 
#include "compilerGNUPOWERPC.h"
23
 
 
24
 
CompilerGNUPOWERPC::CompilerGNUPOWERPC()
25
 
        : Compiler(_("GNU GCC Compiler for PowerPC"),_T("ppc-gcc"))
26
 
{
27
 
    Reset();
28
 
}
29
 
 
30
 
CompilerGNUPOWERPC::~CompilerGNUPOWERPC()
31
 
{
32
 
    //dtor
33
 
}
34
 
 
35
 
Compiler * CompilerGNUPOWERPC::CreateCopy()
36
 
{
37
 
    Compiler* c = new CompilerGNUPOWERPC(*this);
38
 
    c->SetExtraPaths(m_ExtraPaths); // wxArrayString doesn't seem to be copied with the default copy ctor...
39
 
    return c;
40
 
}
41
 
 
42
 
void CompilerGNUPOWERPC::Reset()
43
 
{
44
 
    if (platform::windows)
45
 
    {
46
 
        m_Programs.C = _T("ppc-gcc.exe");
47
 
        m_Programs.CPP = _T("ppc-g++.exe");
48
 
        m_Programs.LD = _T("ppc-g++.exe");
49
 
        m_Programs.DBG = _T("ppc-insight.exe");
50
 
        m_Programs.LIB = _T("ppc-ar.exe");
51
 
        m_Programs.WINDRES = _T("");
52
 
        m_Programs.MAKE = _T("make.exe");
53
 
    }
54
 
    else
55
 
    {
56
 
        m_Programs.C = _T("ppc-gcc");
57
 
        m_Programs.CPP = _T("ppc-g++");
58
 
        m_Programs.LD = _T("ppc-g++");
59
 
        m_Programs.DBG = _T("ppc-insight");
60
 
        m_Programs.LIB = _T("ppc-ar");
61
 
        m_Programs.WINDRES = _T("");
62
 
        m_Programs.MAKE = _T("make");
63
 
    }
64
 
    m_Switches.includeDirs = _T("-I");
65
 
    m_Switches.libDirs = _T("-L");
66
 
    m_Switches.linkLibs = _T("-l");
67
 
    m_Switches.defines = _T("-D");
68
 
    m_Switches.genericSwitch = _T("-");
69
 
    m_Switches.objectExtension = _T("o");
70
 
    m_Switches.needDependencies = true;
71
 
    m_Switches.forceCompilerUseQuotes = false;
72
 
    m_Switches.forceLinkerUseQuotes = false;
73
 
    m_Switches.logging = clogFull;
74
 
    m_Switches.libPrefix = _T("lib");
75
 
    m_Switches.libExtension = _T("a");
76
 
    m_Switches.linkerNeedsLibPrefix = false;
77
 
    m_Switches.linkerNeedsLibExtension = false;
78
 
 
79
 
    // Summary of GCC options: http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html
80
 
 
81
 
    m_Options.ClearOptions();
82
 
    m_Options.AddOption(_("Produce debugging symbols"),
83
 
                        _T("-g"),
84
 
                        _("Debugging"),
85
 
                        _T(""),
86
 
                        true,
87
 
                        _T("-O -O1 -O2 -O3 -Os"),
88
 
                        _("You have optimizations enabled. This will make debugging difficult because variables may be optimized away etc."));
89
 
    wxString gprof_link = _T("-pg");
90
 
    if (platform::windows)
91
 
        gprof_link = _T("-pg -lgmon");
92
 
    m_Options.AddOption(_("Profile code when executed"), _T("-pg"), _("Profiling"), gprof_link);
93
 
 
94
 
    wxString category = _("Warnings");
95
 
 
96
 
    // warnings
97
 
    m_Options.AddOption(_("In C mode, support all ISO C90 programs. In C++ mode, remove GNU extensions that conflict with ISO C++"), _T("-ansi"), category);
98
 
    m_Options.AddOption(_("Enable all compiler warnings (overrides every other setting)"), _T("-Wall"), category);
99
 
    m_Options.AddOption(_("Enable standard compiler warnings"), _T("-W"), category);
100
 
    m_Options.AddOption(_("Stop compiling after first error"), _T("-Wfatal-errors"), category);
101
 
    m_Options.AddOption(_("Inhibit all warning messages"), _T("-w"), category);
102
 
    m_Options.AddOption(_("Enable warnings demanded by strict ISO C and ISO C++"), _T("-pedantic"), category);
103
 
    m_Options.AddOption(_("Treat as errors the warnings demanded by strict ISO C and ISO C++"), _T("-pedantic-errors"), category);
104
 
    m_Options.AddOption(_("Warn if main() is not conformant"), _T("-Wmain"), category);
105
 
 
106
 
    category = _("General Options");
107
 
 
108
 
    // general options
109
 
    m_Options.AddOption(_("Output an error if same variable is declared without extern in different modules"), _T("-fno-common"), category);
110
 
    m_Options.AddOption(_("Save intermediate files in the build directory"), _T("-save-temps"), category);
111
 
 
112
 
    // Startup options
113
 
    category = _("Linker and startup code");
114
 
    m_Options.AddOption(_("do not link against the default crt0.o, so you can add your own startup code (PowerPC specific)"), _T("-nocrt0"), category);
115
 
    m_Options.AddOption(_("do not link against standard system startup files"), _T("-nostartfiles"), category);
116
 
    m_Options.AddOption(_("only search library directories explicitly specified on the command line"), _T("-nostdlib"), category);
117
 
 
118
 
    // optimization
119
 
    category = _("Optimization");
120
 
    m_Options.AddOption(_("Strip all symbols from binary (minimizes size)"), _T(""), category, _T("-s"), true, _T("-g -ggdb"), _("Stripping the binary will strip debugging symbols as well!"));
121
 
    m_Options.AddOption(_("Optimize generated code (for speed)"), _T("-O"), category);
122
 
    m_Options.AddOption(_("Optimize more (for speed)"), _T("-O1"), category);
123
 
    m_Options.AddOption(_("Optimize even more (for speed)"), _T("-O2"), category);
124
 
    m_Options.AddOption(_("Optimize fully (for speed)"), _T("-O3"), category);
125
 
    m_Options.AddOption(_("Optimize generated code (for size)"), _T("-Os"), category);
126
 
    m_Options.AddOption(_("Expensive optimizations"), _T("-fexpensive-optimizations"), category);
127
 
    m_Options.AddOption(_("No instruction scheduling before reload"), _T("-fno-schedule-insns"), category);
128
 
    m_Options.AddOption(_("No instruction scheduling after reload"), _T("-fno-schedule-insns2"), category);
129
 
 
130
 
    // machine dependent options
131
 
    category = _("PowerPC achitecture specific");
132
 
 
133
 
    m_Options.AddOption(_("Generate 32-bit code"), _T("-m32"), category);
134
 
    m_Options.AddOption(_("Use EABI"), _T("-meabi"), category);
135
 
    m_Options.AddOption(_("Produce big endian code"), _T("-mbig-endian"), category);
136
 
    m_Options.AddOption(_("Produce little endian code"), _T("-mlittle-endian"), category);
137
 
    m_Options.AddOption(_("Do not allow bit-fields to cross word boundaries"), _T("-mno-bit-word"), category);
138
 
    m_Options.AddOption(_("Align to the base type of the bit-field"), _T("-mbit-align"), category);
139
 
    m_Options.AddOption(_("Do not generate single field mfcr instruction"), _T("-mno-mfcrf"), category);
140
 
    m_Options.AddOption(_("Generate single field mfcr instruction"), _T("-mmfcrf"), category);
141
 
    m_Options.AddOption(_("Generate load/store with update instructions"), _T("-mupdate"), category);
142
 
    m_Options.AddOption(_("Generate load/store multiple instructions"), _T("-mmultiple"), category);
143
 
    m_Options.AddOption(_("Do not use hardware floating point"), _T("-msoft-float"), category);
144
 
    m_Options.AddOption(_("Use hardware floating point"), _T("-mhard-float"), category);
145
 
    m_Options.AddOption(_("Select method for sdata handling"), _T("-msdata="), category);
146
 
    m_Options.AddOption(_("Specify alignment of structure fields default/natural"), _T("-malign="), category);
147
 
    m_Options.AddOption(_("Avoid all range limits on call instructions"), _T("-mlongcall"), category);
148
 
    m_Options.AddOption(_("Using floating point in the GPRs"), _T("-mfloat-gprs=yes"), category);
149
 
    m_Options.AddOption(_("Not using floating point in the GPRs"), _T("-mfloat-gprs=no"), category);
150
 
//    m_Options.AddOption(_("Specify size of long double (64 or 128 bits)"), _T("-mlong-double="), category);
151
 
    m_Options.AddOption(_("Enable debug output"), _T("-mdebug"), category);
152
 
    m_Options.AddOption(_("Schedule code for given CPU"), _T("-mtune="), category);
153
 
    m_Options.AddOption(_("Allow symbolic names for registers"), _T("-mregnames"), category);
154
 
    m_Options.AddOption(_("Do not allow symbolic names for registers"), _T("-mno-regnames"), category);
155
 
    m_Options.AddOption(_("Support for GCC's -mrelocatble option"), _T("-mrelocatable"), category);
156
 
    m_Options.AddOption(_("Support for GCC's -mrelocatble-lib option"), _T("-mrelocatable-lib"), category);
157
 
 
158
 
    // machine dependent options
159
 
    category = _("PowerPC MCU derivatives");
160
 
 
161
 
    m_Options.AddOption(_("Select CPU PowerPC 5xx"), _T("-mcpu=505"), category);
162
 
    m_Options.AddOption(_("Select CPU PowerPC 823"), _T("-mcpu=823"), category);
163
 
    m_Options.AddOption(_("Select PowerPC 5200"), _T("-mcpu=603e -msoft-float"), category);
164
 
 
165
 
    m_Commands[(int)ctCompileObjectCmd].push_back(CompilerTool(_T("$compiler $options $includes -c $file -o $object")));
166
 
    m_Commands[(int)ctGenDependenciesCmd].push_back(CompilerTool(_T("$compiler -MM $options -MF $dep_object -MT $object $includes $file")));
167
 
    m_Commands[(int)ctCompileResourceCmd].push_back(CompilerTool(_T("$rescomp -i $file -J rc -o $resource_output -O coff $res_includes")));
168
 
    m_Commands[(int)ctLinkConsoleExeCmd].push_back(CompilerTool(_T("$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs")));
169
 
    if (platform::windows)
170
 
    {
171
 
        m_Commands[(int)ctLinkExeCmd].push_back(CompilerTool(_T("$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs -mwindows")));
172
 
        m_Commands[(int)ctLinkDynamicCmd].push_back(CompilerTool(_T("$linker -shared -Wl,--output-def=$def_output -Wl,--out-implib=$static_output -Wl,--dll $libdirs $link_objects $link_resobjects -o $exe_output $link_options $libs")));
173
 
    }
174
 
    else
175
 
    {
176
 
        m_Commands[(int)ctLinkExeCmd] = m_Commands[(int)ctLinkConsoleExeCmd]; // no -mwindows
177
 
        m_Commands[(int)ctLinkDynamicCmd].push_back(CompilerTool(_T("$linker -shared $libdirs $link_objects $link_resobjects -o $exe_output $link_options $libs")));
178
 
    }
179
 
    m_Commands[(int)ctLinkStaticCmd].push_back(CompilerTool(_T("$lib_linker -rs $static_output $link_objects")));
180
 
    m_Commands[(int)ctLinkNativeCmd] = m_Commands[(int)ctLinkConsoleExeCmd]; // unsupported currently
181
 
 
182
 
    LoadDefaultRegExArray();
183
 
 
184
 
    m_CompilerOptions.Clear();
185
 
    m_LinkerOptions.Clear();
186
 
    m_LinkLibs.Clear();
187
 
    m_CmdsBefore.Clear();
188
 
    m_CmdsAfter.Clear();
189
 
}
190
 
 
191
 
void CompilerGNUPOWERPC::LoadDefaultRegExArray()
192
 
{
193
 
    m_RegExes.Clear();
194
 
    m_RegExes.Add(RegExStruct(_("Fatal error"), cltError, _T("FATAL:[ \t]*(.*)"), 1));
195
 
    m_RegExes.Add(RegExStruct(_("'In function...' info"), cltInfo, _T("(") + FilePathWithSpaces + _T("):[ \t]+") + _T("([iI]n ([cC]lass|[cC]onstructor|[dD]estructor|[fF]unction|[mM]ember [fF]unction).*)"), 2, 1));
196
 
    m_RegExes.Add(RegExStruct(_("'Instantiated from' info"), cltInfo, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[ \t]+([iI]nstantiated from .*)"), 3, 1, 2));
197
 
    m_RegExes.Add(RegExStruct(_("Resource compiler error"), cltError, _T("windres.exe:[ \t](") + FilePathWithSpaces + _T("):([0-9]+):[ \t](.*)"), 3, 1, 2));
198
 
    m_RegExes.Add(RegExStruct(_("Resource compiler error (2)"), cltError, _T("windres.exe:[ \t](.*)"), 1));
199
 
    m_RegExes.Add(RegExStruct(_("Preprocessor warning"), cltWarning, _T("(") + FilePathWithSpaces + _T("):([0-9]+):([0-9]+):[ \t]([Ww]arning:[ \t].*)"), 4, 1, 2));
200
 
    m_RegExes.Add(RegExStruct(_("Preprocessor error"), cltError, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[0-9]+:[ \t](.*)"), 3, 1, 2));
201
 
    m_RegExes.Add(RegExStruct(_("Compiler warning"), cltWarning, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[ \t]([Ww]arning:[ \t].*)"), 3, 1, 2));
202
 
    m_RegExes.Add(RegExStruct(_("Compiler note"), cltInfo, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[ \t]([Nn]ote:[ \t].*)"), 3, 1, 2));
203
 
    m_RegExes.Add(RegExStruct(_("General note"), cltInfo, _T("([Nn]ote:[ \t].*)"), 1));
204
 
    m_RegExes.Add(RegExStruct(_("Compiler error"), cltError, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[ \t](.*)"), 3, 1, 2));
205
 
    m_RegExes.Add(RegExStruct(_("Linker error"), cltError, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[0-9]+:[ \t](.*)"), 3, 1, 2));
206
 
    m_RegExes.Add(RegExStruct(_("Linker error (2)"), cltError, FilePathWithSpaces + _T("\\(.text\\+[0-9A-Za-z]+\\):([ \tA-Za-z0-9_:+/\\.-]+):[ \t](.*)"), 2, 1));
207
 
    m_RegExes.Add(RegExStruct(_("Linker error (lib not found)"), cltError, _T(".*(ld.*):[ \t](cannot find.*)"), 2, 1));
208
 
    m_RegExes.Add(RegExStruct(_("Undefined reference"), cltError, _T("(") + FilePathWithSpaces + _T("):[ \t](undefined reference.*)"), 2, 1));
209
 
    m_RegExes.Add(RegExStruct(_("General warning"), cltWarning, _T("([Ww]arning:[ \t].*)"), 1));
210
 
    m_RegExes.Add(RegExStruct(_("Auto-import info"), cltInfo, _T("([Ii]nfo:[ \t].*)\\(auto-import\\)"), 1));
211
 
}
212
 
 
213
 
AutoDetectResult CompilerGNUPOWERPC::AutoDetectInstallationDir()
214
 
{
215
 
    wxString sep = wxFileName::GetPathSeparator();
216
 
#ifdef __WXMSW__
217
 
     m_MasterPath = _T("C:\\HighTec\\PowerPC"); // just a guess
218
 
 
219
 
    //    wxLogNull ln;
220
 
    wxRegKey key; // defaults to HKCR
221
 
     key.SetName(_T("HKEY_LOCAL_MACHINE\\Software\\HighTec EDV-Systeme\\PowerPC\\"));
222
 
     if (key.Exists() && key.Open(wxRegKey::Read))
223
 
     {
224
 
     // found; read it
225
 
        if (key.HasValue(_T("InstallPath")))
226
 
        {
227
 
                key.QueryValue(_T("InstallPath"), m_MasterPath);
228
 
        }
229
 
      }
230
 
#else
231
 
     m_MasterPath = _T("/usr/local/ppc");
232
 
#endif // __WXMSW__
233
 
    AutoDetectResult ret = wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C) ? adrDetected : adrGuessed;
234
 
//    if (ret == adrDetected)
235
 
//    {
236
 
//          AddIncludeDir(m_MasterPath + sep + _T("ppc-ht-eabi") + sep + _T("include"));
237
 
//    }
238
 
    return ret;
239
 
}
 
1
/*
 
2
 * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
 
3
 * http://www.gnu.org/licenses/gpl-3.0.html
 
4
 *
 
5
 * $Revision: 5929 $
 
6
 * $Id: compilerGNUPOWERPC.cpp 5929 2009-11-21 14:34:53Z biplab $
 
7
 * $HeadURL: svn+ssh://jenslody@svn.berlios.de/svnroot/repos/codeblocks/trunk/src/plugins/compilergcc/compilerGNUPOWERPC.cpp $
 
8
 */
 
9
 
 
10
#include <sdk.h>
 
11
#include <prep.h>
 
12
#ifndef CB_PRECOMP
 
13
    #include <wx/intl.h>
 
14
    #include <wx/regex.h>
 
15
    #include <wx/utils.h> // wxGetOSDirectory, wxGetEnv
 
16
#endif
 
17
#include <wx/filefn.h> // wxFileExists
 
18
#include <wx/fileconf.h> // wxFileConfig
 
19
#ifdef __WXMSW__
 
20
#include <wx/msw/registry.h>
 
21
#endif // __WXMSW__
 
22
#include "compilerGNUPOWERPC.h"
 
23
 
 
24
CompilerGNUPOWERPC::CompilerGNUPOWERPC()
 
25
        : Compiler(_("GNU GCC Compiler for PowerPC"),_T("ppc-gcc"))
 
26
{
 
27
    Reset();
 
28
}
 
29
 
 
30
CompilerGNUPOWERPC::~CompilerGNUPOWERPC()
 
31
{
 
32
    //dtor
 
33
}
 
34
 
 
35
Compiler * CompilerGNUPOWERPC::CreateCopy()
 
36
{
 
37
    Compiler* c = new CompilerGNUPOWERPC(*this);
 
38
    c->SetExtraPaths(m_ExtraPaths); // wxArrayString doesn't seem to be copied with the default copy ctor...
 
39
    return c;
 
40
}
 
41
 
 
42
void CompilerGNUPOWERPC::Reset()
 
43
{
 
44
    if (platform::windows)
 
45
    {
 
46
        m_Programs.C = _T("ppc-gcc.exe");
 
47
        m_Programs.CPP = _T("ppc-g++.exe");
 
48
        m_Programs.LD = _T("ppc-g++.exe");
 
49
        m_Programs.DBG = _T("ppc-insight.exe");
 
50
        m_Programs.LIB = _T("ppc-ar.exe");
 
51
        m_Programs.WINDRES = _T("");
 
52
        m_Programs.MAKE = _T("make.exe");
 
53
    }
 
54
    else
 
55
    {
 
56
        m_Programs.C = _T("ppc-gcc");
 
57
        m_Programs.CPP = _T("ppc-g++");
 
58
        m_Programs.LD = _T("ppc-g++");
 
59
        m_Programs.DBG = _T("ppc-insight");
 
60
        m_Programs.LIB = _T("ppc-ar");
 
61
        m_Programs.WINDRES = _T("");
 
62
        m_Programs.MAKE = _T("make");
 
63
    }
 
64
    m_Switches.includeDirs = _T("-I");
 
65
    m_Switches.libDirs = _T("-L");
 
66
    m_Switches.linkLibs = _T("-l");
 
67
    m_Switches.defines = _T("-D");
 
68
    m_Switches.genericSwitch = _T("-");
 
69
    m_Switches.objectExtension = _T("o");
 
70
    m_Switches.needDependencies = true;
 
71
    m_Switches.forceCompilerUseQuotes = false;
 
72
    m_Switches.forceLinkerUseQuotes = false;
 
73
    m_Switches.logging = clogFull;
 
74
    m_Switches.libPrefix = _T("lib");
 
75
    m_Switches.libExtension = _T("a");
 
76
    m_Switches.linkerNeedsLibPrefix = false;
 
77
    m_Switches.linkerNeedsLibExtension = false;
 
78
 
 
79
    // Summary of GCC options: http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html
 
80
 
 
81
    m_Options.ClearOptions();
 
82
    m_Options.AddOption(_("Produce debugging symbols"),
 
83
                        _T("-g"),
 
84
                        _("Debugging"),
 
85
                        _T(""),
 
86
                        true,
 
87
                        _T("-O -O1 -O2 -O3 -Os"),
 
88
                        _("You have optimizations enabled. This will make debugging difficult because variables may be optimized away etc."));
 
89
    wxString gprof_link = _T("-pg");
 
90
    if (platform::windows)
 
91
        gprof_link = _T("-pg -lgmon");
 
92
    m_Options.AddOption(_("Profile code when executed"), _T("-pg"), _("Profiling"), gprof_link);
 
93
 
 
94
    wxString category = _("Warnings");
 
95
 
 
96
    // warnings
 
97
    m_Options.AddOption(_("In C mode, support all ISO C90 programs. In C++ mode, remove GNU extensions that conflict with ISO C++"), _T("-ansi"), category);
 
98
    m_Options.AddOption(_("Enable all compiler warnings (overrides every other setting)"), _T("-Wall"), category);
 
99
    m_Options.AddOption(_("Enable standard compiler warnings"), _T("-W"), category);
 
100
    m_Options.AddOption(_("Stop compiling after first error"), _T("-Wfatal-errors"), category);
 
101
    m_Options.AddOption(_("Inhibit all warning messages"), _T("-w"), category);
 
102
    m_Options.AddOption(_("Enable warnings demanded by strict ISO C and ISO C++"), _T("-pedantic"), category);
 
103
    m_Options.AddOption(_("Treat as errors the warnings demanded by strict ISO C and ISO C++"), _T("-pedantic-errors"), category);
 
104
    m_Options.AddOption(_("Warn if main() is not conformant"), _T("-Wmain"), category);
 
105
 
 
106
    category = _("General Options");
 
107
 
 
108
    // general options
 
109
    m_Options.AddOption(_("Output an error if same variable is declared without extern in different modules"), _T("-fno-common"), category);
 
110
    m_Options.AddOption(_("Save intermediate files in the build directory"), _T("-save-temps"), category);
 
111
 
 
112
    // Startup options
 
113
    category = _("Linker and startup code");
 
114
    m_Options.AddOption(_("do not link against the default crt0.o, so you can add your own startup code (PowerPC specific)"), _T("-nocrt0"), category);
 
115
    m_Options.AddOption(_("do not link against standard system startup files"), _T("-nostartfiles"), category);
 
116
    m_Options.AddOption(_("only search library directories explicitly specified on the command line"), _T("-nostdlib"), category);
 
117
 
 
118
    // optimization
 
119
    category = _("Optimization");
 
120
    m_Options.AddOption(_("Strip all symbols from binary (minimizes size)"), _T(""), category, _T("-s"), true, _T("-g -ggdb"), _("Stripping the binary will strip debugging symbols as well!"));
 
121
    m_Options.AddOption(_("Optimize generated code (for speed)"), _T("-O"), category);
 
122
    m_Options.AddOption(_("Optimize more (for speed)"), _T("-O1"), category);
 
123
    m_Options.AddOption(_("Optimize even more (for speed)"), _T("-O2"), category);
 
124
    m_Options.AddOption(_("Optimize fully (for speed)"), _T("-O3"), category);
 
125
    m_Options.AddOption(_("Optimize generated code (for size)"), _T("-Os"), category);
 
126
    m_Options.AddOption(_("Expensive optimizations"), _T("-fexpensive-optimizations"), category);
 
127
    m_Options.AddOption(_("No instruction scheduling before reload"), _T("-fno-schedule-insns"), category);
 
128
    m_Options.AddOption(_("No instruction scheduling after reload"), _T("-fno-schedule-insns2"), category);
 
129
 
 
130
    // machine dependent options
 
131
    category = _("PowerPC achitecture specific");
 
132
 
 
133
    m_Options.AddOption(_("Generate 32-bit code"), _T("-m32"), category);
 
134
    m_Options.AddOption(_("Use EABI"), _T("-meabi"), category);
 
135
    m_Options.AddOption(_("Produce big endian code"), _T("-mbig-endian"), category);
 
136
    m_Options.AddOption(_("Produce little endian code"), _T("-mlittle-endian"), category);
 
137
    m_Options.AddOption(_("Do not allow bit-fields to cross word boundaries"), _T("-mno-bit-word"), category);
 
138
    m_Options.AddOption(_("Align to the base type of the bit-field"), _T("-mbit-align"), category);
 
139
    m_Options.AddOption(_("Do not generate single field mfcr instruction"), _T("-mno-mfcrf"), category);
 
140
    m_Options.AddOption(_("Generate single field mfcr instruction"), _T("-mmfcrf"), category);
 
141
    m_Options.AddOption(_("Generate load/store with update instructions"), _T("-mupdate"), category);
 
142
    m_Options.AddOption(_("Generate load/store multiple instructions"), _T("-mmultiple"), category);
 
143
    m_Options.AddOption(_("Do not use hardware floating point"), _T("-msoft-float"), category);
 
144
    m_Options.AddOption(_("Use hardware floating point"), _T("-mhard-float"), category);
 
145
    m_Options.AddOption(_("Select method for sdata handling"), _T("-msdata="), category);
 
146
    m_Options.AddOption(_("Specify alignment of structure fields default/natural"), _T("-malign="), category);
 
147
    m_Options.AddOption(_("Avoid all range limits on call instructions"), _T("-mlongcall"), category);
 
148
    m_Options.AddOption(_("Using floating point in the GPRs"), _T("-mfloat-gprs=yes"), category);
 
149
    m_Options.AddOption(_("Not using floating point in the GPRs"), _T("-mfloat-gprs=no"), category);
 
150
//    m_Options.AddOption(_("Specify size of long double (64 or 128 bits)"), _T("-mlong-double="), category);
 
151
    m_Options.AddOption(_("Enable debug output"), _T("-mdebug"), category);
 
152
    m_Options.AddOption(_("Schedule code for given CPU"), _T("-mtune="), category);
 
153
    m_Options.AddOption(_("Allow symbolic names for registers"), _T("-mregnames"), category);
 
154
    m_Options.AddOption(_("Do not allow symbolic names for registers"), _T("-mno-regnames"), category);
 
155
    m_Options.AddOption(_("Support for GCC's -mrelocatble option"), _T("-mrelocatable"), category);
 
156
    m_Options.AddOption(_("Support for GCC's -mrelocatble-lib option"), _T("-mrelocatable-lib"), category);
 
157
 
 
158
    // machine dependent options
 
159
    category = _("PowerPC MCU derivatives");
 
160
 
 
161
    m_Options.AddOption(_("Select CPU PowerPC 5xx"), _T("-mcpu=505"), category);
 
162
    m_Options.AddOption(_("Select CPU PowerPC 823"), _T("-mcpu=823"), category);
 
163
    m_Options.AddOption(_("Select PowerPC 5200"), _T("-mcpu=603e -msoft-float"), category);
 
164
 
 
165
    m_Commands[(int)ctCompileObjectCmd].push_back(CompilerTool(_T("$compiler $options $includes -c $file -o $object")));
 
166
    m_Commands[(int)ctGenDependenciesCmd].push_back(CompilerTool(_T("$compiler -MM $options -MF $dep_object -MT $object $includes $file")));
 
167
    m_Commands[(int)ctCompileResourceCmd].push_back(CompilerTool(_T("$rescomp -i $file -J rc -o $resource_output -O coff $res_includes")));
 
168
    m_Commands[(int)ctLinkConsoleExeCmd].push_back(CompilerTool(_T("$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs")));
 
169
    if (platform::windows)
 
170
    {
 
171
        m_Commands[(int)ctLinkExeCmd].push_back(CompilerTool(_T("$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs -mwindows")));
 
172
        m_Commands[(int)ctLinkDynamicCmd].push_back(CompilerTool(_T("$linker -shared -Wl,--output-def=$def_output -Wl,--out-implib=$static_output -Wl,--dll $libdirs $link_objects $link_resobjects -o $exe_output $link_options $libs")));
 
173
    }
 
174
    else
 
175
    {
 
176
        m_Commands[(int)ctLinkExeCmd] = m_Commands[(int)ctLinkConsoleExeCmd]; // no -mwindows
 
177
        m_Commands[(int)ctLinkDynamicCmd].push_back(CompilerTool(_T("$linker -shared $libdirs $link_objects $link_resobjects -o $exe_output $link_options $libs")));
 
178
    }
 
179
    m_Commands[(int)ctLinkStaticCmd].push_back(CompilerTool(_T("$lib_linker -rs $static_output $link_objects")));
 
180
    m_Commands[(int)ctLinkNativeCmd] = m_Commands[(int)ctLinkConsoleExeCmd]; // unsupported currently
 
181
 
 
182
    LoadDefaultRegExArray();
 
183
 
 
184
    m_CompilerOptions.Clear();
 
185
    m_LinkerOptions.Clear();
 
186
    m_LinkLibs.Clear();
 
187
    m_CmdsBefore.Clear();
 
188
    m_CmdsAfter.Clear();
 
189
}
 
190
 
 
191
void CompilerGNUPOWERPC::LoadDefaultRegExArray()
 
192
{
 
193
    m_RegExes.Clear();
 
194
    m_RegExes.Add(RegExStruct(_("Fatal error"), cltError, _T("FATAL:[ \t]*(.*)"), 1));
 
195
    m_RegExes.Add(RegExStruct(_("'In function...' info"), cltInfo, _T("(") + FilePathWithSpaces + _T("):[ \t]+") + _T("([iI]n ([cC]lass|[cC]onstructor|[dD]estructor|[fF]unction|[mM]ember [fF]unction).*)"), 2, 1));
 
196
    m_RegExes.Add(RegExStruct(_("'Instantiated from' info"), cltInfo, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[ \t]+([iI]nstantiated from .*)"), 3, 1, 2));
 
197
    m_RegExes.Add(RegExStruct(_("Resource compiler error"), cltError, _T("windres.exe:[ \t](") + FilePathWithSpaces + _T("):([0-9]+):[ \t](.*)"), 3, 1, 2));
 
198
    m_RegExes.Add(RegExStruct(_("Resource compiler error (2)"), cltError, _T("windres.exe:[ \t](.*)"), 1));
 
199
    m_RegExes.Add(RegExStruct(_("Preprocessor warning"), cltWarning, _T("(") + FilePathWithSpaces + _T("):([0-9]+):([0-9]+):[ \t]([Ww]arning:[ \t].*)"), 4, 1, 2));
 
200
    m_RegExes.Add(RegExStruct(_("Preprocessor error"), cltError, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[0-9]+:[ \t](.*)"), 3, 1, 2));
 
201
    m_RegExes.Add(RegExStruct(_("Compiler warning"), cltWarning, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[ \t]([Ww]arning:[ \t].*)"), 3, 1, 2));
 
202
    m_RegExes.Add(RegExStruct(_("Compiler note"), cltInfo, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[ \t]([Nn]ote:[ \t].*)"), 3, 1, 2));
 
203
    m_RegExes.Add(RegExStruct(_("General note"), cltInfo, _T("([Nn]ote:[ \t].*)"), 1));
 
204
    m_RegExes.Add(RegExStruct(_("Compiler error"), cltError, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[ \t](.*)"), 3, 1, 2));
 
205
    m_RegExes.Add(RegExStruct(_("Linker error"), cltError, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[0-9]+:[ \t](.*)"), 3, 1, 2));
 
206
    m_RegExes.Add(RegExStruct(_("Linker error (2)"), cltError, FilePathWithSpaces + _T("\\(.text\\+[0-9A-Za-z]+\\):([ \tA-Za-z0-9_:+/\\.-]+):[ \t](.*)"), 2, 1));
 
207
    m_RegExes.Add(RegExStruct(_("Linker error (lib not found)"), cltError, _T(".*(ld.*):[ \t](cannot find.*)"), 2, 1));
 
208
    m_RegExes.Add(RegExStruct(_("Undefined reference"), cltError, _T("(") + FilePathWithSpaces + _T("):[ \t](undefined reference.*)"), 2, 1));
 
209
    m_RegExes.Add(RegExStruct(_("General warning"), cltWarning, _T("([Ww]arning:[ \t].*)"), 1));
 
210
    m_RegExes.Add(RegExStruct(_("Auto-import info"), cltInfo, _T("([Ii]nfo:[ \t].*)\\(auto-import\\)"), 1));
 
211
}
 
212
 
 
213
AutoDetectResult CompilerGNUPOWERPC::AutoDetectInstallationDir()
 
214
{
 
215
    wxString sep = wxFileName::GetPathSeparator();
 
216
#ifdef __WXMSW__
 
217
     m_MasterPath = _T("C:\\HighTec\\PowerPC"); // just a guess
 
218
 
 
219
    //    wxLogNull ln;
 
220
    wxRegKey key; // defaults to HKCR
 
221
     key.SetName(_T("HKEY_LOCAL_MACHINE\\Software\\HighTec EDV-Systeme\\PowerPC\\"));
 
222
     if (key.Exists() && key.Open(wxRegKey::Read))
 
223
     {
 
224
     // found; read it
 
225
    if (key.HasValue(_T("InstallPath")))
 
226
        {
 
227
            key.QueryValue(_T("InstallPath"), m_MasterPath);
 
228
        }
 
229
      }
 
230
#else
 
231
     m_MasterPath = _T("/usr/local/ppc");
 
232
#endif // __WXMSW__
 
233
    AutoDetectResult ret = wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C) ? adrDetected : adrGuessed;
 
234
//    if (ret == adrDetected)
 
235
//    {
 
236
//          AddIncludeDir(m_MasterPath + sep + _T("ppc-ht-eabi") + sep + _T("include"));
 
237
//    }
 
238
    return ret;
 
239
}