* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "../../pch.h"
{ HostTrue, "", "", "" }, // BuildTool
{ HostFalse, "", "", "" }, // StaticLibrary
{ HostFalse, "", "", "" }, // ObjectLibrary
- { HostFalse, "", "", "" }, // Kernel
- { HostFalse, "", "", "" }, // KernelModeDLL
- { HostFalse, "-D__NTDRIVER__", "", "" }, // KernelModeDriver
- { HostFalse, "", "", "" }, // NativeDLL
- { HostFalse, "-D__NTAPP__", "", "" }, // NativeCUI
- { HostFalse, "", "", "" }, // Win32DLL
- { HostFalse, "", "", "" }, // Win32OCX
- { HostFalse, "", "", "" }, // Win32CUI
- { HostFalse, "", "", "" }, // Win32GUI
- { HostFalse, "", "", "-nostartfiles -nostdlib" }, // BootLoader
+ { HostFalse, "", "", "$(LDFLAG_DRIVER)" }, // Kernel
+ { HostFalse, "", "", "$(LDFLAG_DRIVER)" }, // KernelModeDLL
+ { HostFalse, "-D__NTDRIVER__", "", "$(LDFLAG_DRIVER)" }, // KernelModeDriver
+ { HostFalse, "", "", "$(LDFLAG_DLL)" }, // NativeDLL
+ { HostFalse, "-D__NTAPP__", "", "$(LDFLAG_NATIVE)" }, // NativeCUI
+ { HostFalse, "", "", "$(LDFLAG_DLL)" }, // Win32DLL
+ { HostFalse, "", "", "$(LDFLAG_DLL)" }, // Win32OCX
+ { HostFalse, "", "", "$(LDFLAG_CONSOLE)" }, // Win32CUI
+ { HostFalse, "", "", "$(LDFLAG_WINDOWS)" }, // Win32GUI
+ { HostFalse, "", "", "" }, // BootLoader
{ HostFalse, "", "-f bin", "" }, // BootSector
{ HostFalse, "", "", "" }, // Iso
{ HostFalse, "", "", "" }, // LiveIso
{ HostFalse, "", "", "" }, // RpcServer
{ HostFalse, "", "", "" }, // RpcClient
{ HostFalse, "", "", "" }, // Alias
- { HostFalse, "", "", "-nostartfiles -nostdlib" }, // BootProgram
- { HostFalse, "", "", "" }, // Win32SCR
+ { HostFalse, "", "", "" }, // BootProgram
+ { HostFalse, "", "", "$(LDFLAG_WINDOWS)" }, // Win32SCR
{ HostFalse, "", "", "" }, // IdlHeader
{ HostFalse, "", "", "" }, // IdlInterface
- { HostFalse, "", "", "" }, // IsoRegTest
- { HostFalse, "", "", "" }, // LiveIsoRegTest
{ HostFalse, "", "", "" }, // EmbeddedTypeLib
{ HostFalse, "", "", "" }, // ElfExecutable
{ HostFalse, "", "", "" }, // RpcProxy
{ HostTrue, "", "", "" }, // HostStaticLibrary
{ HostFalse, "", "", "" }, // Cabinet
- { HostFalse, "", "", "" }, // KeyboardLayout
+ { HostFalse, "", "", "$(LDFLAG_DLL)" }, // KeyboardLayout
{ HostFalse, "", "", "" }, // MessageHeader
};
{
const FileLocation& file = files[i];
if ( wrap_at > 0 && wrap_count++ == wrap_at )
+ {
s += " \\\n\t\t";
+ wrap_count = 1;
+ }
else if ( s.size() )
s += " ";
s += backend->GetFullName ( file );
if ( !v[i].size() )
continue;
if ( wrap_at > 0 && wrap_count++ == wrap_at )
+ {
s += " \\\n\t\t";
+ wrap_count = 1;
+ }
else if ( s.size() )
s += " ";
s += v[i];
GenerateTestSupportCode ();
GenerateCompilationUnitSupportCode ();
GenerateSysSetup ();
+ GenerateInstallerFileList();
GenerateProxyMakefiles ();
CheckAutomaticDependencies ();
CloseMakefile ();
}
+void
+MingwBackend::GenerateInstallerFileList()
+{
+ this->ProjectNode.GenerateInstallerFileList();
+}
+
void
MingwBackend::CreateMakefile ()
{
}
string
-MingwBackend::GenerateProjectLFLAGS () const
+MingwBackend::GenerateProjectLDFLAGS () const
{
- string lflags;
+ string ldflags;
for ( size_t i = 0; i < ProjectNode.linkerFlags.size (); i++ )
{
LinkerFlag& linkerFlag = *ProjectNode.linkerFlags[i];
- if ( lflags.length () > 0 )
- lflags += " ";
- lflags += linkerFlag.flag;
+ if ( ldflags.length () > 0 )
+ ldflags += " ";
+ ldflags += linkerFlag.flag;
}
- return lflags;
+ return ldflags;
}
void
GenerateGlobalProperties ( "=", ProjectNode.non_if_data );
- fprintf ( fMakefile, "PROJECT_CFLAGS += -Wall\n" );
- fprintf ( fMakefile, "PROJECT_CXXFLAGS += -Wall\n" );
- fprintf ( fMakefile, "ifneq ($(OARCH),)\n" );
- fprintf ( fMakefile, "PROJECT_CFLAGS += -march=$(OARCH)\n" );
- fprintf ( fMakefile, "PROJECT_CXXFLAGS += -march=$(OARCH)\n" );
- fprintf ( fMakefile, "endif\n" );
- fprintf ( fMakefile, "ifneq ($(TUNE),)\n" );
- fprintf ( fMakefile, "PROJECT_CFLAGS += -mtune=$(TUNE)\n" );
- fprintf ( fMakefile, "PROJECT_CXXFLAGS += -mtune=$(TUNE)\n" );
- fprintf ( fMakefile, "endif\n" );
-
- fprintf ( fMakefile, "PROJECT_CFLAGS += -g%s\n", Environment::GetArch() == "amd64" ? "dwarf-2" : "stabs+" );
- fprintf ( fMakefile, "PROJECT_CXXFLAGS += -g%s\n", Environment::GetArch() == "amd64" ? "dwarf-2" : "stabs+" );
- fprintf ( fMakefile, "PROJECT_ASFLAGS += -g%s\n", Environment::GetArch() == "amd64" ? "dwarf-2" : "stabs+" );
-
- MingwModuleHandler::GenerateParameters ( "PROJECT", "+=", ProjectNode.non_if_data );
- MingwModuleHandler::GenerateParameters ( "PROJECT_HOST", "+=", ProjectNode.host_non_if_data );
-
- if ( usePipe )
+ if ( ProjectNode.configuration.Compiler == GnuGcc )
{
- fprintf ( fMakefile, "PROJECT_CFLAGS += -pipe\n" );
- fprintf ( fMakefile, "PROJECT_CXXFLAGS += -pipe\n" );
- fprintf ( fMakefile, "PROJECT_ASFLAGS += -pipe\n" );
- }
+ fprintf ( fMakefile, "ifneq ($(OARCH),)\n" );
+ fprintf ( fMakefile, "PROJECT_ASFLAGS += -march=$(OARCH)\n" );
+ fprintf ( fMakefile, "PROJECT_CFLAGS += -march=$(OARCH)\n" );
+ fprintf ( fMakefile, "PROJECT_CXXFLAGS += -march=$(OARCH)\n" );
+ fprintf ( fMakefile, "endif\n" );
+ fprintf ( fMakefile, "ifneq ($(TUNE),)\n" );
+ fprintf ( fMakefile, "PROJECT_CFLAGS += -mtune=$(TUNE)\n" );
+ fprintf ( fMakefile, "PROJECT_CXXFLAGS += -mtune=$(TUNE)\n" );
+ fprintf ( fMakefile, "endif\n" );
- // Because RosBE gcc is built to suck
- fputs ( "BUILTIN_HOST_CINCLUDES+= $(HOST_CFLAGS)\n", fMakefile );
- fputs ( "BUILTIN_HOST_CPPINCLUDES+= $(HOST_CFLAGS)\n", fMakefile );
- fputs ( "BUILTIN_HOST_CXXINCLUDES+= $(HOST_CPPFLAGS)\n", fMakefile );
-
- // Would be nice to have our own C++ runtime
- fputs ( "BUILTIN_CXXINCLUDES+= $(TARGET_CPPFLAGS)\n", fMakefile );
+ if ( usePipe )
+ {
+ fprintf ( fMakefile, "PROJECT_CFLAGS += -pipe\n" );
+ fprintf ( fMakefile, "PROJECT_CXXFLAGS += -pipe\n" );
+ fprintf ( fMakefile, "PROJECT_ASFLAGS += -pipe\n" );
+ }
- // TODO: linker flags
- fprintf ( fMakefile, "PROJECT_LFLAGS := '$(shell ${TARGET_CC} -print-libgcc-file-name)' %s\n", GenerateProjectLFLAGS ().c_str () );
- fprintf ( fMakefile, "PROJECT_LPPFLAGS := '$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)' '$(shell ${TARGET_CPP} -print-file-name=libgcc.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)' '$(shell ${TARGET_CPP} -print-file-name=libcoldname.a)'\n" );
- /* hack to get libgcc_eh.a, should check mingw version or something */
- if (Environment::GetArch() == "amd64")
- {
- fprintf ( fMakefile, "PROJECT_LPPFLAGS += '$(shell ${TARGET_CPP} -print-file-name=libgcc_eh.a)'\n" );
+ // Would be nice to have our own C++ runtime
+ fputs ( "BUILTIN_CXXINCLUDES+= $(TARGET_CPPFLAGS)\n", fMakefile );
+
+ fprintf ( fMakefile, "PROJECT_CCLIBS := \"$(shell ${TARGET_CC} -print-libgcc-file-name)\"\n" );
+
+ // We use our proprietary "ofmt_stub.a" to implement a stub for "_get_output_format" required by "libmingwex.a".
+ // This archive just contains the compiled "ofmt_stub.s" supplied with the MinGW Runtime sources.
+ fprintf ( fMakefile, "PROJECT_CXXLIBS := \"$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)\" \"$(shell ${TARGET_CPP} -print-libgcc-file-name)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)\" \"$(shell ${TARGET_CPP} -print-file-name=ofmt_stub.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libcoldname.a)\"\n" );
+
+ /* hack to get libgcc_eh.a, should check mingw version or something */
+ if (Environment::GetArch() == "amd64")
+ fprintf ( fMakefile, " \"$(shell ${TARGET_CPP} -print-file-name=libgcc_eh.a)\"" );
+ /* hack to get _get_output_format, needed by libmingwex */
+ else if (Environment::GetArch() == "i386")
+ fprintf ( fMakefile, "\"$(shell ${TARGET_CPP} -print-file-name=ofmt_stub.a)\"");
+ fprintf ( fMakefile,"\n");
}
+ MingwModuleHandler::GenerateParameters ( "PROJECT", "+=", ProjectNode.non_if_data );
+ MingwModuleHandler::GenerateParameters ( "PROJECT_HOST", "+=", ProjectNode.host_non_if_data );
+
+ fprintf ( fMakefile, "PROJECT_LDFLAGS := %s\n", GenerateProjectLDFLAGS ().c_str () );
// TODO: use symbolic names for module types
for ( size_t i = 0; i < sizeof(ModuleHandlerInformations) / sizeof(ModuleHandlerInformations[0]); ++ i )
{
fprintf ( fMakefile,
"MODULETYPE%d_%sFLAGS:=%s\n",
- i,
+ (int)i,
"C",
ModuleHandlerInformations[i].cflags );
}
- if ( ModuleHandlerInformations[i].cflags && ModuleHandlerInformations[i].cflags[0] )
+ if ( ModuleHandlerInformations[i].nasmflags && ModuleHandlerInformations[i].nasmflags[0] )
{
fprintf ( fMakefile,
"MODULETYPE%d_%sFLAGS:=%s\n",
- i,
- "CXX",
- ModuleHandlerInformations[i].cflags );
+ (int)i,
+ "NASM",
+ ModuleHandlerInformations[i].nasmflags );
}
- if ( ModuleHandlerInformations[i].nasmflags && ModuleHandlerInformations[i].nasmflags[0] )
+ if ( ModuleHandlerInformations[i].linkerflags && ModuleHandlerInformations[i].linkerflags[0] )
{
fprintf ( fMakefile,
"MODULETYPE%d_%sFLAGS:=%s\n",
- i,
- "NASM",
- ModuleHandlerInformations[i].nasmflags );
+ (int)i,
+ "LD",
+ ModuleHandlerInformations[i].linkerflags );
}
}
+ fprintf ( fMakefile,
+ "MODULETYPE%d_KMODE:=yes\n",
+ (int)Kernel );
+
+ fprintf ( fMakefile,
+ "MODULETYPE%d_KMODE:=yes\n",
+ (int)KernelModeDLL );
+
+ fprintf ( fMakefile,
+ "MODULETYPE%d_KMODE:=yes\n",
+ (int)KernelModeDriver );
+
fprintf ( fMakefile, "\n" );
}
return false;
if ( module.type == LiveIso )
return false;
- if ( module.type == IsoRegTest )
- return false;
- if ( module.type == LiveIsoRegTest )
- return false;
if ( module.type == Test )
return false;
if ( module.type == Alias )
if ( ProjectNode.configuration.Compiler == GnuGcc )
{
+ const string& TARGET_CCValue = Environment::GetVariable ( "TARGET_CC" );
const string& ROS_PREFIXValue = Environment::GetVariable ( "ROS_PREFIX" );
- if ( ROS_PREFIXValue.length () > 0 )
+
+ if ( TARGET_CCValue.length () > 0 )
{
- compilerPrefix = ROS_PREFIXValue;
- compilerCommand = compilerPrefix + "-gcc";
+ compilerPrefix = "";
+ compilerCommand = TARGET_CCValue;
detectedCompiler = TryToDetectThisCompiler ( compilerCommand );
}
+
+ if ( !detectedCompiler )
+ {
+ if ( ROS_PREFIXValue.length () > 0 )
+ {
+ compilerPrefix = ROS_PREFIXValue;
+ compilerCommand = compilerPrefix + "-gcc";
+ detectedCompiler = TryToDetectThisCompiler ( compilerCommand );
+ }
+ }
#if defined(WIN32)
if ( !detectedCompiler )
{
}
else if ( ProjectNode.configuration.Compiler == MicrosoftC )
{
+ compilerCommand = "cl";
detectedCompiler = DetectMicrosoftCompiler ( compilerVersion, mscPath );
supportedCompiler = true; // TODO
}
buffer[i] = '\0';
pclose ( fp );
- char separators[] = " ()";
+ char separators[] = " ()\n";
char *token;
char *prevtoken = NULL;
string
MingwBackend::GetCompilerVersion ( const string& compilerCommand )
{
- string versionCommand = ssprintf ( "%s --version gcc",
+ string versionCommand = ssprintf ( "%s --version",
compilerCommand.c_str (),
NUL,
NUL );
bool
MingwBackend::IsSupportedCompilerVersion ( const string& compilerVersion )
{
- if ( strcmp ( compilerVersion.c_str (), "3.4.2") < 0 )
+ if ( strcmp ( compilerVersion.c_str (), "4.4.0") < 0 )
return false;
else
return true;
bool
MingwBackend::IsSupportedBinutilsVersion ( const string& binutilsVersion )
{
- if ( manualBinutilsSetting ) return true;
-
- /* linux */
- if ( binutilsVersion.find('.') != std::string::npos )
+ int digit = binutilsVersion.find_last_of(".");
+ if(digit == -1)
+ {
+ printf("Unable to detect binutils version!\n");
+ return false;
+ }
+
+ string date = string(binutilsVersion, digit + 1);
+ if(date.length() == 8)
{
- /* TODO: blacklist versions on version number instead of date */
- return true;
+ /* This is a real date in the format YYYYMMDD.
+ Check whether we have at least Binutils 20091016 (the oldest one
+ we were still using after upgrading to RosBE 1.5). */
+ if(strcmp(date.c_str(), "20091016") < 0)
+ return false;
}
-
- /*
- * - Binutils older than 2003/10/01 have broken windres which can't handle
- * icons with alpha channel.
- * - Binutils between 2004/09/02 and 2004/10/08 have broken handling of
- * forward exports in dlltool.
- */
- if ( ( ( strcmp ( binutilsVersion.c_str (), "20040902") >= 0 ) &&
- ( strcmp ( binutilsVersion.c_str (), "20041008") <= 0 ) ) ||
- ( strcmp ( binutilsVersion.c_str (), "20031001") < 0 ) )
- return false;
else
- return true;
+ {
+ /* This is no date, so binutilsVersion should just contain the version
+ number.
+ Binutils 2.20 will hopefully contain the required features. */
+ if(strcmp(binutilsVersion.c_str(), "2.20") < 0)
+ return false;
+ }
+
+ return true;
}
void
}
else if ( ProjectNode.configuration.Linker == MicrosoftLink )
{
+ compilerCommand = "link";
detectedBinutils = DetectMicrosoftLinker ( binutilsVersion, mslinkPath );
supportedBinutils = true; // TODO
}
else
printf ( "not detected\n" );
}
+ else
+ usePipe = false;
}
void
"install_registry: %s\n",
registryTargetFiles.c_str () );
fprintf ( fMakefile,
- "%s: %s %s $(MKHIVE_TARGET)\n",
+ "%s: %s %s $(mkhive_TARGET)\n",
registryTargetFiles.c_str (),
registrySourceFiles.c_str (),
GetFullPath ( system32 ).c_str () );
fprintf ( fMakefile,
"\t$(ECHO_MKHIVE)\n" );
fprintf ( fMakefile,
- "\t$(MKHIVE_TARGET) boot%cbootdata %s $(ARCH) boot%cbootdata%chiveinst_$(ARCH).inf\n",
+ "\t$(mkhive_TARGET) boot%cbootdata %s $(ARCH) boot%cbootdata%chiveinst_$(ARCH).inf\n",
cSep, GetFullPath ( system32 ).c_str (),
cSep, cSep );
fprintf ( fMakefile,