typedef set<string> set_string;
+const struct ModuleHandlerInformations ModuleHandlerInformations[] = {
+ { 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, "", "-f bin", "" }, // BootSector
+ { HostFalse, "", "", "" }, // Iso
+ { HostFalse, "", "", "" }, // LiveIso
+ { HostFalse, "", "", "" }, // Test
+ { HostFalse, "", "", "" }, // RpcServer
+ { HostFalse, "", "", "" }, // RpcClient
+ { HostFalse, "", "", "" }, // Alias
+ { HostFalse, "", "", "-nostartfiles -nostdlib" }, // BootProgram
+ { HostFalse, "", "", "" }, // Win32SCR
+ { HostFalse, "", "", "" }, // IdlHeader
+ { HostFalse, "", "", "" }, // IdlInterface
+ { HostFalse, "", "", "" }, // IsoRegTest
+ { HostFalse, "", "", "" }, // LiveIsoRegTest
+ { HostFalse, "", "", "" }, // EmbeddedTypeLib
+ { HostFalse, "", "", "" }, // ElfExecutable
+ { HostFalse, "", "", "" }, // RpcProxy
+ { HostTrue, "", "", "" }, // HostStaticLibrary
+ { HostFalse, "", "", "" }, // Cabinet
+ { HostFalse, "", "", "" }, // KeyboardLayout
+ { HostFalse, "", "", "" }, // MessageHeader
+};
+
+static std::string mscPath;
+static std::string mslinkPath;
+
string
MingwBackend::GetFullPath ( const FileLocation& file ) const
{
for ( i = 0; i < compilationUnits.size (); i++ )
{
CompilationUnit& compilationUnit = *compilationUnits[i];
- if ( compilationUnit.files.size () != 1 )
+ if ( compilationUnit.GetFiles ().size () != 1 )
return false;
}
- // intentionally make a copy so that we can append more work in
- // the middle of processing without having to go recursive
- vector<If*> v = module.non_if_data.ifs;
- for ( i = 0; i < v.size (); i++ )
- {
- size_t j;
- If& rIf = *v[i];
- // check for sub-ifs to add to list
- const vector<If*>& ifs = rIf.data.ifs;
- for ( j = 0; j < ifs.size (); j++ )
- v.push_back ( ifs[j] );
- const vector<CompilationUnit*>& compilationUnits = rIf.data.compilationUnits;
- for ( j = 0; j < compilationUnits.size (); j++ )
- {
- CompilationUnit& compilationUnit = *compilationUnits[j];
- if ( compilationUnit.files.size () != 1 )
- return false;
- }
- }
return true;
}
vector<MingwModuleHandler*> v;
size_t i;
- for ( i = 0; i < ProjectNode.modules.size (); i++ )
+ for ( std::map<std::string, Module*>::iterator p = ProjectNode.modules.begin (); p != ProjectNode.modules.end (); ++ p )
+ fprintf ( fMakefile, "%s_TYPE:=%u\n", p->second->name.c_str(), p->second->type );
+
+ for ( std::map<std::string, Module*>::iterator p = ProjectNode.modules.begin (); p != ProjectNode.modules.end (); ++ p )
{
- Module& module = *ProjectNode.modules[i];
+ Module& module = *p->second;
if ( !module.enabled )
continue;
MingwModuleHandler* h = MingwModuleHandler::InstanciateHandler (
h->AddImplicitLibraries ( module );
if ( use_pch && CanEnablePreCompiledHeaderSupportForModule ( module ) )
h->EnablePreCompiledHeaderSupport ();
- if ( module.host == HostDefault )
- {
- module.host = h->DefaultHost();
- assert ( module.host != HostDefault );
- }
v.push_back ( h );
}
fprintf ( fMakefile, "\n" );
GenerateAllTarget ( v );
- GenerateInitTarget ();
GenerateRegTestsRunTarget ();
for ( i = 0; i < iend; i++ )
void
MingwBackend::CheckAutomaticDependenciesForModuleOnly ()
{
- if ( configuration.AutomaticDependencies )
+ if ( configuration.Dependencies == AutomaticDependencies )
{
Module* module = ProjectNode.LocateModule ( configuration.CheckDependenciesForModuleOnlyModule );
if ( module == NULL )
void
MingwBackend::ProcessNormal ()
{
+ assert(sizeof(ModuleHandlerInformations)/sizeof(ModuleHandlerInformations[0]) == TypeDontCare);
+
DetectCompiler ();
DetectBinutils ();
DetectNetwideAssembler ();
GenerateHeader ();
GenerateGlobalVariables ();
GenerateXmlBuildFilesMacro ();
- UnpackWineResources ();
ProcessModules ();
GenerateInstallTarget ();
GenerateTestTarget ();
}
void
-MingwBackend::GenerateProjectCFlagsMacro ( const char* assignmentOperation,
- const IfableData& data ) const
-{
- set<string> used_defs;
-
- if ( data.includes.size () > 0 )
- fprintf (
- fMakefile,
- "PROJECT_CFLAGS %s %s\n",
- assignmentOperation,
- MingwModuleHandler::GenerateGccIncludeParametersFromVector ( data.includes ).c_str ());
-
- if ( data.defines.size () > 0 )
- fprintf (
- fMakefile,
- "PROJECT_CDEFINES %s %s\n",
- assignmentOperation,
- MingwModuleHandler::GenerateGccDefineParametersFromVector ( data.defines, used_defs ).c_str ());
-}
-
-void
-MingwBackend::GenerateGlobalCFlagsAndProperties (
+MingwBackend::GenerateGlobalProperties (
const char* assignmentOperation,
const IfableData& data ) const
{
- size_t i;
-
- for ( i = 0; i < data.properties.size(); i++ )
- {
- Property& prop = *data.properties[i];
- fprintf ( fMakefile, "%s := %s\n",
- prop.name.c_str(),
- prop.value.c_str() );
- }
-
- if ( data.includes.size() || data.defines.size() )
- {
- GenerateProjectCFlagsMacro ( assignmentOperation,
- data );
- }
-
- for ( i = 0; i < data.ifs.size(); i++ )
- {
- const If& rIf = *data.ifs[i];
- if ( rIf.data.defines.size()
- || rIf.data.includes.size()
- || rIf.data.ifs.size() )
- {
- fprintf (
- fMakefile,
- "ifeq (\"$(%s)\",\"%s\")\n",
- rIf.property.c_str(),
- rIf.value.c_str() );
- GenerateGlobalCFlagsAndProperties (
- "+=",
- rIf.data );
- fprintf (
- fMakefile,
- "endif\n\n" );
- }
- }
-}
-
-void
-MingwBackend::GenerateProjectGccOptionsMacro ( const char* assignmentOperation,
- IfableData& data ) const
-{
- size_t i;
-
- fprintf (
- fMakefile,
- "PROJECT_GCCOPTIONS %s",
- assignmentOperation );
-
- for ( i = 0; i < data.compilerFlags.size(); i++ )
- {
- fprintf (
- fMakefile,
- " %s",
- data.compilerFlags[i]->flag.c_str() );
- }
-
- fprintf ( fMakefile, "\n" );
-}
-
-void
-MingwBackend::GenerateProjectGccOptions (
- const char* assignmentOperation,
- IfableData& data ) const
-{
- size_t i;
-
- if ( data.compilerFlags.size() )
+ for ( std::map<std::string, Property*>::const_iterator p = data.properties.begin(); p != data.properties.end(); ++ p )
{
- GenerateProjectGccOptionsMacro ( assignmentOperation,
- data );
- }
+ Property& prop = *p->second;
- for ( i = 0; i < data.ifs.size(); i++ )
- {
- If& rIf = *data.ifs[i];
- if ( rIf.data.compilerFlags.size()
- || rIf.data.ifs.size() )
+ if (!prop.isInternal)
{
- fprintf (
- fMakefile,
- "ifeq (\"$(%s)\",\"%s\")\n",
- rIf.property.c_str(),
- rIf.value.c_str() );
- GenerateProjectGccOptions (
- "+=",
- rIf.data );
- fprintf (
- fMakefile,
- "endif\n\n" );
+ fprintf ( fMakefile, "%s := %s\n",
+ prop.name.c_str(),
+ prop.value.c_str() );
}
}
}
void
MingwBackend::GenerateGlobalVariables () const
{
+ fputs ( "include tools$(SEP)rbuild$(SEP)backend$(SEP)mingw$(SEP)rules.mak\n", fMakefile );
+ fprintf ( fMakefile, "include tools$(SEP)rbuild$(SEP)backend$(SEP)mingw$(SEP)linkers$(SEP)%s.mak\n", ProjectNode.GetLinkerSet ().c_str () );
+ fprintf ( fMakefile, "include tools$(SEP)rbuild$(SEP)backend$(SEP)mingw$(SEP)compilers$(SEP)%s.mak\n", ProjectNode.GetCompilerSet ().c_str () );
+
+ if ( mscPath.length() )
+ fprintf ( fMakefile, "export RBUILD_CL_PATH=%s\n", mscPath.c_str () );
+
+ if ( mslinkPath.length() )
+ fprintf ( fMakefile, "export RBUILD_LINK_PATH=%s\n", mslinkPath.c_str () );
+
+ if ( configuration.Dependencies == FullDependencies )
+ {
+ fprintf ( fMakefile,
+ "ifeq ($(ROS_BUILDDEPS),)\n"
+ "ROS_BUILDDEPS:=%s\n"
+ "endif\n",
+ "full" );
+ }
+
fprintf ( fMakefile,
"PREFIX := %s\n",
compilerPrefix.c_str () );
fprintf ( fMakefile,
- "nasm := %s\n",
+ "nasm := $(Q)%s\n",
nasmCommand.c_str () );
- GenerateGlobalCFlagsAndProperties ( "=", ProjectNode.non_if_data );
- GenerateProjectGccOptions ( "=", ProjectNode.non_if_data );
-
- fprintf ( fMakefile, "PROJECT_RCFLAGS := $(PROJECT_CFLAGS) $(PROJECT_CDEFINES)\n" );
- fprintf ( fMakefile, "PROJECT_WIDLFLAGS := $(PROJECT_CFLAGS) $(PROJECT_CDEFINES)\n" );
- fprintf ( fMakefile, "PROJECT_LFLAGS := %s\n",
- GenerateProjectLFLAGS ().c_str () );
- fprintf ( fMakefile, "PROJECT_CFLAGS += -Wall\n" );
- fprintf ( fMakefile, "ifneq ($(OARCH),)\n" );
- fprintf ( fMakefile, "PROJECT_CFLAGS += -march=$(OARCH)\n" );
- fprintf ( fMakefile, "endif\n" );
- fprintf ( fMakefile, "PROJECT_CFLAGS += $(PROJECT_GCCOPTIONS)\n" );
+ GenerateGlobalProperties ( "=", ProjectNode.non_if_data );
+
+ if ( ProjectNode.configuration.Compiler == GnuGcc )
+ {
+ 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" );
+
+ if ( usePipe )
+ {
+ fprintf ( fMakefile, "PROJECT_CFLAGS += -pipe\n" );
+ fprintf ( fMakefile, "PROJECT_CXXFLAGS += -pipe\n" );
+ fprintf ( fMakefile, "PROJECT_ASFLAGS += -pipe\n" );
+ }
+
+ // Would be nice to have our own C++ runtime
+ fputs ( "BUILTIN_CXXINCLUDES+= $(TARGET_CPPFLAGS)\n", fMakefile );
+ }
+
+ // 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 );
+
+ MingwModuleHandler::GenerateParameters ( "PROJECT", "+=", ProjectNode.non_if_data );
+ MingwModuleHandler::GenerateParameters ( "PROJECT_HOST", "+=", ProjectNode.host_non_if_data );
+
+ // 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)'\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" );
+ }
+
+ // TODO: use symbolic names for module types
+ for ( size_t i = 0; i < sizeof(ModuleHandlerInformations) / sizeof(ModuleHandlerInformations[0]); ++ i )
+ {
+ if ( ModuleHandlerInformations[i].cflags && ModuleHandlerInformations[i].cflags[0] )
+ {
+ fprintf ( fMakefile,
+ "MODULETYPE%d_%sFLAGS:=%s\n",
+ (int)i,
+ "C",
+ ModuleHandlerInformations[i].cflags );
+ }
+
+ if ( ModuleHandlerInformations[i].cflags && ModuleHandlerInformations[i].cflags[0] )
+ {
+ fprintf ( fMakefile,
+ "MODULETYPE%d_%sFLAGS:=%s\n",
+ (int)i,
+ "CXX",
+ ModuleHandlerInformations[i].cflags );
+ }
+
+ if ( ModuleHandlerInformations[i].nasmflags && ModuleHandlerInformations[i].nasmflags[0] )
+ {
+ fprintf ( fMakefile,
+ "MODULETYPE%d_%sFLAGS:=%s\n",
+ (int)i,
+ "NASM",
+ ModuleHandlerInformations[i].nasmflags );
+ }
+ }
+
fprintf ( fMakefile, "\n" );
}
fprintf ( fMakefile, "\n\t\n\n" );
}
-string
-MingwBackend::GetBuildToolDependencies () const
-{
- string dependencies;
- for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
- {
- Module& module = *ProjectNode.modules[i];
- if ( !module.enabled )
- continue;
- if ( module.type == BuildTool )
- {
- if ( dependencies.length () > 0 )
- dependencies += " ";
- dependencies += GetFullName ( *module.dependency );
- }
- }
- return dependencies;
-}
-
-void
-MingwBackend::GenerateInitTarget () const
-{
- fprintf ( fMakefile,
- "INIT = %s\n",
- GetBuildToolDependencies ().c_str () );
- fprintf ( fMakefile, "\n" );
-}
-
void
MingwBackend::GenerateRegTestsRunTarget () const
{
fprintf ( fMakefile, "\n" );
}
-string
-MingwBackend::GetBin2ResExecutable ()
-{
- return NormalizeFilename ( Environment::GetOutputPath () + sSep + "tools/bin2res/bin2res" + ExePostfix );
-}
-
-void
-MingwBackend::UnpackWineResources ()
-{
- printf ( "Unpacking WINE resources..." );
- WineResource wineResource ( ProjectNode,
- GetBin2ResExecutable () );
- wineResource.UnpackResources ( configuration.Verbose );
- printf ( "done\n" );
-}
-
void
MingwBackend::GenerateTestSupportCode ()
{
void
MingwBackend::CheckAutomaticDependencies ()
{
- if ( configuration.AutomaticDependencies )
+ if ( configuration.Dependencies == AutomaticDependencies )
{
printf ( "Checking automatic dependencies..." );
AutomaticDependency automaticDependency ( ProjectNode );
printf ( "Detecting compiler..." );
bool detectedCompiler = false;
- const string& ROS_PREFIXValue = Environment::GetVariable ( "ROS_PREFIX" );
- if ( ROS_PREFIXValue.length () > 0 )
+ bool supportedCompiler = false;
+ string compilerVersion;
+
+ if ( ProjectNode.configuration.Compiler == GnuGcc )
{
- compilerPrefix = ROS_PREFIXValue;
- compilerCommand = compilerPrefix + "-gcc";
- detectedCompiler = TryToDetectThisCompiler ( compilerCommand );
- }
+ const string& ROS_PREFIXValue = Environment::GetVariable ( "ROS_PREFIX" );
+ if ( ROS_PREFIXValue.length () > 0 )
+ {
+ compilerPrefix = ROS_PREFIXValue;
+ compilerCommand = compilerPrefix + "-gcc";
+ detectedCompiler = TryToDetectThisCompiler ( compilerCommand );
+ }
#if defined(WIN32)
- if ( !detectedCompiler )
- {
- compilerPrefix = "";
- compilerCommand = "gcc";
- detectedCompiler = TryToDetectThisCompiler ( compilerCommand );
- }
+ if ( !detectedCompiler )
+ {
+ compilerPrefix = "";
+ compilerCommand = "gcc";
+ detectedCompiler = TryToDetectThisCompiler ( compilerCommand );
+ }
#endif
- if ( !detectedCompiler )
+ if ( !detectedCompiler )
+ {
+ compilerPrefix = "mingw32";
+ compilerCommand = compilerPrefix + "-gcc";
+ detectedCompiler = TryToDetectThisCompiler ( compilerCommand );
+ }
+
+ if ( detectedCompiler )
+ compilerVersion = GetCompilerVersion ( compilerCommand );
+
+ supportedCompiler = IsSupportedCompilerVersion ( compilerVersion );
+ }
+ else if ( ProjectNode.configuration.Compiler == MicrosoftC )
{
- compilerPrefix = "mingw32";
- compilerCommand = compilerPrefix + "-gcc";
- detectedCompiler = TryToDetectThisCompiler ( compilerCommand );
+ compilerCommand = "cl";
+ detectedCompiler = DetectMicrosoftCompiler ( compilerVersion, mscPath );
+ supportedCompiler = true; // TODO
}
if ( detectedCompiler )
{
- string compilerVersion = GetCompilerVersion ( compilerCommand );
- if ( IsSupportedCompilerVersion ( compilerVersion ) )
+ if ( supportedCompiler )
printf ( "detected (%s %s)\n", compilerCommand.c_str (), compilerVersion.c_str() );
else
{
buffer[i] = '\0';
pclose ( fp );
- char separators[] = " ";
+ char separators[] = " ()";
char *token;
char *prevtoken = NULL;
printf ( "Detecting binutils..." );
bool detectedBinutils = false;
- const string& ROS_PREFIXValue = Environment::GetVariable ( "ROS_PREFIX" );
+ bool supportedBinutils = false;
+ string binutilsVersion;
- if ( ROS_PREFIXValue.length () > 0 )
+ if ( ProjectNode.configuration.Linker == GnuLd )
{
- binutilsPrefix = ROS_PREFIXValue;
- binutilsCommand = binutilsPrefix + "-ld";
- manualBinutilsSetting = true;
- detectedBinutils = true;
- }
+ const string& ROS_PREFIXValue = Environment::GetVariable ( "ROS_PREFIX" );
+
+ if ( ROS_PREFIXValue.length () > 0 )
+ {
+ binutilsPrefix = ROS_PREFIXValue;
+ binutilsCommand = binutilsPrefix + "-ld";
+ manualBinutilsSetting = true;
+ detectedBinutils = true;
+ }
#if defined(WIN32)
- if ( !detectedBinutils )
- {
- binutilsPrefix = "";
- binutilsCommand = "ld";
- detectedBinutils = TryToDetectThisBinutils ( binutilsCommand );
- }
+ if ( !detectedBinutils )
+ {
+ binutilsPrefix = "";
+ binutilsCommand = "ld";
+ detectedBinutils = TryToDetectThisBinutils ( binutilsCommand );
+ }
#endif
- if ( !detectedBinutils )
+ if ( !detectedBinutils )
+ {
+ binutilsPrefix = "mingw32";
+ binutilsCommand = binutilsPrefix + "-ld";
+ detectedBinutils = TryToDetectThisBinutils ( binutilsCommand );
+ }
+ if ( detectedBinutils )
+ {
+ binutilsVersion = GetBinutilsVersionDate ( binutilsCommand );
+ supportedBinutils = IsSupportedBinutilsVersion ( binutilsVersion );
+ }
+ }
+ else if ( ProjectNode.configuration.Linker == MicrosoftLink )
{
- binutilsPrefix = "mingw32";
- binutilsCommand = binutilsPrefix + "-ld";
- detectedBinutils = TryToDetectThisBinutils ( binutilsCommand );
+ compilerCommand = "link";
+ detectedBinutils = DetectMicrosoftLinker ( binutilsVersion, mslinkPath );
+ supportedBinutils = true; // TODO
}
+
if ( detectedBinutils )
{
- string binutilsVersion = GetBinutilsVersionDate ( binutilsCommand );
- if ( IsSupportedBinutilsVersion ( binutilsVersion ) )
- printf ( "detected (%s %s)\n", binutilsCommand.c_str (), GetBinutilsVersion( binutilsCommand ).c_str() );
+ if ( supportedBinutils )
+ printf ( "detected (%s %s)\n", binutilsCommand.c_str (), binutilsVersion.c_str() );
else
{
printf ( "detected (%s), but with unsupported version (%s)\n",
void
MingwBackend::DetectPipeSupport ()
{
- printf ( "Detecting compiler -pipe support..." );
-
- string pipe_detection = "tools" + sSep + "rbuild" + sSep + "backend" + sSep + "mingw" + sSep + "pipe_detection.c";
- string pipe_detectionObjectFilename = ReplaceExtension ( pipe_detection,
- ".o" );
- string command = ssprintf (
- "%s -pipe -c %s -o %s 1>%s 2>%s",
- FixSeparatorForSystemCommand(compilerCommand).c_str (),
- pipe_detection.c_str (),
- pipe_detectionObjectFilename.c_str (),
- NUL,
- NUL );
- int exitcode = system ( command.c_str () );
- FILE* f = fopen ( pipe_detectionObjectFilename.c_str (), "rb" );
- if ( f )
+ if ( ProjectNode.configuration.Compiler == GnuGcc )
{
- usePipe = (exitcode == 0);
- fclose ( f );
- unlink ( pipe_detectionObjectFilename.c_str () );
+ printf ( "Detecting compiler -pipe support..." );
+
+ string pipe_detection = "tools" + sSep + "rbuild" + sSep + "backend" + sSep + "mingw" + sSep + "pipe_detection.c";
+ string pipe_detectionObjectFilename = ReplaceExtension ( pipe_detection,
+ ".o" );
+ string command = ssprintf (
+ "%s -pipe -c %s -o %s 1>%s 2>%s",
+ FixSeparatorForSystemCommand(compilerCommand).c_str (),
+ pipe_detection.c_str (),
+ pipe_detectionObjectFilename.c_str (),
+ NUL,
+ NUL );
+ int exitcode = system ( command.c_str () );
+ FILE* f = fopen ( pipe_detectionObjectFilename.c_str (), "rb" );
+ if ( f )
+ {
+ usePipe = (exitcode == 0);
+ fclose ( f );
+ unlink ( pipe_detectionObjectFilename.c_str () );
+ }
+ else
+ usePipe = false;
+
+ if ( usePipe )
+ printf ( "detected\n" );
+ else
+ printf ( "not detected\n" );
}
else
usePipe = false;
-
- if ( usePipe )
- printf ( "detected\n" );
- else
- printf ( "not detected\n" );
}
void
{
printf ( "Detecting compiler pre-compiled header support..." );
- string path = "tools" + sSep + "rbuild" + sSep + "backend" + sSep + "mingw" + sSep + "pch_detection.h";
- string cmd = ssprintf (
- "%s -c %s 1>%s 2>%s",
- FixSeparatorForSystemCommand(compilerCommand).c_str (),
- path.c_str (),
- NUL,
- NUL );
- system ( cmd.c_str () );
- path += ".gch";
-
- FILE* f = fopen ( path.c_str (), "rb" );
- if ( f )
+ if ( configuration.PrecompiledHeadersEnabled && ProjectNode.configuration.Compiler == GnuGcc )
{
- use_pch = true;
- fclose ( f );
- unlink ( path.c_str () );
+ string path = "tools" + sSep + "rbuild" + sSep + "backend" + sSep + "mingw" + sSep + "pch_detection.h";
+ string cmd = ssprintf (
+ "%s -c %s 1>%s 2>%s",
+ FixSeparatorForSystemCommand(compilerCommand).c_str (),
+ path.c_str (),
+ NUL,
+ NUL );
+ system ( cmd.c_str () );
+ path += ".gch";
+
+ FILE* f = fopen ( path.c_str (), "rb" );
+ if ( f )
+ {
+ use_pch = true;
+ fclose ( f );
+ unlink ( path.c_str () );
+ }
+ else
+ use_pch = false;
+
+ if ( use_pch )
+ printf ( "detected\n" );
+ else
+ printf ( "not detected\n" );
}
else
+ {
use_pch = false;
-
- if ( use_pch )
- printf ( "detected\n" );
- else
- printf ( "not detected\n" );
+ printf ( "disabled\n" );
+ }
}
void
MingwBackend::GetModuleInstallTargetFiles (
vector<FileLocation>& out ) const
{
- for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
+ for ( std::map<std::string, Module*>::const_iterator p = ProjectNode.modules.begin (); p != ProjectNode.modules.end (); ++ p )
{
- const Module& module = *ProjectNode.modules[i];
+ const Module& module = *p->second;
if ( !module.enabled )
continue;
if ( module.install )
void
MingwBackend::OutputModuleInstallTargets ()
{
- for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
+ for ( std::map<std::string, Module*>::const_iterator p = ProjectNode.modules.begin (); p != ProjectNode.modules.end (); ++ p )
{
- const Module& module = *ProjectNode.modules[i];
+ const Module& module = *p->second;
if ( !module.enabled )
continue;
if ( module.install )
string
MingwBackend::GetRegistrySourceFiles ()
{
- return "boot" + sSep + "bootdata" + sSep + "hivecls.inf "
- "boot" + sSep + "bootdata" + sSep + "hivedef.inf "
- "boot" + sSep + "bootdata" + sSep + "hiveinst.inf "
- "boot" + sSep + "bootdata" + sSep + "hivesft.inf "
- "boot" + sSep + "bootdata" + sSep + "hivesys.inf";
+ return "boot" + sSep + "bootdata" + sSep + "hivecls_" + Environment::GetArch() + ".inf "
+ "boot" + sSep + "bootdata" + sSep + "hivedef_" + Environment::GetArch() + ".inf "
+ "boot" + sSep + "bootdata" + sSep + "hiveinst_" + Environment::GetArch() + ".inf "
+ "boot" + sSep + "bootdata" + sSep + "hivesft_" + Environment::GetArch() + ".inf "
+ "boot" + sSep + "bootdata" + sSep + "hivesys_" + Environment::GetArch() + ".inf ";
}
string
fprintf ( fMakefile,
"\t$(ECHO_MKHIVE)\n" );
fprintf ( fMakefile,
- "\t$(MKHIVE_TARGET) boot%cbootdata %s boot%cbootdata%chiveinst.inf\n",
+ "\t$(MKHIVE_TARGET) boot%cbootdata %s $(ARCH) boot%cbootdata%chiveinst_$(ARCH).inf\n",
cSep, GetFullPath ( system32 ).c_str (),
cSep, cSep );
fprintf ( fMakefile,
MingwBackend::GetModuleTestTargets (
vector<string>& out ) const
{
- for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
+ for ( std::map<std::string, Module*>::const_iterator p = ProjectNode.modules.begin (); p != ProjectNode.modules.end (); ++ p )
{
- const Module& module = *ProjectNode.modules[i];
+ const Module& module = *p->second;
if ( !module.enabled )
continue;
if ( module.type == Test )